Reputation: 605
In Hyperledger Fabric you can use peer channel update
to submit updates to your nextwork. For instance, once you have your block in protobuf format ready, you can submit it like so:
peer channel update -f .someupdate.pb -c somechannel
However, you can also use it to submit a channel transaction, for instance:
peer channel update -f someTransaction.tx -c somechannel
I'm really confused about this. Does peer update channel
create a transaction when is submitting the update block? What are the scenarios when you would use a block instead of a transaction?
Same happens with the cyptotxgen
tool. You can use it to create a genesis block:
configtxgen -outputBlock ./genesis.block \ -profile SomeProfile \ -channelID somechannel
or you can use to create a transaction:
configtxgen -outputCreateChannelTx ./sometransaction.tx \ -profile SomeProfile \ -channelID somechannel
The official docs about peer channel update
says about the -f param:
-f, --file string Configuration transaction file generated by a tool such as configtxgen for submitting to orderer
So it's referring to transactions, not blocks. But apparently you can indeed use to submit a block. Is the command creating a transaction on background?
Upvotes: 0
Views: 120
Reputation: 5868
As far as I can see, peer channel update
only accepts a config update transaction. It doesn't care what the file is called (and could end in .pb or .tx for example). The file will be a serialised collection of protobufs and definitely won't be a block, The format of this is described here https://hyperledger-fabric.readthedocs.io/en/latest/configtx.html#configuration-updates but suffice to say that a config update transaction is a set of diffs which the orderer will use to generate a complete channel config from putting that as the only transaction into a block. Peers will receive this block, validate it and make it the new channel configuration block
cryptogen in fabric prior to 2.3 had 2 purposes.
The first purpose is to generate a genesis block which will contain the system channel configuration. When an orderer first starts and the system channel hasn't been created it will read this file and the system channel created, subsequent restart of the orderer will ignore this file as that block is now stored in the appropriate place in the orderer.
The second purpose of configtxgen prior to 2.3 is to generate an application channel creation transaction file which can be used by peer channel create
. This is submitted to the orderer which will generate a genesis block for the application channel containing the channel configuration.
In fabric 2.3 the need for the system channel was removed, now cryptogen has a 3rd purpose (as it still needs to support the system channel mechanism for now), to generate an application channel genesis block. This is then given as input to the osnadmin command to send to the first orderer who basically bootstraps the application channel with that genesis block. Then more orderers (via osnadmin) and peers can join that channel (via peer channel join) using the same genesis block.
Upvotes: 1