-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.go
executable file
·59 lines (45 loc) · 1.26 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package main
import (
"fmt"
"employeeledger/blockchain"
"employeeledger/web"
"employeeledger/web/controllers"
"os"
)
func main() {
// Definition of the Fabric SDK properties
fSetup := blockchain.FabricSetup{
// Network parameters
OrdererID: "orderer.employee.ledger.com",
// Channel parameters
ChannelID: "employeeledger",
ChannelConfig: os.Getenv("GOPATH") + "/src/employeeledger/fixtures/artifacts/employeeledger.channel.tx",
// Chaincode parameters
ChaincodeID: "employeeledger",
ChaincodeGoPath: os.Getenv("GOPATH"),
ChaincodePath: "employeeledger/chaincode/",
OrgAdmin: "Admin",
OrgName: "org1",
ConfigFile: "config.yaml",
// CA parameters
CaID: "ca.org1.employee.ledger.com",
}
// Initialization of the Fabric SDK from the previously set properties
err := fSetup.Initialize()
if err != nil {
fmt.Printf("Unable to initialize the Fabric SDK: %v\n", err)
return
}
// Close SDK
defer fSetup.CloseSDK()
// Install and instantiate the chaincode
err = fSetup.InstallAndInstantiateCC()
if err != nil {
fmt.Printf("Unable to install and instantiate the chaincode: %v\n", err)
return
}
app := &controllers.Application{
Fabric: &fSetup,
}
web.Serve(app)
}