Interpretation of BYTOM design structure

Source: Internet
Author: User

First, quotations

Design Bytom data structure, combine a lot of technical points, such as Patricia Tree,utxo, BVM, account Model,protobuf,sql,memcache and so on. This article will do the following two point analysis of some technical points.

    1. Bytom Why should I use this technology point?
    2. Bytom How to apply this technology point?

Finally, it introduces how to realize Bytom of these technical points.

[Patricial Tree] (http://www.allisons.org/ll/AlgDS/Tree/PATRICIA/)

Second, why should Pat tree be adopted?

Pat tree with [radix tree] (Https://en.wikipedia.org/wiki ... Features, content can be quickly traced.

Pat Tree has [Merkle tree] (Https://en.wikipedia.org/wiki ... characteristics, the data can be quickly proved.


In distributed systems, consistency and effectiveness are key points. The Bytom uses Pat trees, where the data can quickly prove that each state machine is consistent. The content can be quickly traced, allowing Bytom to quickly find its data and verify the validity of the data in each snapshot state.

Bytom How to use Pat tree?

Ethereum Pat Tree is a 16-fork base tree, divided into two tiers, the first layer of management is all accounts, the second layer of management is the contents of each account.

Bytom's Pat tree is different from ethereum?

    1. The Pat Tree of Bytom is a two-fork base tree.
    2. Bytom's Pat Tree is used to manage outputs that are not spent.

Third, UTXO

Why use Utxo?

Utxo was born in Bitcoin, and the real world of RMB, from the moment of the birth of the central bank, he transferred countless accounts, but his value denomination is always the same as the original, so that the currency as the center, rather than people-centric, assets to facilitate supervision and statistics. Bytom is used for the release and management of assets, so Utxo's asset-centric design model is well suited to Bytom asset management.

How to use Utxo?

Compared to Bitcoin's Utxo, Bytom's Utxo has three more fields

    1. Assertid, because Bytom is a multi-asset publishing and management platform, use this field to uniquely identify a variety of assets.
    2. AccountId, which is convenient for each account to utxo the index and management, Bytom compared to bitcoin, introduced the account model, will be introduced later.
    3. program, the account that owns the Utxo can use the Ivy language to write the programs you want to put in this field so that when trading, Turing's complete BVM will execute the program.

Iv. BVM


BVM is a step that is initiated during the conversion process of the state machine, i.e. Excute (transaction).

Why do I need to use BVM?

Bitcoin in the non-Turing complete stack scripting language, the expression of very few functions, it is difficult to implement some of the slightly complex functions, such as VERIFY_SPV (cross-chain anchoring verification functions, such as Btc_relay), such as simple to implement Multi_lock (M-person encryption, Just collect N-person private keys to decrypt, 0 < N < M) functions.
The EVM in Ethereum can easily be programmed to implement these functions in the solidity language, but the EVM is too complex, it claims to be a super world computer, and it is not necessary for Bytom to be a blockchain that is only interested in assets. Therefore Bytom is inferior to [Chain] (https://chain.com/) Company's energy use [Ivy] (Https://chain.com/docs/1.2/ivy-playground/docs) High-level language programming CVM to do their own expansion, flexible and easy to use.

How do I use BVM?


When sending each transaction, the user can write his/her own program, wait until the transaction is packaged into the block, BVM will execute the code, because BVM is a Turing complete virtual machine, so need to add the feed pricing mechanism (feed equivalent to Ethereum gas * Gasprice) To solve the downtime problem.

V. Account model

Why use an account model?

The account model is easy to manage related data, it is human-centric, very intuitive. For BVM, it is also very convenient to execute based on the account code. Furthermore, we introduced asset models, similar to account models, to facilitate asset monitoring and querying.

Bytom How to implement the account model?

The account model in Bytom is also divided into two categories, but differs from individual accounts and contract accounts in Ethereum, which refer to asset accounts and individual accounts.
Asset Account:

    1. AssetID is the globally unique asset identification ID.
    2. Alias is an asset's nickname that can be easily memorized, such as gold, silver.
    3. Vmversion is for soft fork, do dynamic over.
    4. Program is the procedure that needs to be executed when the asset is published.
    5. Initialblockhash refers to the block height at which the asset is registered.
    6. Signer manages the public private key pair so that it is signed with the private key of the asset and only the person who owns the asset's private key can publish the asset.
    7. Definition of an explanation of the asset.

Personal account:

    1. AccountId globally uniquely identifies an account ID.
    2. Alais the account name.
    3. Signer, a private key pair, used to send transactions.
    4. *utxos the index of all unused transactions in the account to facilitate quick management of assets under the account.
    5. program, which can be inserted when the account is sent to a transaction.

Review

The physical structure of Utxo is stored with memcache. The logical structure of UTXO is managed by a binary pat tree.

Individual accounts are able to quickly index their associated utxo based on AccountId. Asset accounts are able to quickly manage relevant utxo based on AssetID.

is a UML diagram that describes the main data structures of Bytom.

Bytom uses pat trees to organize utxo as a world state tree.

The account model is divided into two types, asset accounts and individual accounts, and accounts can be indexed to manage their associated utxo.

UTXO Pool will adopt the memory database such as Memcache, the database will select the relational database, the data will choose Protobuf to serialize.

When trading accounts, each account can find its own utxo from the World state tree and write its own required asset program as a txinput.

When a transaction is packaged into a block, the validation node instantiates the BVM and executes the program in all Txinput in the transaction.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.