官术网_书友最值得收藏!

Understanding the data structure

A blockchain can also be defined as a sequence of blocks containing data that are chained together. There are two types of data:

  • Transactions
  • Block information (also called metadata)

The transaction section is built by gathering all of the transactions that happened in a certain period of time and gathered in the block. If I send you one Bitcoin, this transaction will be part of the transaction section. Three fields are consistently active:

  • The recipient
  • The sender
  • The amount

When I send you one Bitcoin using the Bitcoin blockchain, the transaction is composed as follows:

  • The recipient is your account (your Bitcoin address).
  • The sender is my account (my Bitcoin address).
  • The amount is 1 Bitcoin.

An example of a Bitcoin address is 3QSuhbsJUZJRgYX965CwMHgsdaU8KuTg4H.

Once all of the transactions are filled in the block, the block is hashed with the appropriate function (that is, the mining process occurs), which will return the hash value of this block, hence, of all transactions contained in the block. If one transaction of this block is modified afterward, the hash will change dramatically (the change-sensitive property) and the block would not be secured anymore.

Note that, depending on the blockchain, the validation span and the number of transactions of the block vary. For Bitcoin, one block is validated approximately every 10 minutes and contains several transactions fluctuating around 1,500 as of June 2019. This period is defined regarding the size limit of a block, that is, the number of transactions it can handle in one block. It is rather the size of the transactions that matter than the volume. That is why Bitcoin has an average block limit of 1,500 transactions—because it can sometimes handle more transactions and sometimes fewer. Transactions can become more complex if there are several senders or several recipients in one transaction. To put it in perspective, the Bitcoin blockchain handles 1 MB blocks, whereas the Bitcoin Cash blockchain handles 8 MB blocks.

Bitcoin Cash was created in August 2017 by a section of the Bitcoin community to overcome Bitcoin's scalability issues through the extension of block size. Just like Bitcoin, it is a cryptocurrency and a blockchain.

Let's now have a look at the block information part, also called metadata. These pieces of information refer to the block itself and not to the transactions. If we think back to the example of Chapter 1Basics of Blockchains and the Illustration of Village Beta, they refer to the following:

  • The previous hash
  • The timestamp
  • The nonce
  • The hash

The previous hash is the reference number found when validating the previous block. For the first block of a blockchain, it is 0 or any value that the network agrees on. Remember that hashes are what allow blocks to be chained together, hence making the whole chain tamper-proof. To do so, every block contains the hash of the previous block. 

The timestamp is the time and date when the block is validated by the network.

The nonce is the variable to find when solving the mathematical problem to validate a block. When the miners are receiving new transactions, they run a complex mathematical problem to find the appropriate nonce that returns a correct hash.

Once the hash is found, the transactions are validated and the block is stored in the database.

In conclusion, a block is a container of all of the transactions that happened over a defined timespan that are hashed to return a digital fingerprint of all of these transactions. The following diagram is the mining process followed by the miners of the network:

When building a block, the miners trigger a mining process using the hash of the previous block, the hash of all of the transactions, and the timestamp. The mining process ends when one of the miners finds the correct nonce that returns a valid hash (usually a number starting with a predefined number of zeros), which is tied to the block and will serve as the previous hash for the next block.

主站蜘蛛池模板: 徐闻县| 兴安县| 武功县| 伊宁县| 英德市| 二手房| 通海县| 临邑县| 卢龙县| 辰溪县| 黑山县| 汝州市| 栾川县| 武强县| 施甸县| 双峰县| 五台县| 长葛市| 邛崃市| 上高县| 资源县| 弥勒县| 象州县| 揭东县| 大余县| 游戏| 莫力| 长治市| 延川县| 赣榆县| 利辛县| 宝兴县| 武山县| 常宁市| 嘉祥县| 思南县| 寿宁县| 永胜县| 乌兰浩特市| 北碚区| 秭归县|