我正在尝试对比特币RPC进行以下调用,但不确定如何以正确的方式传递参数。
从bitcoinrpc.authproxy导入AuthServiceProxy,JSONRPCException
curl --user user:password -sf --data-binary '{"jsonrpc": "1.0", "id":"check_btc_blockchain", "method": "listtransactions", "params":["slushpool", 10, 0, true] }' http://127.0.0.1:8332
使用以下python代码
# rpc_user and rpc_password are set in the bitcoin.conf file
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:8332"%("user", "password"))
print(rpc_connection.listtransactions("slushpool", 10, 0, 0))
错误:bitcoinrpc.authproxy.JSONRPCException:-1:JSON值不是预期的布尔值
我也尝试过使用true和false。
所以这可行。
在VAR上设置布尔值。
trt = True
print(rpc_connection.listtransactions("slushpool", 10, 0, trt))