我正在尝试更改FishNet示例中的共识算法。
在/sawtooth-supply-chain-master/fish_client/public/dist/bundle.js
文件中,我找到了这个:
consensus":{"type":"bytes","id":5}
有人知道锯齿中的共识ID的映射是什么吗?
默认情况下,它是Devmode。但是我想更改共识类型。这可能吗?
并且在/sawtooth-supply-chain-master/docker/compose/supply-chain-default.yaml
入口:|bash -c“如果[! -f /etc/sawtooth/keys/validator.priv];然后sawadm keygen &&锯齿锁匙my_key &&锯齿生成-k /root/.sawtooth/keys/my_key.priv &&sawadm成因配置-成批fi;锯齿验证器-v \--endpoint tcp:// validator:8800 \--bind组件:tcp:// eth0:4004 \--bind network:tcp:// eth0:8800 \--bind共识:tcp:// eth0:5050“
devmode-engine:图片:hyperledger / sawtooth-devmode-engine-rust:1.1container_name:锯齿-devmode-engine-rust-default依赖于取决于:- 验证器入口点:devmode-engine-rust -C tcp:// validator:5050
超级账本锯齿支持dynamic consensus model。如您所述,默认共识引擎为Devmode
。
其他受支持的共识引擎包括:
共识类型是链上设置。从文档中:
Each consensus type has a consensus engine that communicates
with the validator through the consensus API. Each node in
the network must run the same consensus engine.
要使用默认Devmode
以外的共识类型,您将需要更新两个链上设置:
sawtooth.consensus.algorithm.name
sawtooth.consensus.algorithm.version
这必须通过sawset proposal create命令完成,该命令可以在网络运行时完成,也可以作为创世纪模块的一部分包含在批处理中,例如:
sawadm keygen && \
sawtooth keygen my_key && \
sawset genesis -k /root/.sawtooth/keys/my_key.priv && \
sawset proposal create \
-k /root/.sawtooth/keys/my_key.priv \
sawtooth.consensus.algorithm.name= pbft \
sawtooth.consensus.algorithm.version=1.0 \
sawtooth.consensus.pbft.members=["VAL1KEY","VAL2KEY",...,"VALnKEY"] \
-o config.batch \
&& sawadm genesis config-genesis.batch config.batch
请注意,config.batch
(包含我们更新共识模式的建议)必须包含在sawadm genesis
中。
我建议查看Setting Up a Sawtooth Network上的文档以获取更多信息-特别是Creating the Genesis Block的第4步。