fcn从头开始

介绍 (Introduction)

With Web 3.0 and blockchain becoming more mainstream every day, do you know what blockchain is? Do you know its technical advantages and use-cases?

随着Web 3.0和区块链每天变得越来越主流,您知道什么是区块链吗? 您知道它的技术优势和用例吗?

The goal of this tutorial is to introduce blockchain technology from a technical perspective by building one from scratch.

本教程的目的是通过从头开始构建区块链技术,从技术角度介绍区块链技术。

Forget everything you've heard about blockchain from social media. Now, you will build a blockchain system from ground zero to really understand the ins and outs of this peer-to-peer, distributed technology.

忘记您从社交媒体上听到的有关区块链的所有信息。 现在,您将从零开始构建一个区块链系统,以真正了解这种对等分布式技术的来龙去脉。

Afterwards, make your own mind up about its future and advantages. Spoiler alert: you will fall in love with programming blockchain software.

然后,自己决定其未来和优势。 剧透警报:您将爱上编程区块链软件。

怎么样? (How?)

You will follow the story of a software developer who is looking to revolutionize his local bar by implementing blockchain technology for its payment system.

您将跟随一个软件开发人员的故事,该软件开发人员希望通过为其支付系统实施区块链技术来革新其本地律师事务所。

Although blockchain has several undeniable use-cases, at the moment, the number one application is payments. This is because banks are still running on an inefficient, 40 year old infrastructure powered by CSV files and FTP.

尽管区块链有多个不可否认的用例,但目前,排名第一的应用是支付。 这是因为银行仍在使用CSV文件和FTP的低效率,已有40年历史的基础架构上运行。

The story comes with a lot of fun and intriguing facts about the overall blockchain ecosystem and different protocols such as Bitcoin, Ethereum and XRP.

这个故事带来了关于整个区块链生态系统以及比特币,以太坊和XRP等不同协议的许多有趣有趣的事实。

您将在本教程中构建,学习和做什么? (What will you build, learn, and do in this tutorial?)

  • You'll setup a Go project on your local machine without any prior GoLang experience您将在没有任何GoLang经验的情况下在本地计算机上设置Go项目
  • You'll generate and distribute your first blockchain tokens您将生成并分发您的第一个区块链令牌
  • You'll develop a CLI controlled database in Go from scratch您将在Go中从头开始开发CLI控制的数据库
  • You'll find out how few rights users posses in their favourite apps您会发现在他们最喜欢的应用中,有多少位权限用户拥有
  • You'll discover the blockchain's main value proposition您会发现区块链的主要价值主张
  • You'll make your DB immutable using a secure cryptographic hash function您将使用安全的加密哈希函数使数据库不可变

So let's get started and jump into our story.

因此,让我们开始吧,进入我们的故事。

⭐认识主角安德烈(Andrej)。 (⭐ Meet the protagonist, Andrej.)

Andrej is a bar owner by night and a software developer by day in a small Slovakian town called Bardejov.

Andrej晚上在斯洛伐克的一个叫Bardejov的小镇里是酒吧的老板,白天是软件开发人员。

Andrej is tired of:

安德烈(Andrej)厌倦了:

  • Programming solid, old fashion PHP/Java/Javascript applications

    编程可靠的老式PHP / Java / Javascript应用程序

  • Forgetting how much money his friends and clients owe him for all the unpaid Friday night vodka shots忘记了他的朋友和客户欠他周五晚上所有未付的伏特加酒花多少钱
  • Spending time collecting and counting coins, returning change and generally touching COVID-19-exposed bank bills花费时间收集和计数硬币,退还找零钱并且通常接触COVID-19暴露的银行票据
  • Maintaining different plastic chips for table football, darts, billiard and poker维护用于桌上足球,Dart,台球和扑克的不同塑料芯片

Andrej would love to:

安德烈(Andrej)希望:

  • Have a perfect auditable history of the bar's activities and sales to make his bar compliant with tax regulations

    对酒吧的活动和销售有完善的可审计历史,以使其酒吧符合税收法规

  • Transform his bar into an autonomous, payment-efficient, decentralized and safe environment his customers can trust and profit from

    将他的律师事务所转变为客户可以信任并从中获利的自治,付款高效,去中心化和安全的环境

His goal is to write a simple program and keep all the balances of his clients in virtual form.

他的目标是编写一个简单的程序,并以虚拟形式保留其客户的所有余额。

Andrej shares his thoughts here:

安德烈(Andrej)在这里分享他的想法:

"Every new customer will give me cash, and I will credit them an equivalent amount of my digital tokens (coins/cryptocurrency). The tokens will represent a monetary unit within and outside the bar.

“每个新客户都会给我现金, 我会把他们等值的我的数字代币(硬币/加密货币)记入贷方。代币将代表条形图内外的货币单位。

The users will use the tokens for all bar functionalities from paying for drinks, borrowing and lending them to their friends, and playing table tennis, poker and kicker.

用户将把令牌用于所有酒吧功能,包括支付酒水,将其借贷给朋友,打乒乓球,玩扑克和踢球。

