-
Notifications
You must be signed in to change notification settings - Fork 96
Expand file tree
/
Copy pathmain.go
More file actions
43 lines (33 loc) · 1.03 KB
/
main.go
File metadata and controls
43 lines (33 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Copyright IBM Corp. All Rights Reserved.
Copyright 2020 Intel Corporation
SPDX-License-Identifier: Apache-2.0
*/
package main
import (
"os"
"github.com/hyperledger/fabric-chaincode-go/shim"
fpc "github.com/hyperledger/fabric-private-chaincode/ecc_go/chaincode"
"github.com/hyperledger/fabric-private-chaincode/samples/chaincode/kv-test-go/chaincode"
)
func main() {
// we can control logging via FABRIC_LOGGING_SPEC, the default is FABRIC_LOGGING_SPEC=INFO
// For more fine-grained logging we could also use different log level for loggers.
// For example: FABRIC_LOGGING_SPEC=ecc=DEBUG:ecc_enclave=ERROR
ccid := os.Getenv("CHAINCODE_PKG_ID")
addr := os.Getenv("CHAINCODE_SERVER_ADDRESS")
// create private chaincode
privateChaincode := fpc.NewPrivateChaincode(chaincode.NewKvTest())
// start chaincode as a service
server := &shim.ChaincodeServer{
CCID: ccid,
Address: addr,
CC: privateChaincode,
TLSProps: shim.TLSProperties{
Disabled: true,
},
}
if err := server.Start(); err != nil {
panic(err)
}
}