Hyperledger的区块结构
来源:互联网 发布:淘宝卖家那里改包邮 编辑:程序博客网 时间:2024/06/08 17:39
> 之前学习比特币和以太坊,必先学习其区块结构,当时在银行做Hyperledger相关项目时,我却对结构很忽略,只关心智能合约,居然也能初步掌握并开始项目相关的开发。这说明超级账本的区块属性其实比较弱,重要的是智能合约的属性。性能也不错。从这个意义上讲Hyperledger用来做存证是大材小用的。
问题1:交易是怎么存入区块的?
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 header = 1;BlockData data = 2;BlockMetadata metadata = 3;
}
// 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 {
**uint64 number = 1;** // The position in the blockchain**bytes previous_hash = 2;** // The hash of the previous block header**bytes data_hash = 3;** // The hash of the BlockData, by MerkleTree
}
message BlockData {
repeated bytes data = 1;
}
message BlockMetadata {
repeated bytes metadata = 1;
}
问题2:怎么存入LevelDB
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
// Append a new block to the ledgerfunc (fl *fileLedger) Append(block *cb.Block) error { err := fl.blockStore.AddBlock(block) if err == nil { close(fl.signal) fl.signal = make(chan struct{}) } return err}
- Hyperledger的区块结构
- 区块链 Hyperledger
- 区块链的区块结构
- Hyperledger -- Linux 基金会下的开源区块链
- 区块链组织-超级账本(Hyperledger)的简介
- centos 7下 区块链 Hyperledger 的安装和部署
- Hyperledger Fabric 区块链多机部署
- 区块链 HyperLedger Fabric安装
- 从零开始配置Hyperledger Fabric区块链网络所需组件及Hyperledger Composer开发工具的安装
- Hyperledger fabric 工程结构
- 区块链 Hyperledger - 超级账本项目在centos7环境下的安装与部署
- Hyperledger Fabric 1.0发布:基于区块链的开源分布式账本
- 区块链开发教程搭建Hyperledger的虚拟币开发环境
- Hyperledger Fabric SDK 示例fabric-samples-《balance-transfer》之八《查询指定的区块信息》
- Blockchian区块链:IBM HyperLedger fabric 简述
- 自己动手部署区块链-hyperledger/fabric-01
- 自己动手部署区块链-hyperledger/fabric-02
- 区块链(一)--Bitcoin、Ethereum、Hyperledger
- js获取html文本框值,判断,跳转
- 【云星数据---mesos实战系列003】:marathon实战006--用marathon部署一个ubuntu应用
- 在我开始自由职业生涯前应该明白的4件事
- mui.fire()触发自定义事件
- Spark SQL运行原理和架构
- Hyperledger的区块结构
- 网站怎么整个用windows扒下来,网站模仿精灵免费下载
- devexpress 16 17打包发布后,程序无法启动
- 技术积累 — IIC之深入理解
- JavaScript typeof运算符
- Tensorflow深度学习笔记(二)-图、会话和变量
- nRF52832 — 有关Drive configuration的相关配置
- js获取,url后面附带的参数的方法
- SQL性能优化梳理