Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

how to use this to create channel at fabric2.4 without orderer system channel #273

Open
jianlu8023 opened this issue Aug 25, 2023 · 5 comments

Comments

@jianlu8023
Copy link

when 
 i use this sdk to create channel at fabric2.4.3 test-network has err mains without orderer system channel

@werniq
Copy link

werniq commented Oct 19, 2023

I think you should firstly start an oredering node. Orderer is the one of key parts in Hyperledger Fabric, and it should be created earlier, than channel, because it establishes a consensus on the order of transactions across the entire network, while channel is the place where transactions occurs.

https://hyperledger-fabric.readthedocs.io/en/latest/deployorderer/ordererdeploy.html?highlight=orderer#start-the-orderer

@jianlu8023
Copy link
Author

I think you should firstly start an oredering node. Orderer is the one of key parts in Hyperledger Fabric, and it should be created earlier, than channel, because it establishes a consensus on the order of transactions across the entire network, while channel is the place where transactions occurs.

https://hyperledger-fabric.readthedocs.io/en/latest/deployorderer/ordererdeploy.html?highlight=orderer#start-the-orderer

this is my steps:

  1. use network.sh start test-network environment command: ./network.sh up -ca -s couchdb
  2. use go sdk to create a channel

then i meet this problem

i want to study use go-sdk to create a channel and other operation such as install chaincode

@werniq
Copy link

werniq commented Oct 20, 2023

You can use ./network.sh up createChannel and it will create channel with name mychannel, and install chaincode there like:
peer chaincode package basic.tar.gz --path path/to/your/chaincode --lang golang --label basic_1.0
&&
peer chaincode install basic.tar.gz

@jianlu8023
Copy link
Author

You can use ./network.sh up createChannel and it will create channel with name mychannel, and install chaincode there like:

peer chaincode package basic.tar.gz --path path/to/your/chaincode --lang golang --label basic_1.0

&&

peer chaincode install basic.tar.gz

yes i know but i want to use sdk to operation environment

@werniq
Copy link

werniq commented Oct 20, 2023

Then you should firstly initialize fabric sdk:

fsdk, err := fabsdk.New(config.FromFile("config.yaml")) if err != nil { panic(err) } // defer close clientContext := sdk.Context()
and then, create a channel

channelClient, err := channel.New(clientContext) if err != nil { panic(err) } err = channelClient.CreateChannel(channel.Request{ Name: "mychannel", Orderer: "orderer.example.com", }) if err != nil { panic(err) }

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants