Byom can be diversed to three layers:
1.Wallet layer——the module of deposit and withdraw.People use it mostly and will get familiar with it.
2.Kernel layer—— It can be interpreted that every node follow a rule in distributed system.Only there are same rules that can two nodes reach an agreement.If the rules are different,it’s similiar to fork.
3.Communication layer——communication layer is the way of exchanging informations between nodes,including sync of block and transaction
Kernel layer1.Orphan block management:Orphan blocks are blocks excavated by miners but not formed into the main chain block (two or more legal blocks are generated at the same height, one block becomes the main chain, and the rest are called orphan blocks). Orphan block management is to store the orphan blocks that are not formed into the main chain block.
2.Consensus layer:to confirm whether a block is legal.It can be diversed to block header verification and transaction verification.Bloch header verification needs to verify its parent blocks and timestamp,both need computing power to ensure accounting.Bytom particularly a BC layer for transaction verification,this layer will get better performance during transaction verification,transaction is related with smart contract and parameters will be verified whether it’s legal by virtual machine when the transaction being verified.
3.Blocktree management:Block Index,it can record blocks of all network and store a mirrorable image of all network’s blocks.Because of the existence of Orphan blocks,it’s not chain structure .
4.Data storage:Persistent storage of block data. There are two kinds of data. The first is the block data, which will be broadcast on the network. The second is UTXO data, which is stored for faster verification of whether a UTXO can be spent without having to verify all of the block information
5.Transaction pool:maintain all the transactions that have been sent but not confirmed yet.When mining module is going to create a new block,it will package some transactions from transaction pool and POW by Tensority consensus algorithm.
Wallet layer:Private key module:manage private key(generate。storage and backup of private key)and signature
Account module:Bytom adopted account-address-key three layers system.Everyone can have more than one key and form account by different combination of private keys,every account can generate endless addresses and addresses are formed by a secondary private key derived from the account’s private key.
Asset module:manage the asset creation module of account,all issued assets are communicating in this module.
Transaction module:related transaction data:
1)Pick related transactions from all exchanges
2)Maintain database of UTXO in wallet layer and record all UTXO you have
Communication layerNode discovery:P2P related,a dependent and mature piece,get seed nodes by node discovery module
Transaction sync:sync transaction between those nodes
Block sync:Passive block sync.It will request block sync when it finds there are block height than its other nodes.
New block fast broadcast module:New block sync automatically,it will be forced to broadcast when hit a new block to spread faster in the whole network.