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

[RPC]使用RPC方式访问HelloWorld的set方法出现问题 #58

Closed
alexwishes opened this issue Apr 23, 2018 · 1 comment
Closed

[RPC]使用RPC方式访问HelloWorld的set方法出现问题 #58

alexwishes opened this issue Apr 23, 2018 · 1 comment

Comments

@alexwishes
Copy link

Request:
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"data":{"contract":"HelloWorld","version":"","func":"set","params":["call defaut version"]},"randomid":"3"}],"id":1}' "http://127.0.0.1:8546"

Response:
{"error":{"code":0,"data":null,"message":"Account unknown."},"id":1,"jsonrpc":"2.0"}

提示账户的错误,不是已经去掉了Account,使用CA了吗?请问如何处理?

@fisco-dev
Copy link

这个是提供了一个参考的示例,这种方式目前也并不推荐。
解决的方法可以如下:
进入fisco-bcos的config.json配置的datadir目录, 有个geth.ipc的文件。
使用命令 : ethconsole geth.ipc
输入下面命令:

web3.eth.personal.newAccount("123456",console.log)
null '0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce'
'0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce'
其中
web3.eth.personal.newAccount("123456",console.log)
null '0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce'
'0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce' 为新生成的账户, 123456是加密的密码。
然后解锁 然后解锁账号:
web3.eth.personal.unlockAccount("0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce","123456",120,console.log)

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"data":{"contract":"HelloWorld","version":"","func":"set","params":["call defaut version"]},"randomid":"9","from":"0xEebF0c8B3C5abB70A9FDAd8c4307c33eBd53Ffce"}],"id":1}' "http://127.0.0.1:8546"
将上面解锁的账号添加为from字段,然后就可以正常使用。
上述是以太坊里面的一些流程,在fisco-bcos中已经不推荐使用。

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

No branches or pull requests

2 participants