(Win 10 可直接安装 Docker 请参考附录2 )
Docker version 1.12.0, build 8eab29e
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default virtualbox Running tcp://192.168.99.101:2376 v1.10.3
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS default * virtualbox Running tcp://192.168.99.100:2376 v1.10.3
#/Users/user
hyperledger/fabric-peer latest af109e2bfebc 7 days a go 1.422 GB hyperledger/fabric-membersrvc latest 16d2098ab252 7 days a go 1.415 GB
#curl GET https://raw.githubusercontent.com/hyperledger/fabric/master/examples/chaincode/go/chaincode_example02/chaincode_example02.go > chaincode_example02.go
chaincode_example02.go
chaincode_example02 chaincode_example02.go
https://www.getpostman.com/apps Postman 具有好用的人机接口,藉REST API 与 Blockchain Netwok 沟通
REST API字段输入:http://192.168.99.100:7050/network/peers 192.168.99.100 (来自虚拟机器default之IP), 7050定义于docker-compose.yml
REST API字段输入: http://192.168.99.100:7050/registrar { “enrollId”: “jim”, “enrollSecret”: “6avZQLwcUe9b”
REST API字段输入: http://192.168.99.100:7050/chcincode 执行init function args:[“a”, “100”, “b”, “200”] { “jsonrpc”: “2.0”, “method”: “deploy”, “params”: { “type”: 1, “chaincodeID”:{ “name”: “mycc” }, “ctorMsg”: { “function”:”init”, “args”:[“a”, “100”, “b”, “200”] }, “secureContext”: “jim” }, “id”: 1 }
REST API字段输入: http://192.168.99.100:7050/chcincode 执行 invoke function args:[“a”, “b”, “10”] { “jsonrpc”: “2.0”, “method”: “invoke”, “params”: { “type”: 1, “chaincodeID”:{ “name”:”mycc” }, “ctorMsg”: { “function”:”invoke”, “args”:[“a”, “b”, “10”] }, “secureContext”: “jim” }, “id”: 3 }
REST API字段输入: http://192.168.99.100:7050/chcincode 执行 function:query, args:[“a”] { “jsonrpc”: “2.0”, “method”: “query”, “params”: { “type”: 1, “chaincodeID”:{ “name”:”mycc” }, “ctorMsg”: { “function”:”query”, “args”:[“a”] }, “secureContext”: “jim” }, “id”: 5 }
当执行至步骤6 import json档后,依序点选项目(peers,login,init,invoke,read)即可执行相对 REST API。
http://www.remkohde.com/2016/07/04/running-your-own-blockchain/ 转换至 local blockchain network 环境执行。
1.Win7 安装Docker Toolbox: https://www.docker.com/products/docker-toolbox http://knight-.iteye.com/blog/2254627 http://rominirani.com/2015/08/15/docker-toolbox-setup-windows/ https://getcarina.com/docs/troubleshooting/troubleshooting-windows-docker-vm-startup/ http://dockone.io/article/594 2.Win 10 安装Docker http://blog.miniasp.com/post/2016/08/01/Docker-for-Windows-1-12-Released.aspx 3.putty安装及使用: http://www.ascc.sinica.edu.tw/putty 4.docker-compose.yml (文字要对齐) https://1drv.ms/u/s!AkBmzWP0h-Vxgg74u_PQ9l9cRyta 5.Postman使用手册 http://www.jianshu.com/p/13c8017bb5c8 6.chaincode_example02.postman_collection.json网址 https://1drv.ms/u/s!AkBmzWP0h-VxggtvAjN_PPAYw6DZ 7.陈兆麟 facebook https://zh-cn.facebook.com/chaolin.chen.18
1.https://github.com/hyperledger/fabric/blob/master/docs/Setup/Chaincode-setup.md 2.https://github.com/ibm-watson-iot/blockchain-samples 3.https://github.com/igorbarinov/awesome-blockchain 4.https://www.linkedin.com/pulse/blockchain-smart-contracts-health-booz-allen-hamilton-tori-adams 5.https://bitsonblocks.net/2015/09/09/a-gentle-introduction-to-blockchain-technology/ 6.https://www.ibm.com/internet-of-things/iot-news/announcements/private-blockchain/ 7.http://blockcan.com/news/topic/21040 8.https://www.ibm.com/internet-of-things/iot-news/announcements/private-blockchain/ 9.https://1drv.ms/f/s!AkBmzWP0h-Vxbr7h1uTNsTMcPWI 10.https://1drv.ms/b/s!AkBmzWP0h-VxazOBOsVz8nGMLpM 11.https://1drv.ms/b/s!AkBmzWP0h-VxbLK7FOjH9IL5HHc 12.https://www.youtube.com/watch?v=24JAF9Eu1mk&list=UUOTZe-b_jE_Ovy9K9UhZ4BA&index=74 13.https://www.youtube.com/watch?v=wSmJ-rwUo8I&list=UUOTZe-b_jE_Ovy9K9UhZ4BA&index=73 14.https://www.youtube.com/watch?v=SOsn6MvGH60&list=UUOTZe-b_jE_Ovy9K9UhZ4BA&index=72