{"id":25058311,"url":"https://github.com/consensys/ethjsonrpc","last_synced_at":"2025-10-12T16:10:04.358Z","repository":{"id":27894814,"uuid":"31386394","full_name":"Consensys/ethjsonrpc","owner":"Consensys","description":"Python JSON-RPC client for the Ethereum blockchain","archived":false,"fork":false,"pushed_at":"2024-06-24T13:23:00.000Z","size":106,"stargazers_count":158,"open_issues_count":32,"forks_count":103,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-03-29T03:04:35.499Z","etag":null,"topics":["ethereum","json-rpc-client","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Consensys.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-02-26T20:08:23.000Z","updated_at":"2025-02-17T11:44:55.000Z","dependencies_parsed_at":"2024-06-21T14:14:52.003Z","dependency_job_id":"55efd2a4-c674-4ce5-b978-131718947716","html_url":"https://github.com/Consensys/ethjsonrpc","commit_stats":{"total_commits":129,"total_committers":7,"mean_commits":"18.428571428571427","dds":"0.13178294573643412","last_synced_commit":"fe525bdcd889924687ba1646fc46cef329410e22"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fethjsonrpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fethjsonrpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fethjsonrpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Consensys%2Fethjsonrpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Consensys","download_url":"https://codeload.github.com/Consensys/ethjsonrpc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247284949,"owners_count":20913704,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ethereum","json-rpc-client","python"],"created_at":"2025-02-06T14:25:03.149Z","updated_at":"2025-10-12T16:09:59.292Z","avatar_url":"https://github.com/Consensys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ethjsonrpc\n==========\n\nPython client for Ethereum using the JSON-RPC interface\n\n* complete: implements all 62 JSON-RPC methods plus several client-specific methods\n* provides a high-level interface to create contracts on the blockchain and to call contract methods\n\nImportant note\n--------------\n\nThe API is not yet stable, so please use caution when upgrading.\n\nInstallation\n------------\n\nYou may need additional libraries and tools before installing ethjsonrpc.\n\nOn Ubuntu 20.04:\n\n.. code:: bash\n\n   $ sudo apt install python2-minimal\n   $ sudo apt install gcc\n   $ sudo apt install virtualenv  # optional but recommended\n   $ sudo apt install libpython2-dev\n   $ sudo apt install libssl-dev\n\nOn Ubuntu 16.04:\n\n.. code:: bash\n\n   $ sudo apt install python-minimal\n   $ sudo apt install gcc\n   $ sudo apt install virtualenv  # optional but recommended\n   $ sudo apt install libpython-dev\n   $ sudo apt install libssl-dev\n\n\nOn Ubuntu 14.04:\n\n.. code:: bash\n\n   $ sudo apt-get install python-virtualenv  # optional but recommended\n   $ sudo apt-get install libpython-dev\n   $ sudo apt-get install libssl-dev\n\n\nTo install ethjsonrpc:\n\n.. code:: bash\n\n   $ pip install ethjsonrpc\n\n\nMake sure to have a node running an Ethereum client (such as geth) for the library to connect to.\n\nExample\n-------\n\n.. code:: python\n\n   \u003e\u003e\u003e from ethjsonrpc import EthJsonRpc  # to use Parity-specific methods, import ParityEthJsonRpc\n   \u003e\u003e\u003e c = EthJsonRpc('127.0.0.1', 8545)\n   \u003e\u003e\u003e c.net_version()\n   u'1'\n   \u003e\u003e\u003e c.web3_clientVersion()\n   u'Geth/v1.3.3/linux/go1.5.1'\n   \u003e\u003e\u003e c.eth_gasPrice()\n   50000000000\n   \u003e\u003e\u003e c.eth_blockNumber()\n   828948\n\n\nHigh-level functionality\n------------------------\n\nThese examples assume the following simple Solidity contract:\n\n.. code::\n\n   contract Example {\n\n       string s;\n\n       function set_s(string new_s) {\n           s = new_s;\n       }\n\n       function get_s() returns (string) {\n           return s;\n       }\n   }\n\n\nCompile it like this:\n\n.. code:: bash\n\n   $ solc --binary stdout example.sol\n\n\nSetup\n`````\n\n.. code:: python\n\n   \u003e\u003e\u003e compiled = '606060405261020f806100136000396000f30060606040526000357c01000000000000000000000000000000000000000000000000000000009004806375d74f3914610044578063e7aab290146100bd57610042565b005b61004f600450610191565b60405180806020018281038252838181518152602001915080519060200190808383829060006004602084601f0104600302600f01f150905090810190601f1680156100af5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010d6004803590602001906004018035906020019191908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050905061010f565b005b806000600050908051906020019082805482825590600052602060002090601f01602090048101928215610160579182015b8281111561015f578251826000505591602001919060010190610141565b5b50905061018b919061016d565b80821115610187576000818150600090555060010161016d565b5090565b50505b50565b60206040519081016040528060008152602001506000600050805480601f0160208091040260200160405190810160405280929190818152602001828054801561020057820191906000526020600020905b8154815290600101906020018083116101e357829003601f168201915b5050505050905061020c565b9056'\n   \u003e\u003e\u003e from ethjsonrpc import EthJsonRpc  # to use Parity-specific methods, import ParityEthJsonRpc\n   \u003e\u003e\u003e c = EthJsonRpc('127.0.0.1', 8545)\n\n\nCreating a contract on the blockchain\n`````````````````````````````````````\n\n.. code:: python\n\n   \u003e\u003e\u003e # continued from above\n   \u003e\u003e\u003e contract_tx = c.create_contract(c.eth_coinbase(), compiled, gas=300000)\n   \u003e\u003e\u003e # wait here for the contract to be created when a new block is mined\n   \u003e\u003e\u003e contract_addr = c.get_contract_address(contract_tx)\n   \u003e\u003e\u003e contract_addr\n   u'0x24988147f2f2300450103d8c42c43182cf226857'\n\n\nCalling a contract function with a transaction (storing data)\n`````````````````````````````````````````````````````````````\n\n.. code:: python\n\n   \u003e\u003e\u003e # continued from above\n   \u003e\u003e\u003e tx = c.call_with_transaction(c.eth_coinbase(), contract_addr, 'set_s(string)', ['Hello, world'])\n   \u003e\u003e\u003e tx\n   u'0x15bde63d79466e3db5169a913bb2069130ca387033d2ff2e29f4dfbef1bc6e0d'\n\n\nCalling a contract function on the local blockchain (reading data)\n``````````````````````````````````````````````````````````````````\n\n.. code:: python\n\n   \u003e\u003e\u003e # continued from above\n   \u003e\u003e\u003e results = c.call(contract_addr, 'get_s()', [], ['string'])\n   \u003e\u003e\u003e results\n   ['Hello, world']\n\n\nAdditional examples\n-------------------\n\nPlease see ``test.py`` for additional examples.\n\nImplemented JSON-RPC methods\n----------------------------\n\n* web3_clientVersion\n* web3_sha3\n* net_version\n* net_listening\n* net_peerCount\n* eth_protocolVersion\n* eth_syncing\n* eth_coinbase\n* eth_mining\n* eth_hashrate\n* eth_gasPrice\n* eth_accounts\n* eth_blockNumber\n* eth_getBalance\n* eth_getStorageAt\n* eth_getTransactionCount\n* eth_getBlockTransactionCountByHash\n* eth_getBlockTransactionCountByNumber\n* eth_getUncleCountByBlockHash\n* eth_getUncleCountByBlockNumber\n* eth_getCode\n* eth_sign\n* eth_sendTransaction\n* eth_sendRawTransaction\n* eth_call\n* eth_estimateGas\n* eth_getBlockByHash\n* eth_getBlockByNumber\n* eth_getTransactionByHash\n* eth_getTransactionByBlockHashAndIndex\n* eth_getTransactionByBlockNumberAndIndex\n* eth_getTransactionReceipt\n* eth_getUncleByBlockHashAndIndex\n* eth_getUncleByBlockNumberAndIndex\n* eth_getCompilers\n* eth_compileSolidity\n* eth_compileLLL\n* eth_compileSerpent\n* eth_newFilter\n* eth_newBlockFilter\n* eth_newPendingTransactionFilter\n* eth_uninstallFilter\n* eth_getFilterChanges\n* eth_getFilterLogs\n* eth_getLogs\n* eth_getWork\n* eth_submitWork\n* eth_submitHashrate\n* db_putString\n* db_getString\n* db_putHex\n* db_getHex\n* shh_version\n* shh_post\n* shh_newIdentity\n* shh_hasIdentity\n* shh_newGroup\n* shh_addToGroup\n* shh_newFilter\n* shh_uninstallFilter\n* shh_getFilterChanges\n* shh_getMessages\n\nParity-only JSON-RPC methods\n----------------------------\n\nTo use these methods, make sure that you're\n\n* running Parity as your client\n* running with the ``--tracing on`` option\n* using this library's ``ParityEthJsonRpc`` client (not the vanilla ``EthJsonRpc`` client)\n\nMethods:\n\n* trace_filter\n* trace_get\n* trace_transaction\n* trace_block\n\nReference\n---------\n\n* https://github.com/ethereum/wiki/wiki/JSON-RPC\n* https://github.com/ethcore/parity/wiki/JSONRPC-trace-module\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensys%2Fethjsonrpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsensys%2Fethjsonrpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsensys%2Fethjsonrpc/lists"}