Hyperledger的區塊結構:交易是怎么存入區塊的 如何存入LevelDB
2018-7-5 14:27
來源:
Uni-times
之前學習比特幣和以太坊,必先學習其區塊結構,當時在銀行做Hyperledger相關項目時,我卻對結構很忽略,只關心智能合約,居然也能初步掌握并開始項目相關的開發。這說明超級賬本的區塊屬性其實比較弱,重要的是智能合約的屬性。性能也不錯。從這個意義上講Hyperledger用來做存證是大材小用的。
Transactions are collected into blocks/batches on the ordering service first. Blocks are cut either when the BatchSize is met, or when BatchTimeout elapses (provided a non-empty block).
也就是說,滿足這2個條件,區塊生成了:
交易數量夠了
超時時間到了
所以Hyperledger的區塊生成不是定時的,高峰時間,區塊生成速度明顯加快
configtx.yaml in the common/configtx/tool/ directory for more info on the block-cutting criteria.
The Block type definition in protos/common/common.proto
和以太坊一樣,hyperledger的區別,也有區塊號、指向前一個區塊的指針、指向數據的指針,因為沒有挖礦,頭部簡潔了很多。
// This is finalized block structure to be shared among the orderer and peer
// Note that the BlockHeader chains to the previous BlockHeader, and the
BlockData hash is embedded
// in the BlockHeader. This makes it natural and obvious that the Data is included in the hash, but
// the Metadata is not.
message Block {
}
// BlockHeader is the element of the block which forms the block chain
// The block header is hashed using the configured chain hashing algorithm
// over the ASN.1 encoding of the BlockHeader
message BlockHeader {
These blocks are stored locally to disk on every ordering service node along with a LevelDB to index these blocks by number – see orderer/ledger/file
作者:鄭澤洲
原文鏈接:
http://www.blockchainbrother.com/article/893

版權申明:本內容來自于互聯網,屬第三方匯集推薦平臺。本文的版權歸原作者所有,文章言論不代表鏈門戶的觀點,鏈門戶不承擔任何法律責任。如有侵權請聯系QQ:3341927519進行反饋。