2
2
Licensed under Creative Commons Attribution 4.0 International License
3
3
https://creativecommons.org/licenses/by/4.0/
4
4
--->
5
+
5
6
# Go Chaincode Support for Fabric Private Chaincode
6
7
7
- * Note - Go Chaincode support is currently under development and should be considered experimental.*
8
+ _ Note - Go Chaincode support is currently under development and should be considered experimental._
8
9
9
10
## Overview
10
11
11
12
This directory contains the components to enable Go Chaincode support for Fabric Private Chaincode (FPC).
12
13
This feature relies on the [ Ego project] ( https://www.ego.dev/ ) to build and execute go application with Intel SGX.
13
14
14
15
In particular, it contains:
16
+
15
17
- FPC Go Library to be used with your Go Chaincode.
16
18
- Building and packaging utilities
17
19
@@ -23,6 +25,7 @@ We refer to [shim.go](chaincode/enclave_go/shim.go) for the full list of support
23
25
Note that calling unsupported shim functions, currently results in a ` panic ` .
24
26
25
27
To use FPC, you simply need to wrap your chaincode with the FPC Go Library. Here an example:
28
+
26
29
``` go
27
30
package main
28
31
@@ -34,8 +37,8 @@ import (
34
37
35
38
func main () {
36
39
37
- ...
38
-
40
+ ...
41
+
39
42
// create private chaincode
40
43
privateChaincode := fpc.NewPrivateChaincode (&chaincode.YourChaincode {})
41
44
@@ -55,6 +58,7 @@ func main() {
55
58
In contrast to traditional Fabric Go Chaincode, FPC uses the ego compiler to build the chaincode and then package it in a docker image.
56
59
To simplify this process, we provide you a ` Dockerfile ` and a ` build.mk ` which you can use in your project.
57
60
Here an example of a ` Makefile ` :
61
+
58
62
``` Makefile
59
63
include $(FPC_PATH ) /ecc_go/build.mk
60
64
CC_NAME ?= your-chaincode-name
@@ -72,12 +76,14 @@ You can find all setup information in the getting started section of our [README
72
76
73
77
If you are ** not** using the FPC dev docker container, you need to install the ego compiler manually.
74
78
Install ego by running the following:
79
+
75
80
``` bash
76
81
wget -qO- https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key | apt-key add
77
82
add-apt-repository " deb [arch=amd64] https://download.01.org/intel-sgx/sgx_repo/ubuntu ` lsb_release -cs` main"
78
83
wget https://github.com/edgelesssys/ego/releases/download/v1.0.0/ego_1.0.0_amd64.deb
79
84
apt install ./ego_1.0.0_amd64.deb build-essential libssl-dev
80
85
```
86
+
81
87
You can find more information about ego installation on the official [ documentation] ( https://docs.edgeless.systems/ego/#/getting-started/install ) .
82
88
83
89
## Examples
@@ -93,6 +99,7 @@ You can find the tutorial in [samples/chaincode/simple-asset-go](../samples/chai
93
99
94
100
We provide a sample auction [ samples/chaincode/auction-go] ( ../samples/chaincode/auction-go ) .
95
101
You can run it using the integration test suite as follows:
102
+
96
103
``` bash
97
104
cd $FPC_PATH /integration/go_chaincode/auction
98
105
make
@@ -102,16 +109,18 @@ make
102
109
103
110
Another example is provided [ samples/chaincode/kv-test-go] ( ../samples/chaincode/kv-test-go ) .
104
111
You can run it using the integration test suite as follows:
112
+
105
113
``` bash
106
114
cd $FPC_PATH /integration/go_chaincode/kv_test/
107
115
make
108
116
```
109
117
110
118
## Developer notes
111
119
112
- Here provide a collection of useful developer notes which may help you while developing.
120
+ Here provide a collection of useful developer notes which may help you while developing.
113
121
114
122
### Kill hanging containers
123
+
115
124
``` bash
116
125
docker kill $( docker ps -a -q --filter ancestor=fpc/ercc --filter ancestor=fpc/fpc-auction-go)
117
126
docker rm $( docker ps -a -q --filter ancestor=fpc/ercc --filter ancestor=fpc/fpc-auction-go)
@@ -124,4 +133,3 @@ More to come ...
124
133
The following components are not yet implemented.
125
134
126
135
- [ ] HW Attestation support
127
- - [ ] Fabric contract API
0 commit comments