Having a bar powered by blockchain tokens will generate tons of value for my customers. Contrary to my competition and other bars on this street, where the customers only spend money and get a hangover in exchange, my bar customers holding bar's tokens will have shareholders rights.

拥有由区块链令牌驱动的酒吧将为我的客户带来大量价值。 与我在这条街上的竞争对手和其他酒吧相反,那里的顾客只花钱并得到宿醉作为交换, 我持有酒吧代币的酒吧顾客将拥有股东权利。

Similar to owning a large portion of stocks in a company like Apple or Microsoft, the customers holding these bar tokens will be able to decide how the bar will operate by voting and deciding on:

与在Apple或Microsoft这样的公司中拥有大量股票类似,持有这些条形码令牌的客户将能够通过投票并决定以下内容来决定条形码的运作方式:

  • drinks prices饮料价格
  • opening hours营业时间
  • new features (TV, Jukebox...)新功能(电视,自动点唱机...)
  • interior and exterior design室内和外部设计
  • profits allocation利润分配
  • etc.等等

Oh, this will be a programming dream!

哦,这将是一个编程梦想!

I will call the tokens: The Blockchain Bar tokens, TBB!"

我将这些代币称为:区块链酒吧代币, TBB!

Now that Andrej has shared his dream, we'll get started.

现在,安德烈(Andrej)分享了他的梦想,我们将开始。

目录 (Table of Contents)

  • Requirements

    要求

  • Setup the project

    设置项目

  • 01 | The MVP Database

    01 | MVP数据库

  • 02 | Mutating Global DB State

    02 | 突变全球数据库状态

  • 03 | Monolithic Event vs Transaction

    03 | 整体事件与交易

  • 04 | Humans Are Greedy

    04 | 人类贪婪

  • 05 | Why We Need Blockchain

    05 | 为什么我们需要区块链

  • 06 | L'Hash de Immutable

    06 | 不可改变的哈希

  • Next steps

    下一步

要求 (Requirements)

Let's dive into our tutorial. I recommend 2+ years of programming experience in Java/PHP/Javascript, or another language similar to Go.

让我们深入研究我们的教程。 我推荐2年以上Java / PHP / Javascript或类似于Go的语言的编程经验。

If you want to get a good quick intro to go, here's a free course that'll get you started.

如果您想快速入门, 这里有一个免费课程 ,可以帮助您入门。

You can also complete the official 17 lectures of A Tour Of Go to get familiar with the language syntax and basic concepts (~20 mins).

您也可以完成A Tour Of Go的 17场官方讲座,以熟悉语言语法和基本概念(约20分钟)。

为什么去? (Why Go?)

Because like blockchain, it's a fantastic technology for your overall programming career. Go is a trendy language and Go devs are better paid than the average Java/PHP/Javascript positions.

因为像区块链一样,这对于您的整体编程职业来说是一种了不起的技术。 Go是一种流行的语言,Go开发人员的薪水比平均Java / PHP / Javascript职位高。

Go is optimized for multi-core CPU architecture. You can spawn thousands of light-weight threads (Go-routines) without problems. It's extremely practical for highly parallel and concurrent software such as blockchain networks.

Go针对多核CPU架构进行了优化。 您可以生成数千个轻量级线程(Go例程)而不会出现问题。 对于高度并行和并发的软件(例如区块链网络),这是极其实用的。

By writing your software in Go, you achieve nearly C++ level of performance out of the box without killing yourself for that one time you forgot to free up memory.

通过用Go编写软件,您可以立即获得接近C ++的性能,而不会因为忘记释放内存而丧生。

Go also compiles to binary which makes it very portable.

Go还可以编译为二进制文件,这使其非常易于移植。

设置项目 (Setup the project)

This article has a dedicated open-sourced Github repository with full source code so you can compile the code and run the program on your own local machine.

本文具有专用的开源Github存储库,其中包含完整的源代码,因此您可以编译代码并在自己的本地计算机上运行程序。

If you get stuck at any chapter or a particular line of code, create a Github Issue in this repository describing your problem and I will help you out ASAP!

如果您陷入任何一章或特定的代码行中,请在此存储库中创建一个描述您的问题的Github问题,我会尽快帮助您!

↓ Visit the Github repository and follow the installation instructions ↓

↓访问Github存储库并按照安装说明进行操作↓

01 | MVP数据库 (01 | The MVP Database)

git checkout c1_genesis_json

git checkout c1_genesis_json

Andrej mastered relational SQL databases in the 90s. He knows how to make advanced data models and how to optimize the SQL queries.

Andrej在90年代掌握了关系SQL数据库。 他知道如何制作高级数据模型以及如何优化SQL查询。

It's time for Andrej to catch up with innovation and start building Web 3.0 software.

现在是Andrej赶上创新并开始构建Web 3.0软件的时候了。

Luckily, after reading "The Lean Startup" book last week, Andrej feels like he shouldn't over-engineer the solution just yet. Hence, he chooses a simple but effective JSON file for the bar's MVP database.

