Skip to content

Commit 6a4e817

Browse files
committed
feat: change secret-keeper-go makefile
Signed-off-by: chenchanglew <lewchenchang@gmail.com>
1 parent 7808f49 commit 6a4e817

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed

samples/chaincode/secret-keeper-go/Makefile

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,15 @@ TOP = ../../..
77
include $(TOP)/ecc_go/build.mk
88

99
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 ECC_MAIN_FILES=$(NAIVE_PATH)
18+
19+
# Target to build skvs version
20+
skvs:
21+
$(MAKE) build ECC_MAIN_FILES=$(SKVS_PATH)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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+
}

0 commit comments

Comments
 (0)