@@ -9,20 +9,51 @@ chaincode implementation see ecc_encalve/.
99
1010The following steps guide you through the build phase. Make sure this project is on your GOPATH.
1111
12- First, build the chaincode and the validiation plugin
12+ First, build the chaincode and the validation plugin
1313
1414 $ make
15-
16- Next, build the chaincode docker image. Note that normally the fabric peer
17- itself creates the docker image when a new chaincode is installed. However, we
18- use a custom chaincode environment docker image that has SGX support enabled.
19- You can define the peer name and the chaincode name using PEER_NAME and
20- CC_NAME.
21-
22- $ make docker DOCKER_IMAGE=dev-jdoe-ecc-0
15+
16+ Next, build the chaincode docker image that is used by a fabric peer
17+ to run our chaincode. Normally, the peer creates the docker image
18+ automatically when a new chaincode is installed. In particular, it
19+ fetches the source code, builds the chaincode binary, and copies them
20+ into a new docker images based on fabric-ccenv. Note that, since the
21+ peer is lazy, the docker image is only created when the chaincode is
22+ installed and it is not already existing. The image name comprise of
23+ the peer name, the chaincode name, and a hash.
24+
25+ However, we use a custom chaincode environment docker image that has
26+ SGX-support enabled. In order to tell a peer to use our SGX chaincode
27+ image, we need to override an existing chaincode image.
28+
29+ For example: `` dev-jdoe-ecc-0-8bdbb434df41902eb2d2b2e2f10f6b0504b63f56eb98582f307c11a15fc14eb7 ``
30+
31+ Therefore, first install some chaincode, which we are going to override,
32+ and check if the corresponding docker image has been created
33+ successfully.
34+
35+ $ peer chaincode install -n ecc -v 0 -p github.com/hyperledger/fabric/examples/chaincode/go/example02/cmd
2336 $ docker images
24-
25- Now you should see `` ecc `` in the list of docker images `` $ docker images `` .
37+ REPOSITORY
38+ TAG IMAGE ID
39+ dev-jdoe-ercc-0-a5a84629692f2ed6e111c44bd91e8c3e0906deb39d9e16f7acd5aefc51303184
40+ latest 7a5ea0677404
41+ dev-jdoe-ecc-0-8bdbb434df41902eb2d2b2e2f10f6b0504b63f56eb98582f307c11a15fc14eb7
42+ latest 0c18434ae5e3
43+
44+ Next, just run ```make docker`` to override the existing docker image with
45+ our SGX chaincode. To verify that the image contains our enclave
46+ code, let's have a look inside the image and see if we can see an
47+ enclave folder.
48+
49+ $ make docker
50+ $ docker run -i -t --entrypoint ls dev-jdoe-ecc-0-8bdbb434df41902eb2d2b2e2f10f6b0504b63f56eb98582f307c11a15fc14eb7:latest
51+ chaincode chaintool enclave node npm npx protoc-gen-go
52+
53+ You can define the peer and the chaincode name also manually.
54+
55+ $ make docker DOCKER_IMAGE=my-peername-ecc-0
56+
2657For debugging you can also start the docker image.
2758
2859 $ make docker-run
0 commit comments