代码拉取完成,页面将自动刷新
同步操作将从 czy/fabric-sdk 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
package main
import (
"fabric-sdk/sdk"
"fabric-sdk/server"
"fmt"
"os"
)
const (
cc_name = "mycc"
cc_version = "1.0.0"
GOPATH = "/home/mcloud/go/"
)
// var Server sdk.Server
func main() {
// init orgs information
orgs := []*sdk.OrgInfo{
{
OrgAdminUser: "Admin",
OrgName: "Org1",
OrgMspId: "Org1MSP",
OrgUser: "User1",
OrgPeerNum: 2,
OrgAnchorFile: GOPATH + "src/fabric-sdk/gen_crypto/channel-artifacts/Org1MSPanchors.tx",
},
{
OrgAdminUser: "Admin",
OrgName: "Org2",
OrgMspId: "Org2MSP",
OrgUser: "User1",
OrgPeerNum: 2,
OrgAnchorFile: GOPATH + "src/fabric-sdk/gen_crypto/channel-artifacts/Org2MSPanchors.tx",
},
{
OrgAdminUser: "Admin",
OrgName: "Org3",
OrgMspId: "Org3MSP",
OrgUser: "User1",
OrgPeerNum: 2,
OrgAnchorFile: GOPATH + "src/fabric-sdk/gen_crypto/channel-artifacts/Org3MSPanchors.tx",
},
{
OrgAdminUser: "Admin",
OrgName: "Org4",
OrgMspId: "Org4MSP",
OrgUser: "User1",
OrgPeerNum: 2,
OrgAnchorFile: GOPATH + "src/fabric-sdk/gen_crypto/channel-artifacts/Org4MSPanchors.tx",
},
}
// init sdk env info
info := sdk.SdkEnvInfo{
ChannelID: "mychannel",
ChannelConfig: GOPATH + "src/fabric-sdk/gen_crypto/channel-artifacts/channel.tx",
Orgs: orgs,
OrdererAdminUser: "Admin",
OrdererOrgName: "OrdererOrg",
OrdererEndpoint: "orderer1.demo.com",
ChaincodeID: cc_name,
ChaincodePath: GOPATH + "src/fabric-sdk/chaincode/",
ChaincodeVersion: cc_version,
}
// fmt.Println("%v", info)
// sdk setup
sdk, err := sdk.Setup("config.yaml", &info)
if err != nil {
fmt.Println(">> SDK setup error:", err)
os.Exit(-1)
}
// // create channel and join
// if err := sdk.CreateAndJoinChannel(&info); err != nil {
// fmt.Println(">> Create channel and join error:", err)
// os.Exit(-1)
// }
// // create chaincode lifecycle
// if err := sdk.CreateCCLifecycle(&info, 1, false, sdk); err != nil {
// fmt.Println(">> create chaincode lifecycle error: %v", err)
// os.Exit(-1)
// }
// invoke chaincode set status
// fmt.Println(">> 通过链码外部服务设置链码状态......")
fmt.Print(">> 启动服务 ... ")
err = info.InitService(info.ChaincodeID, info.ChannelID, info.Orgs[0], sdk)
if err != nil {
fmt.Println("InitService error")
os.Exit(-1)
}
fmt.Println("done")
serverInfo := server.Server{
SdkEnvInfo: &info,
}
// fmt.Println("%v", serverInfo)
server.ServerStart(serverInfo)
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。