以太坊JSON-RPC客户端
eth-rpc-api的Python项目详细描述
tl;dr
====
来自consensus的原始库非常有用,尽管它显然不再受支持。现在是从Dockerfiles中删除补丁的时候了^ ^
eth-rpc-api
===
ethereum的python客户机使用json-rpc接口
*完成:实现所有62个json-rpc方法和几个特定于客户机的方法在区块链上创建契约并调用契约方法
因此,升级时请小心。
代码::bash
scrypt-1.2.1/libcperciva/crypto/crypto-aes.c:6:10:致命错误:openssl/aes.h:
^~~~~~~~~~~~~~~~~~
编译终止。
错误:命令"x86-linux-gnu-gcc"失败,退出状态为1
install libssl dev packqage
代码::bash
$pip3安装eth-rpc-api
确保有一个运行以太坊客户端(如geth)的节点供库连接。
代码::python
>;>u'geth/v1.3.3/linux/go1.5.1'
>;>;c.eth庠gasprice()
50000000000
>;>;c.eth庠blocknumber()
828948
>;>;c=ethsonrpc('127.0.0.1',8545)
>;>;c.net庠version()
u'1'
>;>;c.web3_clientversion()
u'geth/v1.3.3/linux/go1.5.1'
>;>c.eth_gasprice()
50000000000
>;>c.eth_u blocknumber()
828948
高级功能性
----
这些示例假定以下简单的一致性契约:
……代码:
contract example{
string s;
代码::bash
$solc—二进制标准输出示例。sol
setup
``````
…代码::python
>;>;编译='606060405261020F806100136000396000F300606040526000357C0100000000000000000000000000000000000000000000000000000004806375D74F3914610044578063E7AAB290146100BD576100425650B005B61004F6004506101565B604051806020018281038252838151815260200150805190602001908083826004602084601F0104600302600F01F15015090810190601F1680156100AF57808203805160018360200361010000A0319168152602001915050925050505080910390F35B61010D6004803590602001906001803590602001919080601F016020910402602001604051908101604052809391908152602001838082843782050505090506010F565B005B8060006000509080519060200190828054825590600052602060002090601F01602090048101921560160579182015B8281111561015F578251826005055916020019060010190610141565B5061018B919061016D565B808211156101876008150600005060010166D565B5090565B50505B0519015081016040528060008152602001506000050805480601F016020809104026000160405190810160405280929181526020018280548015610200578201919060005260200020905B8154815290600101906020018083116101E357829001F1682015B505050505050505061020C565B9056'
>;;从eth rpc廑u api导入ethsonrpc廑以使用奇偶校验特定方法,导入parityethjsonrpc
>;>c=ethjsonrpc('127.0.0.1',8545)
>;>代码::python
>>>从上往下继续
>;contract\u tx=c.create\u contract(c.eth\u coinbase(),compiled,gas=300000)
>;>在这里等待开采新区块时创建合同
>;contract\u addr=c.get\u contract\u地址(contract\u tx)
>;>;>;contract\u addr
u'0x24988147f234848484848484848c43182cf226857'
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````
…代码::python
>>>从上往下继续
>;tx=c.call_with_transaction(c.eth_coinbase(),contract_addr,"set_s(string)",['hello,world'])
>;tx
u'0x15bde63d79466e3db5169a913bb2069130ca387033d2ff2e29f4dfbef1bc6e0d'
代码::python
>>>从上往下继续
>;results=c.call(contract_addr,'get_s()',[],['string'])
>>>results
['hello,world']
其他示例
----
有关其他示例,请参见"test.py"。
>实现的JSON-RPC方法
----
*web3客户端版本
*web3客户端版本
*net版本
*net监听
*净peercount
*eth协议版本
*eth同步
*eth coinbase
*eth挖掘
*eth hashrate
*eth gasprice
*eth账户
*eth blocknumber
*eth getbalance
*eth getstorageat
*eth gettransactioncount
*eth getblocktransactioncountbyhash
*eth-getBlockTransactionCountByNumber
*eth-getUncleCountByBlockHash
*eth-getUncleCountByBlockNumber
*eth-getcode
*eth-sign
*eth-sendTransaction
*eth-sendRawTransaction
*eth-call
*eth-estimateGas
*eth-getBlockByHash
*eth-getBlockByNumber
*eth gettransactionbyhash
*eth gettransactionbyblockhashandindex
*eth gettransactionbyblocknumberandindex
*eth gettransactionreceipt
*eth getunclebyblockhashandindex
*eth getunclebyblocknumberandindex
*eth getcompilers
*eth getcompileslidity
*eth嫒compilell
*eth嫒compileserpent
*eth嫒newfilter
*eth嫒newlockfilter
*eth嫒uninstallfilter
*eth嫒getfilterChanges
*eth嫒getfilterLogs
*eth嫒getwork
*eth嫒submithashrate
*eth嫒submithashrate
*数据库putstring
*数据库putstring
*数据库putshex
*数据库putshex
*数据库putshex
*SHH U版本
*SHH U post
*SHH U newidentity
*SHH U haseidentity
*SHH U newgroup
*SHH U addtogroup
*SHH U newfilter
*SHH U newfilter
*SHH U uniuninstallfilter
*SHH U getfiltercchanges
*SHH U get留言
*SHH U get留言
*SHH U get留言
*SHH U留言
仅奇偶校验json-rpc方法要使用这些方法,确保
*作为客户端运行奇偶校验
*使用此库的"parity ethjsonrpc"客户端(而不是普通的"ethjsonrpc"客户端)运行*跟踪块
reference
----
*https://github.com/ethereum/wiki/wiki/json-rpc
*https://github.com/ethcore/parity/wiki/jsonrpc-trace-module
====
来自consensus的原始库非常有用,尽管它显然不再受支持。现在是从Dockerfiles中删除补丁的时候了^ ^
eth-rpc-api
===
ethereum的python客户机使用json-rpc接口
*完成:实现所有62个json-rpc方法和几个特定于客户机的方法在区块链上创建契约并调用契约方法
因此,升级时请小心。
代码::bash
scrypt-1.2.1/libcperciva/crypto/crypto-aes.c:6:10:致命错误:openssl/aes.h:
^~~~~~~~~~~~~~~~~~
编译终止。
错误:命令"x86-linux-gnu-gcc"失败,退出状态为1
install libssl dev packqage
代码::bash
$pip3安装eth-rpc-api
确保有一个运行以太坊客户端(如geth)的节点供库连接。
代码::python
>;>u'geth/v1.3.3/linux/go1.5.1'
>;>;c.eth庠gasprice()
50000000000
>;>;c.eth庠blocknumber()
828948
>;>;c=ethsonrpc('127.0.0.1',8545)
>;>;c.net庠version()
u'1'
>;>;c.web3_clientversion()
u'geth/v1.3.3/linux/go1.5.1'
>;>c.eth_gasprice()
50000000000
>;>c.eth_u blocknumber()
828948
高级功能性
----
这些示例假定以下简单的一致性契约:
……代码:
contract example{
string s;
代码::bash
$solc—二进制标准输出示例。sol
setup
``````
…代码::python
>;>;编译='606060405261020F806100136000396000F300606040526000357C0100000000000000000000000000000000000000000000000000000004806375D74F3914610044578063E7AAB290146100BD576100425650B005B61004F6004506101565B604051806020018281038252838151815260200150805190602001908083826004602084601F0104600302600F01F15015090810190601F1680156100AF57808203805160018360200361010000A0319168152602001915050925050505080910390F35B61010D6004803590602001906001803590602001919080601F016020910402602001604051908101604052809391908152602001838082843782050505090506010F565B005B8060006000509080519060200190828054825590600052602060002090601F01602090048101921560160579182015B8281111561015F578251826005055916020019060010190610141565B5061018B919061016D565B808211156101876008150600005060010166D565B5090565B50505B0519015081016040528060008152602001506000050805480601F016020809104026000160405190810160405280929181526020018280548015610200578201919060005260200020905B8154815290600101906020018083116101E357829001F1682015B505050505050505061020C565B9056'
>;;从eth rpc廑u api导入ethsonrpc廑以使用奇偶校验特定方法,导入parityethjsonrpc
>;>c=ethjsonrpc('127.0.0.1',8545)
>;>代码::python
>>>从上往下继续
>;contract\u tx=c.create\u contract(c.eth\u coinbase(),compiled,gas=300000)
>;>在这里等待开采新区块时创建合同
>;contract\u addr=c.get\u contract\u地址(contract\u tx)
>;>;>;contract\u addr
u'0x24988147f234848484848484848c43182cf226857'
```````````````````````````````````````````````````````````````````````````````````````````````````````````````````
…代码::python
>>>从上往下继续
>;tx=c.call_with_transaction(c.eth_coinbase(),contract_addr,"set_s(string)",['hello,world'])
>;tx
u'0x15bde63d79466e3db5169a913bb2069130ca387033d2ff2e29f4dfbef1bc6e0d'
代码::python
>>>从上往下继续
>;results=c.call(contract_addr,'get_s()',[],['string'])
>>>results
['hello,world']
其他示例
----
有关其他示例,请参见"test.py"。
>实现的JSON-RPC方法
----
*web3客户端版本
*web3客户端版本
*net版本
*net监听
*净peercount
*eth协议版本
*eth同步
*eth coinbase
*eth挖掘
*eth hashrate
*eth gasprice
*eth账户
*eth blocknumber
*eth getbalance
*eth getstorageat
*eth gettransactioncount
*eth getblocktransactioncountbyhash
*eth-getBlockTransactionCountByNumber
*eth-getUncleCountByBlockHash
*eth-getUncleCountByBlockNumber
*eth-getcode
*eth-sign
*eth-sendTransaction
*eth-sendRawTransaction
*eth-call
*eth-estimateGas
*eth-getBlockByHash
*eth-getBlockByNumber
*eth gettransactionbyhash
*eth gettransactionbyblockhashandindex
*eth gettransactionbyblocknumberandindex
*eth gettransactionreceipt
*eth getunclebyblockhashandindex
*eth getunclebyblocknumberandindex
*eth getcompilers
*eth getcompileslidity
*eth嫒compilell
*eth嫒compileserpent
*eth嫒newfilter
*eth嫒newlockfilter
*eth嫒uninstallfilter
*eth嫒getfilterChanges
*eth嫒getfilterLogs
*eth嫒getwork
*eth嫒submithashrate
*eth嫒submithashrate
*数据库putstring
*数据库putstring
*数据库putshex
*数据库putshex
*数据库putshex
*SHH U版本
*SHH U post
*SHH U newidentity
*SHH U haseidentity
*SHH U newgroup
*SHH U addtogroup
*SHH U newfilter
*SHH U newfilter
*SHH U uniuninstallfilter
*SHH U getfiltercchanges
*SHH U get留言
*SHH U get留言
*SHH U get留言
*SHH U留言
仅奇偶校验json-rpc方法要使用这些方法,确保
*作为客户端运行奇偶校验
*使用此库的"parity ethjsonrpc"客户端(而不是普通的"ethjsonrpc"客户端)运行*跟踪块
reference
----
*https://github.com/ethereum/wiki/wiki/json-rpc
*https://github.com/ethcore/parity/wiki/jsonrpc-trace-module