question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Looking for the list of supported RPC endpoints?

See the full checklist here: #835

Original Issue

We need to implement the basic API for JSON-RPC server. A simplistic start can be found here: https://github.com/ethereum/py-evm/tree/master/evm/rpc

Lets flesh this out further to something more complete. For now lets keep it as something that must be run as python evm/rpc/server.py ....

I suggest sticking to the read-only apis for now.


Compiled to-do list:

(Checked off at the time of merge)

  • support all the eth_* read-only methods
    • eth_protocolVersion
    • eth_syncing
    • eth_coinbase
    • eth_mining
    • eth_hashrate
    • eth_gasPrice
    • eth_accounts
    • eth_blockNumber
    • eth_getBalance
    • eth_getStorageAt
    • eth_getTransactionCount
    • eth_getBlockTransactionCountByHash
    • eth_getBlockTransactionCountByNumber
    • eth_getUncleCountByBlockHash
    • eth_getUncleCountByBlockNumber block int
    • eth_getUncleCountByBlockNumber block string
    • eth_getCode
    • eth_call
    • eth_estimateGas
    • eth_getBlockByHash
    • eth_getBlockByNumber block int
    • eth_getBlockByNumber block string
    • eth_getTransactionByHash
    • eth_getTransactionByBlockHashAndIndex
    • eth_getTransactionByBlockNumberAndIndex
    • eth_getTransactionReceipt
    • eth_getUncleByBlockHashAndIndex
    • eth_getUncleByBlockNumberAndIndex block int
    • eth_getUncleByBlockNumberAndIndex block string
    • eth_getCompilers
    • eth_getLogs
    • eth_getWork
  • serve over socket
  • make score available on block object, so that a returned block dict can be formatted without a chain reference ?

To save for another PR:

  • server over HTTP

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
pipermerriamcommented, Dec 16, 2017

Quick information drop about eth_estimateGas.

This may be as simple as returning computation.gas_meter.start_gas - computation.gas_meter.gas_remaining. However, if memory serves, I think it’s more complicated that that.

The way that I recall go-ethereum doing this is to execute the transaction with some very large upper bound of gas like 50,000,000.

  • if it errors out: return an error over RPC
  • if it passes, proceed into a binary search, re-running the transaction at each gas value until you find the spot where it succeeds/fails and use the success value.

I’ll re-iterate that the binary search approach may not be necessary based on how we do gas consumption tracking. Let’s see.

0reactions
pipermerriamcommented, Dec 6, 2017

Future TODO: make gas price strategy for eth_gasPrice pluggable and implement the Eth Gas Station strategy: https://github.com/ethereum/web3.py/issues/496

Read more comments on GitHub >

github_iconTop Results From Across the Web

http-jsonrpc-server - npm
A simple and lightweight library for creating a JSON-RPC 2.0 compliant HTTP server. Latest version: 1.1.1, last published: 8 months ago.
Read more >
http-jsonrpc-server - GitHub
A simple and lightweight library for creating a JSON-RPC 2.0 compliant HTTP server. This package complies with the JSON-RPC 2.0 and JSON-RPC 2.0...
Read more >
JSON-RPC
JSON-RPC. A light weight remote procedure call protocol. It is designed to be simple!
Read more >
JSON-RPC Server - Go Ethereum
Ethereum JSON-RPC APIs use a name-space system. RPC methods are grouped into several categories depending on their purpose. All method names are composed...
Read more >
jsonrpc-http-server - crates.io: Rust Package Registry
Rust http server using JSON-RPC 2.0. Documentation. Example. Cargo.toml [dependencies] jsonrpc-http-server = "15.0". main ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found