本文介绍了如何使用python构建一个小型的区块链技术,使用Python2实现,代码不到50行。
Although some think blockchain is a solution waiting for problems, there’s no doubt that this novel technology is a marvel of computing. But, what exactly is a blockchain?
虽然有人认为区块链本身仍有很多问题需要解决,但毫无疑问,这种新颖的技术是计算机界的奇迹。 但是,究竟什么是一个区块链?
Blockchain
a digital ledger in which transactions made in bitcoin or another cryptocurrency are recorded chronologically and publicly. >
区块链一种数字记账本,其中以比特币或其他加密方式按时间顺序并公开记录地进行交易。
In more general terms, it’s a public database where new data are stored in a container called a block and are added to an immutable chain (hence blockchain) with data added in the past. In the case of Bitcoin and other cryptocurrencies, these data are groups of transactions. But, the data can be of any type, of course.
通俗的讲,区块链是一个公共数据库,其中新产生的数据存储在称为块的容器中,并被添加到具有已经存在数据的区块构成的链中。在比特币和其他加密货币的情况下,这些数据是一组交易。数据也可以是任何类型的。
Blockchain technology has given rise to new, fully digital currencies like Bitcoin and Litecoin that aren’t issued or managed by a central authority. This brings new freedom to individuals who believe that today’s banking systems are a scam or subject to failure. Blockchain has also revolutionized distributed computing in the form of technologies like Ethereum, which has introduced interesting concepts like smart contracts.
区块链技术已经带来了全新的,完全数字化的货币,如比特币和莱特币,它们不由中央机构发行或管理的,这给相信今天的银行体系是骗局或失败的个人带来了新的自由。区块链也以像以太坊这样的技术形式革新了分布式计算,它引入了有趣的概念,如智能合约。
In this article, I’ll make a simple blockchain in less than 50 lines of Python 2 code. It’ll be called SnakeCoin.
在本文中,我将在不到50行的Python 2代码中制作一个简单的区块链。这将被称为SnakeCoin。
We’ll start by first defining what our blocks will look like. In blockchain, each block is stored with a