Commit c7028ec 1 parent e432083 commit c7028ec Copy full SHA for c7028ec
File tree 4 files changed +98
-2
lines changed
samples/chaincode/secret-keeper-go
4 files changed +98
-2
lines changed Original file line number Diff line number Diff line change @@ -16,19 +16,20 @@ DOCKER_FILE ?= $(FPC_PATH)/ecc_go/Dockerfile
16
16
EGO_CONFIG_FILE ?= $(FPC_PATH ) /ecc_go/enclave.json
17
17
ECC_BINARY ?= ecc
18
18
ECC_BUNDLE ?= $(ECC_BINARY ) -bundle
19
+ MAIN_GO_PATH ?= main.go
19
20
20
21
build : ecc docker env
21
22
22
23
ecc : ecc_dependencies
23
- ego-go build $(GOTAGS ) -o $(ECC_BINARY ) main.go
24
+ ego-go build $(GOTAGS ) -o $(ECC_BINARY ) $( MAIN_GO_PATH )
24
25
cp $(EGO_CONFIG_FILE ) .
25
26
ego sign
26
27
ego uniqueid $(ECC_BINARY ) > mrenclave
27
28
ego bundle $(ECC_BINARY ) $(ECC_BUNDLE )
28
29
29
30
.PHONY : with_go
30
31
with_go : ecc_dependencies
31
- $(GO ) build $(GOTAGS ) -o $(ECC_BUNDLE ) main.go
32
+ $(GO ) build $(GOTAGS ) -o $(ECC_BUNDLE ) $( MAIN_GO_PATH )
32
33
echo " fake_mrenclave" > mrenclave
33
34
34
35
ecc_dependencies :
Original file line number Diff line number Diff line change @@ -7,3 +7,15 @@ TOP = ../../..
7
7
include $(TOP ) /ecc_go/build.mk
8
8
9
9
CC_NAME ?= fpc-secret-keeper-go
10
+
11
+ # Define paths for cmd subdirectories
12
+ NAIVE_PATH = cmd/naive/main.go
13
+ SKVS_PATH = cmd/skvs/main.go
14
+
15
+ # Target to build naive version
16
+ naive :
17
+ $(MAKE ) build MAIN_GO_PATH=$(NAIVE_PATH )
18
+
19
+ # Target to build skvs version
20
+ skvs :
21
+ $(MAKE ) build MAIN_GO_PATH=$(SKVS_PATH )
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright IBM Corp. All Rights Reserved.
3
+ Copyright 2020 Intel Corporation
4
+
5
+ SPDX-License-Identifier: Apache-2.0
6
+ */
7
+
8
+ package main
9
+
10
+ import (
11
+ "os"
12
+
13
+ "github.com/hyperledger/fabric-chaincode-go/shim"
14
+ "github.com/hyperledger/fabric-contract-api-go/contractapi"
15
+ fpc "github.com/hyperledger/fabric-private-chaincode/ecc_go/chaincode"
16
+ "github.com/hyperledger/fabric-private-chaincode/samples/chaincode/secret-keeper-go/chaincode"
17
+ )
18
+
19
+ func main () {
20
+
21
+ ccid := os .Getenv ("CHAINCODE_PKG_ID" )
22
+ addr := os .Getenv ("CHAINCODE_SERVER_ADDRESS" )
23
+
24
+ // create chaincode
25
+ secretChaincode , _ := contractapi .NewChaincode (& chaincode.SecretKeeper {})
26
+ chaincode := fpc .NewPrivateChaincode (secretChaincode )
27
+
28
+ // start chaincode as a service
29
+ server := & shim.ChaincodeServer {
30
+ CCID : ccid ,
31
+ Address : addr ,
32
+ CC : chaincode ,
33
+ TLSProps : shim.TLSProperties {
34
+ Disabled : true , // just for testing good enough
35
+ },
36
+ }
37
+
38
+ if err := server .Start (); err != nil {
39
+ panic (err )
40
+ }
41
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright IBM Corp. All Rights Reserved.
3
+ Copyright 2020 Intel Corporation
4
+
5
+ SPDX-License-Identifier: Apache-2.0
6
+ */
7
+
8
+ package main
9
+
10
+ import (
11
+ "os"
12
+
13
+ "github.com/hyperledger/fabric-chaincode-go/shim"
14
+ "github.com/hyperledger/fabric-contract-api-go/contractapi"
15
+ fpc "github.com/hyperledger/fabric-private-chaincode/ecc_go/chaincode"
16
+ "github.com/hyperledger/fabric-private-chaincode/samples/chaincode/secret-keeper-go/chaincode"
17
+ )
18
+
19
+ func main () {
20
+
21
+ ccid := os .Getenv ("CHAINCODE_PKG_ID" )
22
+ addr := os .Getenv ("CHAINCODE_SERVER_ADDRESS" )
23
+
24
+ // create chaincode
25
+ secretChaincode , _ := contractapi .NewChaincode (& chaincode.SecretKeeper {})
26
+ // chaincode := fpc.NewPrivateChaincode(secretChaincode)
27
+ skvsChaincode := fpc .NewSkvsChaincode (secretChaincode )
28
+
29
+ // start chaincode as a service
30
+ server := & shim.ChaincodeServer {
31
+ CCID : ccid ,
32
+ Address : addr ,
33
+ CC : skvsChaincode ,
34
+ TLSProps : shim.TLSProperties {
35
+ Disabled : true , // just for testing good enough
36
+ },
37
+ }
38
+
39
+ if err := server .Start (); err != nil {
40
+ panic (err )
41
+ }
42
+ }
You can’t perform that action at this time.
0 commit comments