Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

go-sdk 连接国密bcos链EOF #240

Open
Nxxaux opened this issue Oct 20, 2023 · 3 comments
Open

go-sdk 连接国密bcos链EOF #240

Nxxaux opened this issue Oct 20, 2023 · 3 comments
Labels

Comments

@Nxxaux
Copy link

Nxxaux commented Oct 20, 2023

国密链按照文档搭建起来了, webase-front可以正常连上,并部署了合约。

sdk配置如下

[Network]
Type="channel"
CAFile="./gm-sdk/gmca.crt"
Cert="./gm-sdk/gmsdk.crt"
Key="./gm-sdk/gmsdk.key"
[[Network.Connection]]
NodeURL="127.0.0.1:20200"
GroupID=1
# [[Network.Connection]]
# NodeURL="127.0.0.1:20200"
# GroupID=2

[Account]
KeyFile="accounts/gm/0xe40b5aa2b49cd627382a4ebc90694673d177c768.pem"

[Chain]
ChainID=1
SMCrypto=true

sdk 代码如下:

func main() {
	//parse config
	configs, err := conf.ParseConfigFile("gm-config.toml")
	if err != nil {
		log.Fatal(err)
	}
	config := &configs[0]

	//connect peer
	cli, err := client.Dial(config)
	if err != nil {
		log.Fatal(err)  //这里会报EOF。 
	}
}

报错如下:

$ go run main.go hello.go 
2023/10/20 15:31:42 EOF
exit status 1

EOF是啥意思,不知道怎么继续了..

@Nxxaux
Copy link
Author

Nxxaux commented Oct 20, 2023

搞明白了, go-sdk暂不支持使用国密SSL与节点建立连接。 所以config.toml 中要把Type="rpc", 并且NodeURL="127.0.0.1:8485"把端口改成http端口就好了。 总结起来就是go-sdk不支持国密。

@bxq2011hust
Copy link
Member

搞明白了, go-sdk暂不支持使用国密SSL与节点建立连接。 所以config.toml 中要把Type="rpc", 并且NodeURL="127.0.0.1:8485"把端口改成http端口就好了。 总结起来就是go-sdk不支持国密。

2.0确实对国密SSL的支持不是特别完善,下面这个是社区伙伴贡献的支持国密SSL的一个分支,有需求可以看下
https://github.com/FISCO-BCOS/go-sdk/tree/feature-gmssl-for-FISCO-BCOS-v2

@bxq2011hust
Copy link
Member

master分支的go-sdk适配FISCO BCOS v3,基于bcos-c-sdk的动态库和cgo实现,支持国密SSL,欢迎使用反馈

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

No branches or pull requests

2 participants