-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
32 lines (27 loc) · 860 Bytes
/
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
package main
import (
"fmt"
"github.com/datachainlab/fabric-batch-chaincode/_examples/counter/chaincode"
"github.com/datachainlab/fabric-batch-chaincode/batch"
"github.com/hyperledger/fabric-contract-api-go/contractapi"
)
// An example for application
func main() {
batchcc := &batch.BatchContract{
FnRegistry: map[string]batch.Fn{},
Authenticator: batch.DefaultAuthenticator,
TotalQueryLimit: 100000,
MsgTimeGapAllowance: 16,
CommitTimeGapAllowance: 0, // for test
GetPeerTime: batch.DefaultGetPeerTime,
}
contract := chaincode.NewSmartContract(batchcc)
chaincode, err := contractapi.NewChaincode(contract)
if err != nil {
fmt.Printf("Error create batch chaincode: %s", err.Error())
return
}
if err := chaincode.Start(); err != nil {
fmt.Printf("Error starting batch chaincode: %s", err.Error())
}
}