官术网_书友最值得收藏!

  • Hyperledger Cookbook
  • Xun (Brian) Wu Chuanfeng Zhang Andrew Zhang
  • 198字
  • 2021-06-24 14:59:39

Getting ready

Let's first get the fabric library in our environment. Navigate to the assetmgr directory, run the get chaincode library command, and then start build:

cd $GOPATH/src/assetmgr
go get -u github.com/hyperledger/fabric/core/chaincode/shim
go build

This will load the chaincode library and compile the Go code. Next, we will deploy the chaincode using the dev mode. Normally, we need to define our own channel, peer, and configuration Docker container to run our chaincode. Hyperledger, however, provides a sample dev network with a pre-generated orderer and channel artifact. This allows the user to start using chaincode for quick development and testing. You should have already set up the Fabric runtime environment with the fabric-samples project. If you haven't already done so, check out the previous chapter, or refer to fabric-samples in the GitHub link and follow the instructions: https://github.com/hyperledger/fabric-samples.

At the time of writing this book, 1.4 is the latest version of fabric-samples.

In our example project, we use the build in the fabric-samples project and set this same project as the default user home directory, as follows:

Let's now open three Terminals and navigate to the chaincode-docker-devmode directory of fabric-samples:

$ cd chaincode-docker-devmode
主站蜘蛛池模板: 临西县| 江达县| 衡东县| 上林县| 津市市| 五常市| 苏尼特左旗| 浠水县| 庆元县| 左权县| 布拖县| 漳浦县| 台湾省| 廉江市| 凭祥市| 外汇| 辽源市| 贵德县| 兴安县| 凉城县| 茶陵县| 城步| 神池县| 永福县| 罗定市| 两当县| 轮台县| 阿合奇县| 且末县| 阿尔山市| 乌海市| 中西区| 南郑县| 西乡县| 蓬安县| 莱州市| 池州市| 休宁县| 金塔县| 班戈县| 剑阁县|