Lab03 Exploring Test-Network With Hyperledger Fabric
Lab03 Exploring Test-Network With Hyperledger Fabric
Lab03 Exploring Test-Network With Hyperledger Fabric
2. Prepare
Cách 1: Sử dụng công cụ MobaXterm để truy cập từ xa đến máy ảo theo địa chỉ IP:
wandertour.ddns.net, port 25, username: hyperledger, pass: 123456
Cách 2: Sử dụng lệnh trong cửa sổ lệnh Windows:
C:\Users\ABC>ssh -p 15 ubuntu@wandertour.ddns.net
ubuntu@vmhyper~ $ cd $HOME/fabric-samples/test-network
After you bring up the test network, you can use the peer CLI to interact with your
network. The peer CLI allows you to invoke deployed smart contracts, update channels,
or install and deploy new smart contracts from the CLI.
Make sure that you are operating from the test-network directory.
KhoaCNTT-Trường ĐHBK, ĐHĐN
The CORE_PEER_TLS_ROOTCERT_FILE and CORE_PEER_MSPCONFIGPATH environment variables
point to the Org1 crypto material in the organizations folder.
ubuntu@vmhyper:~/fabric-samples/test-network$ peer channel list
2023-09-03 14:23:28.240 UTC 0001 INFO [channelCmd] InitCmdFactory ->
Endorser and orderer connections initialized
Channels peers has joined:
Mychannel
You can now query the ledger from your CLI. Run the following command to get the
list of assets that were added to your channel ledger:
ubuntu@vmhyper:~/fabric-samples/test-network$ peer chaincode query -C mychannel -n
basic -c '{"Args":["GetAllAssets"]}'
Chaincodes are invoked when a network member wants to transfer or change an asset
on the ledger. Use the following command to change the owner of an asset on the ledger
by invoking the asset-transfer (basic) chaincode:
Because the endorsement policy for the asset-transfer (basic) chaincode requires the
transaction to be signed by Org1 and Org2, the chaincode invoke command needs to
reference the TLS certificate for each peer using the --tlsRootCertFiles flag.
After we invoke the chaincode, we can use another query to see how the invoke
changed the assets on the blockchain ledger. Since we already queried the Org1 peer, we
can take this opportunity to query the chaincode running on the Org2 peer.
Set the following environment variables to operate as Org2:
{"ID":"asset6","color":"white","size":15,"owner":"Christopher","appraisedValue":80
0}
The command will reveal the MSP folder structure and configuration file:
organizations/peerOrganizations/org1.example.com/users/Admin@org1.example.com/
└── msp
├── IssuerPublicKey
├── IssuerRevocationPublicKey
├── cacerts
│ └── localhost-7054-ca-org1.pem
├── config.yaml
├── keystore
│ └── 58e81e6f1ee8930df46841bf88c22a08ae53c1332319854608539ee78ed2fd65_sk
├── signcerts
│ └── cert.pem
└── user
6. REFERENCE
[1]. https://hyperledger-fabric.readthedocs.io/en/latest/test_network.html
-----------------------------------------------