Giter Club home page Giter Club logo

project-1's Introduction

Readme

To upgrade TG version - use exact git commit. For example:

go get -u github.com/ledgerwatch/turbo-geth@213cf2cbec5792c9b23ab3c3ffa7f1b662d4188e

Run (this assumes turbo-geth is running on the same machine with option --private.api.addr 127.0.0.1:9090):

go run . --private.api.addr 127.0.0.1:9090 --http.api example

alternatively

make
./project-1 --private.api.addr 127.0.0.1:9090 --http.api example

Docs: https://github.com/ledgerwatch/turbo-geth/blob/master/cmd/rpcdaemon/Readme.md

Custom API methods

The custom method is called example_localFork.

Input

The input consists of 3 paramters (params):

  1. Block number (or "latest" to use the latest available block) after which the execution will be applied
  2. Array of unsigned transactions. Each transaction has fields from, to, gas (hex number in quotes), value (in wei, hex number in quotes), nonce (hex value in quotes), input (hex value in quotes). The field to can be omitted, which means it is contract-creating transaction. The field nonce can be ommitted, in which case the correctness of the nonce is not checked.
  3. Array of queries (the same input as for eth_call). A query has the same fields, except for nonce.

Output

The output is the object with two fields txResults, and queryResults:

  1. The field txResults contains an array, with the same number of elements as the second input (transactions) has. Each element in the txResults corresponds to the transaction in the input. Each element has fields UsedGas, Err, and ReturnData. Fields Err and ReturnData can have null values.
  2. The field queryResults contains an array, with the same number of elements as the second input (transactions) has. Each element in the txResults corresponds to the transaction in the input. Each element has fields UsedGas, Err, and ReturnData. Fields Err and ReturnData can have null values.
  3. The field blockNumber returns a number equal to the block number at which the transactions and queries were executed.

Example

Input

curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"example_localFork", "params": ["latest", [
{"from": "0x0000000000000000000000000000000000000000", "gas": "0x100000", "gasPrice": "0x1000", "value": "0x34000", "nonce": "0x0", "input": ""},
{"from": "0x0000000000000000000000000000000000000000", "gas": "0x100000", "gasPrice": "0x1000", "value": "0x34000", "nonce": "0x1", "input": ""}
], [
{"from": "0x0000000000000000000000000000000000000000", "gas": "0x100000", "gasPrice": "0x1000", "value": "0x34000", "input": ""},
{"from": "0x0000000000000000000000000000000000000000", "gas": "0x100000", "gasPrice": "0x1000", "value": "0x34000", "input": ""}
]], "id":1}' localhost:8545

Output

{"jsonrpc":"2.0","id":1,"result":{"txResults":[{"UsedGas":53000,"Err":null,"ReturnData":null},{"UsedGas":53000,"Err":null,"ReturnData":null}],"queryResults":[{"UsedGas":53000,"Err":null,"ReturnData":null},{"UsedGas":53000,"Err":null,"ReturnData":null}]}}

project-1's People

Contributors

askalexsharov avatar alexeyakhunov avatar

Stargazers

Eugene avatar Giulio rebuffo avatar

Watchers

James Cloos avatar  avatar

Forkers

gelfand

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.