Tools, FAQ, Tutorials:
View Channel Blockchain and Download Blocks
How to View Blockchain and Download Blocks of a Hyperledger Fabric Channel?
✍: FYIcenter.com
You can follow this tutorial to
View Blockchain and Download Blocks of a Hyperledger Fabric Channel.
1. Connect to the CLI container of the Hyperledger Fabric network:
$ docker exec -it cli bash bash-4.4#
2. List channels joined by the default peer:
bash-4.4# echo $CORE_PEER_ADDRESS peer0.org1.example.com:7051 bash-4.4# peer channel list Channels peers has joined: mychannel
3. Get the blockchain info of a given channel:
bash-4.4# peer channel getinfo -c mychannel
Blockchain info:
{"height":6,
"currentBlockHash":"rriN9xJHYX+c2xo7qIqNvxNlcGFRAADgA4hIg7byvwE=",
"previousBlockHash":"KDjkXFvRJAcYTp2ralLNhMAD3eZc0LxfQyHr9DZgl0M="
}
4. Download (fetch) the newest block:
bash-4.4# peer channel fetch newest newest.block -c mychannel [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized [cli.common] readBlock -> INFO 002 Received block: 5 bash-4.4# ls -l -rw-r--r-- 1 root root 4921 Apr 1 18:00 newest.block
5. Download (fetch) the first block:
bash-4.4# peer channel fetch 0 newest.block -c mychannel [channelCmd] InitCmdFactory -> INFO 001 Endorser and orderer connections initialized [cli.common] readBlock -> INFO 002 Received block: 0 bash-4.4# ls -l -rw-r--r-- 1 root root 15995 Apr 13 18:07 first.block -rw-r--r-- 1 root root 4921 Apr 1 18:00 newest.block
Note that block 5 is the 6th block of the blockchain, because the first block is labeled as block 0.
⇒ Inspect Transaction Blocks of Channel Blockchain
⇐ "peer chaincode invoke" on BYFN
2020-08-13, ∼1222🔥, 0💬
Popular Posts:
How To Read a File in Binary Mode in PHP? If you have a file that stores binary data, like an execut...
How To Avoid the Undefined Index Error in PHP? If you don't want your PHP page to give out errors as...
How to use the "set-variable" Policy Statement to create custom variables for an Azure API service o...
How to use the RSS Online Validator at w3.org? You can follow this tutorial to learn how to use the ...
How to create Hello-3.1.epub with WinRAR? I have all required files to create Hello-3.1.epub. To cre...