-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (35 loc) · 1.19 KB
/
main.go
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
package main
import (
smartMedicineSystem "ccode/src"
"github.com/hyperledger/fabric-contract-api-go/contractapi"
_ "github.com/hyperledger/fabric-contract-api-go/contractapi/utils"
"log"
)
/* https://github.com/hyperledger/fabric-samples/tree/release-1.4/chaincode-docker-devmode */
//docker-compose -f docker-compose-simple.yaml up
//docker exec -it chaincode sh
//cd chaincode_example02/go
//go build -o chaincode_example02
//CORE_PEER_ADDRESS=peer:7052 CORE_CHAINCODE_ID_NAME=mycc:0 ./chaincode_example02
//docker exec -it cli bash
//go mod vendor
//go build
func main() {
defer func() {
e := recover()
if e != nil {
log.Print("Error=", e)
}
}()
smartMedicineContract := new(smartMedicineSystem.MedicalSystem)
//smartMedicineContract.UnknownTransaction = smartMedicineSystem.UnknownTransactionHandler
//smartMedicineContract.BeforeTransaction = utils.UndefinedInterface{}
cc, err := contractapi.NewChaincode(smartMedicineContract)
if err != nil {
log.Panicf("Error creating smart medicine system chaincode: %v", err)
}
cc.DefaultContract = smartMedicineContract.GetName()
if err := cc.Start(); err != nil {
log.Panicf("Error starting smart medicine system chaincode: %v", err)
}
}