File tree Expand file tree Collapse file tree 3 files changed +95
-0
lines changed
samples/chaincode/secret-keeper-go Expand file tree Collapse file tree 3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,15 @@ TOP = ../../..
77include $(TOP ) /ecc_go/build.mk
88
99CC_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 ECC_MAIN_FILES=$(NAIVE_PATH )
18+
19+ # Target to build skvs version
20+ skvs :
21+ $(MAKE ) build ECC_MAIN_FILES=$(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