어쩌다 ;p 블록체인 두번째 예제

<aside> 💡 실습 - 하이퍼레저 페브릭( github) , 최광훈 박사님 github 응용 - 튜토리얼을 활용한 실전 시나리오 및 APIs

</aside>

  1. (go 설치)

    $sudo apt-get install golang

  2. 체인코드 작성

  1. 체인코드 빌드

~/dev/simpleasset/contract$go build

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/a73dabf3-0250-4c3b-aa90-51c63e7245ba/Untitled.png

  1. cliSA 컨테이너 수행

docker-compose -f docker-compose.yml up -d cliSA

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/ef3b8c1b-6976-4ce9-a187-65ba7c71cb9b/Untitled.png


[ 에러 로그 : 💩 → 💎 : 해결 ]


  1. cliSA 컨테이너 활용(as App)

(1) 체인코드 설치하기(폴더 v1추가)

docker exec cliSA peer chaincode install -n simpleasset -v v1 -p /opt/gopath/src/github.com/contract/v1

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/4085687f-2886-4ca4-915b-d7e8fae15934/Untitled.png

(2) 체인코드 배포하기

docker exec cliSA peer chaincode instantiate -n simpleasset -v v1 -C mychannel -c ‘{“Args”:[]}’ -P ‘AND (“Org1MSP.member”)’

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/aada7e5b-a170-4713-aebd-a7b341778b21/Untitled.png

(3) 체인코드 invoke하기

docker exec cliSA peer chaincode invoke -n simpleasset -C mychannel -c ‘{“Args”:[“setAsset”,”account1”,”100”]}’

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/8f56adf5-2b8b-4370-9ed6-53ebefcd55ac/Untitled.png

(4) 체인코드 query하기

docker exec cliSA peer chaincode query -n simpleasset -C mychannel -c ‘{“Args”:[“getAsset”,”account1”]}’

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/dd40781e-2821-488d-b833-9325e371d9a7/Untitled.png