幸运的是,安德烈(Andrej)在上周阅读了《精益创业》(The Lean Startup)一书后,觉得他现在还不应该过度设计解决方案。 因此,他为酒吧的MVP数据库选择了一个简单但有效的JSON文件。

In the beginning, there was a primitive centralized database.

最初,有一个原始的集中式数据库。

fcn从头开始_如何使用Go从头开始构建区块链相关推荐

  1. python构建区块链_用python构建区块链(1)---基本结构

    目录 背景 比特币从诞生到现在已经10年了,最近一段时间因为工作原因接触到了区块链相关的技术,为了揭开其背后的神秘面纱,我们就从头开始构建一个简单的区块链.在行动之前我们先看一下比特币的整体结构. 比 ...

  2. solidity 编程练习_学习Solidity编程语言并开始为区块链开发

    solidity 编程练习 Learn to program in Solidity in this full tutorial from Dapp University. Solidity is a ...

  3. 区块链去中心化分布式_为什么渐进式去中心化是区块链的最大希望

    区块链去中心化分布式 by Arthur Camara 通过亚瑟·卡马拉(Arthur Camara) 为什么渐进式去中心化是区块链的最大希望 (Why Progressive Decentraliz ...

  4. 防saq注入_去中心化交易所CYBEX将为区块链ICO注入新的价值观

    距离开启ICO还有不到 30 个小时,中国最主要的ICO平台ICOAGE上的CYBEX.io项目进度条显示已有接近90%份额被锁定.在近期相对波动的大环境下,去中心化交易所CYBEX的ICO开展却异常 ...

  5. 如何从数据库中筛选出达成指定里程碑节点的项目_如何用共识算法构建区块链共识网络?...

    免责声明:本文旨在传递更多市场信息,不构成任何投资建议.文章仅代表作者观点,不代表火星财经官方立场. 小编:记得关注哦

  6. eos区块链 java客户端_分享一个网友第一次开发EOS区块链总结的经验

    在处理项目时,用Java Connector for EOS区块链编写: 创建钱包 创建帐户 创建交易 创建签名交易 在帐户之间转移代币 我遇到了各种和运行本地EOS节点需要遵循的基本步骤.这个小指南 ...

  7. 手机编写python挖矿_用 Python 从零开发一个区块链应用

    本篇教程是面向各能力层级的 Python 开发者介绍区块链(blockchain).你将通过从零实现一个公链(public blockchain)和构建一个简单的应用来确切理解区块链到底是什么. 你将 ...

  8. 区块链生命链_大都会人寿首创“生命链”技术 区块链应用再结硕果

    (2019年6月25日,上海)近日,美国大都会集团(以下简称"大都会人寿")的亚洲创新中心--流明实验室(LumenLab)携手新加坡报业控股(以下简称"SPH" ...

  9. ChianStore区块链应用商店_让小白也能轻松下载区块链应用

    对于大多数小伙伴来说,在手机上下载应用一般都是在自带应用商店或者应用宝.豌豆荚等市场,但如果需要下载区块链应用的话,则需要花费心思去找了,当你百度一个软件后,你永远不知道你下载的到底是个什么鬼东西! ...

最新文章

  1. 未来的信息安全管理人员应当具备哪些技能
  2. 测试Linux网卡是否正常工作
  3. python3 str is not callable 问题解决
  4. mac11.14 mysql_mysql 5.7 11 章 数据类型(1)
  5. 14. GD32F103C8T6入门教程-Systick定时器
  6. 安卓中圆角背景图被拉伸的解决方案——.9.png
  7. 面具更新自定义_面具Magisk如何从稳定版切换到测试版,面具版本切换教程
  8. MSDTC不能启动的几个解决方法
  9. 2020年中国轴承套圈行业市场现状分析,国内市场格局十分分散「图」
  10. Android: 页面元素抓取工具Weditor
  11. VS2017离线安装
  12. error C2143: 语法错误 : 缺少“;”(在“template”的前面)
  13. 设置来电铃声android,设置默认来电铃声 android
  14. 灰色预测 Matlab
  15. 一对同居男女同一天的日记对比
  16. 文笔很差系列1 - 也谈谈AlphaGo
  17. 一道经典SQL笔试题(求各部门最高薪水的部门名称、员工姓名以及薪水)
  18. 游戏开发(九) 之 纯 lua 版 热更新 方案
  19. UltraEdit小众用法
  20. 开源案例:Spring Boot + Vue 的音乐网站

热门文章

  1. Java面试题,java培训北京哪家好
  2. 看完99%的人都学会了!9次Android面试经验总结,我先收藏为敬
  3. C++ 网络开发工具
  4. Jquery常用正则验证
  5. 感想篇:4)越来越精简的机械设计
  6. cs106a编程方法学作业解答(3)
  7. vscode编写插件详细过程
  8. Linux查看系统各类信息
  9. RUNOOB python练习题 35 python print各色字体及背景
  10. JAVA单向链表实现