Giter Site home page Giter Site logo

mesh-ethereum's Introduction

Mesh Ethereum

This repository contains a sample implementation of Mesh API for the Ethereum blockchain.

Build Status

Build once. Integrate your blockchain everywhere.

MESH-ETHEREUM IS CONSIDERED ALPHA SOFTWARE. USE AT YOUR OWN RISK.

This project is available open source under the terms of the [Apache 2.0 License](https://opensource.org/licenses/Apache-2.0).

Overview

The mesh-ethereum repository provides an implementation sample of the Mesh API for Ethereum in Golang. We created this repository for developers of Ethereum-like (a.k.a., account-based) blockchains, who may find it easier to fork this implementation sample than write one from scratch.

Mesh is an open-source specification and set of tools that makes integrating with blockchains simpler, faster, and more reliable. The Mesh API is specified in the OpenAPI 3.0 format.

You can craft requests and responses with auto-generated code using Swagger Codegen or OpenAPI Generator. These requests and responses must be human-readable (easy to debug and understand), and able to be used in servers and browsers.

Jump to:

How to Use This Repo

  1. Fork the repo.
  2. Start playing with the code.
  3. Deploy a node in Docker to begin testing.

System Requirements

RAM: 16 MB minimum

We tested mesh-ethereum on an AWS c5.2xlarge instance. This instance type has 8 vCPU and 16 GB of RAM. If you use a computer with less than 16 GB of RAM, it is possible that mesh-ethereum will exit with an OOM error.

Network Settings

To increase the load mesh-ethereum can handle, we recommend these actions:

  1. Tune your OS settings to allow for more connections. On a linux-based OS, run the following commands to do so (source):
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.core.rmem_max=16777216
sysctl -w net.core.wmem_max=16777216
sysctl -w net.ipv4.tcp_max_syn_backlog=10000
sysctl -w net.core.somaxconn=10000
sysctl -p (when done)

We have not tested mesh-ethereum with net.ipv4.tcp_tw_recycle and do not recommend enabling it.

  1. Modify your open file settings to 100000. You can do this on a linux-based OS with the command: ulimit -n 100000.

Memory-Mapped Files

mesh-ethereum uses memory-mapped files to persist data in the indexer. As a result, you must run mesh-ethereum on a 64-bit architecture (the virtual address space easily exceeds 100s of GBs).

If you receive a kernel OOM, you may need to increase the allocated size of swap space on your OS. There is a great tutorial for how to do this on Linux here.

Features

  • Comprehensive tracking of all ETH balance changes
  • Stateless, offline, curve-based transaction construction (with address checksum validation)
  • Atomic balance lookups using go-ethereum's GraphQL Endpoint
  • Idempotent access to all transaction traces and receipts

Development

Helpful commands for development:

Install dependencies

make deps

Run Tests

make test

Lint the Source Code

make lint

Security Check

make salus

Build a Docker Image from the Local Context

make build-local

Generate a Coverage Report

make coverage-local

Image Installation

Running the following commands will create a Docker image called mesh-ethereum:latest.

Installing from GitHub

To download the pre-built Docker image from the latest release, run:

curl -sSfL https://raw.githubusercontent.com/coinbase/mesh-ethereum/master/install.sh | sh -s

Do not try to install mesh-ethereum using GitHub Packages!

Installing from Source

After cloning this repository, run:

make build-local

Configuring the Environment Variables

Required Arguments

MODE Type: String Options: ONLINE, OFFLINE Default: None

MODE determines if Mesh can make outbound connections.

NETWORK Type: String Options: MAINNET, ROPSTEN, RINKEBY, GOERLI or TESTNET Default: ROPSTEN, but only for backwards compatibility if you use TESTNET

NETWORK is the Ethereum network to launch or communicate with.

PORT Type: Integer Options: 8080, any compatible port number Default: None

PORT is the port to use for Mesh.

Optional Arguments

GETH Type: String Options: A node URL Default: None

GETH points to a remote geth node instead of initializing one

SKIP_GETH_ADMIN Type: Boolean Options: TRUE, FALSE Default: FALSE

SKIP_GETH_ADMIN instructs Mesh to not use the geth admin RPC calls. This is typically disabled by hosted blockchain node services.

Run Docker

Running the commands below will start a Docker container in detached mode, with a data directory at <working directory>/ethereum-data and the Mesh API accessible at port 8080.

Example Commands

You can run these commands from the command line. If you cloned the repository, you can use the make commands shown after the examples.

Mainnet:Online

Uncloned repo:

docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 30303:30303 mesh-ethereum:latest

Cloned repo:

make run-mainnet-online

Mainnet:Online (Remote)

Uncloned repo:

docker run -d --rm --ulimit "nofile=100000:100000" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -e "GETH=<NODE URL>" -p 8080:8080 -p 30303:30303 mesh-ethereum:latest

Cloned repo:

make run-mainnet-remote geth=<NODE URL>

Mainnet:Offline

Uncloned repo:

docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=MAINNET" -e "PORT=8081" -p 8081:8081 mesh-ethereum:latest

Cloned repo:

make run-mainnet-offline

Testnet:Online

Uncloned repo:

docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/data" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -p 8080:8080 -p 30303:30303 mesh-ethereum:latest

Cloned repo:

make run-testnet-online
// to send some funds into your testnet account you can use the following commands
geth attach http://127.0.0.1:8545
> eth.sendTransaction({from: eth.coinbase, to: "0x9C639954BC9956598Df734994378A36f73cfba0C", value: web3.toWei(50, "ether")})

Testnet:Online (Remote)

Uncloned repo:

docker run -d --rm --ulimit "nofile=100000:100000" -e "MODE=ONLINE" -e "NETWORK=TESTNET" -e "PORT=8080" -e "GETH=<NODE URL>" -p 8080:8080 -p 30303:30303 mesh-ethereum:latest

Cloned repo:

make run-testnet-remote geth=<NODE URL>

Testnet:Offline

Uncloned repo:

docker run -d --rm -e "MODE=OFFLINE" -e "NETWORK=TESTNET" -e "PORT=8081" -p 8081:8081 mesh-ethereum:latest

Cloned repo:

make run-testnet-offline

Test the Implementation with mesh-cli

To validate mesh-ethereum, install mesh-cli and run one of the following commands:

  • mesh-cli check:data --configuration-file mesh-cli-conf/testnet/config.json - This command validates that the Data API implementation is correct using the ethereum testnet node. It also ensures that the implementation does not miss any balance-changing operations.
  • mesh-cli check:construction --configuration-file mesh-cli-conf/testnet/config.json - This command validates the Construction API implementation. It also verifies transaction construction, signing, and submissions to the testnet network.
  • mesh-cli check:data --configuration-file mesh-cli-conf/mainnet/config.json - This command validates that the Data API implementation is correct using the ethereum mainnet node. It also ensures that the implementation does not miss any balance-changing operations.

Read the How to Test your Mesh Implementation documentation for additional details.

Contributing

You may contribute to the mesh-ethereum project in various ways:

Read our Contributing documentation for more information.

You can also find community implementations for a variety of blockchains in the mesh-ecosystem repository.

Documentation

You can find the Mesh API documentation here.

Check out the Getting Started section to start diving into Mesh.

Related Projects

  • mesh-geth-sdk — This SDK helps accelerate Mesh API implementation on go-ethereum based chains.
  • mesh-sdk-go — The mesh-sdk-go SDK provides a collection of packages used for interaction with the Mesh API specification.
  • mesh-specifications — Much of the SDKs’ code is generated from this repository.
  • mesh-cli — Use the mesh-cli tool to test your Mesh API implementation. The tool also provides the ability to look up block contents and account balances.

Other Implementation Samples

You can find community implementations for a variety of blockchains in the mesh-ecosystem repository.

License

This project is available open source under the terms of the Apache 2.0 License.

© 2022 Coinbase

mesh-ethereum's People

Contributors

akramhussein avatar dependabot[bot] avatar dvc94ch avatar jimni1222 avatar ningcb avatar patrick-ogrady avatar racbc avatar riyasattalukder avatar roberto-bayardo avatar shrimalmadhur avatar thepabloaguilar avatar viveksb007 avatar xiaying-peng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mesh-ethereum's Issues

Implement mempool endpoint

Is your feature request related to a problem? Please describe.
It doesn't support querying tx pool

Describe the solution you'd like
Implement rosetta mempool endpoint

Question: Does GraphQL necessarily needed?

I've seen below comments and have a question here.
https://github.com/coinbase/rosetta-ethereum/blob/23561f903bc93d4fa97bebc1fbbe4c7e5b374e5e/ethereum/client.go#L1404-L1410

Actually we can get the balance atomically using ONLY RPC call.
As you can see https://eth.wiki/json-rpc/API#eth_getbalance, eth_getBalance accept second parameter as block number.

If we need to query using block hash,

  • get block by hash and extract block number
  • and use eth_getBalance using block number

The benefit of graphQL here is "it can replace the possible multiple RPC calls to one graphQL call".
So in my opinion, we don't have to use graphQL necessarily (the comment includes "MUST" keyword).

I just wondered MUST keyword at that comment.

makefile target build-local fails

in trying to workaround Issue #164, building the image from source fails

make build-local
docker build -t rosetta-ethereum:latest .
[+] Building 93.7s (17/24)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2.65kB 0.0s
=> [internal] load .dockerignore 0.0s
=> => transferring context: 63B 0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04 2.9s
=> [auth] library/ubuntu:pull token for registry-1.docker.io 0.0s
=> [internal] load build context 0.5s
=> => transferring context: 5.65MB 0.4s
=> [golang-builder 1/6] FROM docker.io/library/ubuntu:20.04@sha256:db8bf6f4fb351aa7a26e27ba2686cf35a6a409f65603e59d4c203e58387dc6b3 4.2s
=> => resolve docker.io/library/ubuntu:20.04@sha256:db8bf6f4fb351aa7a26e27ba2686cf35a6a409f65603e59d4c203e58387dc6b3 0.0s
=> => sha256:758cd4ebb2178eb0cd2ce78dea8ffad569f5bba415c4b33b694e891e7697e854 2.32kB / 2.32kB 0.0s
=> => sha256:8659cf1709ef03be2c0b2dc339b19432bff8a0753d2d7d53f47272f098f56ef4 25.97MB / 25.97MB 1.2s
=> => sha256:db8bf6f4fb351aa7a26e27ba2686cf35a6a409f65603e59d4c203e58387dc6b3 1.13kB / 1.13kB 0.0s
=> => sha256:144e6a778925a0c11c4cd9fe5fce1172e620f215b0410bb43e7fa41bbcfe4522 424B / 424B 0.0s
=> => extracting sha256:8659cf1709ef03be2c0b2dc339b19432bff8a0753d2d7d53f47272f098f56ef4 2.2s
=> [stage-3 2/8] RUN apt-get update && apt-get install -y ca-certificates && update-ca-certificates 13.6s
=> [golang-builder 2/6] RUN mkdir -p /app && chown -R nobody:nogroup /app 0.9s
=> [golang-builder 3/6] WORKDIR /app 0.0s
=> [golang-builder 4/6] RUN apt-get update && apt-get install -y curl make gcc g++ git 49.4s
=> [stage-3 3/8] RUN mkdir -p /app && chown -R nobody:nogroup /app && mkdir -p /data && chown -R nobody:nogroup /data 0.5s
=> [stage-3 4/8] WORKDIR /app 0.0s
=> [golang-builder 5/6] RUN curl -fsSL "https://golang.org/dl/go1.16.8.linux-amd64.tar.gz" -o golang.tar.gz && echo "f32501aeb8b7b723bc7215f6c373abb6981bbc7e1c7b44e9f07317e1a3 34.4s
=> [golang-builder 6/6] RUN mkdir -p "/go/src" "/go/bin" && chmod -R 777 "/go" 1.0s
=> CANCELED [geth-builder 1/3] RUN git clone https://github.com/ethereum/go-ethereum && cd go-ethereum && git checkout 20356e57b119b4e70ce47665a71964434e15200d 0.7s
=> [rosetta-builder 1/3] COPY . src 0.2s
=> ERROR [rosetta-builder 2/3] RUN cd src && go build 0.4s

[rosetta-builder 2/3] RUN cd src && go build:
#0 0.328 qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

ERROR: failed to solve: executor failed running [/bin/sh -c cd src && go build]: exit code: 255
make: [build-local] Error 1

unable to download pre-built image per instructions

this looks like Issue #108 that was closed has not been solved.

the command does download something, but, the image is not in my docker image cache

curl -sSfL https://raw.githubusercontent.com/coinbase/rosetta-ethereum/master/install.sh | sh -s coinbase/rosetta-ethereum info checking GitHub for latest tag coinbase/rosetta-ethereum info found version: v0.0.6 coinbase/rosetta-ethereum info downloading image into /var/folders/yc/z1w_3lgd2s980x8105lbyqxr0000gn/T/tmp.JG1wff13

Update README file

Describe the bug
Readme file is hard to read

To Reproduce
Steps to reproduce the behavior:

  • Read the README file and try to understand it.

Expected behavior

  • Read the README file and understand it.

Run rosetta-cli check:data failed

Use the latest version docker image download from rosetta-ethereum repository. Run the mainnet can't pass rosetta-cli check:data

Run with mainnet online mode

docker run -d --rm --ulimit "nofile=100000:100000" -v "$(pwd)/ethereum-data:/data" -e "MODE=ONLINE" -e "NETWORK=MAINNET" -e "PORT=8080" -p 8080:8080 -p 30303:30303 rosetta-ethereum:latest

Check with this command

rosetta-cli check:data --configuration-file rosetta-cli-conf/mainnet/config.json

It is failed

Screen Shot 2021-12-21 at 5 16 45 PM

Screen Shot 2021-12-21 at 5 16 53 PM

Missing `balance_exemptions` in `/network/options` -> `allow`

Hi team,

According to https://github.com/coinbase/rosetta-specifications/blob/master/models/Allow.yaml#L28,

The balance_exemptions is required in the Options's Allow entity. The field is missing in the following service implementation:

https://github.com/coinbase/rosetta-ethereum/blob/master/services/network_service.go#L65

Note that BalanceExemption could be an empty object!

There is a bit of inconsistency. 2 possible fixes:

  • Fix the service by adding balance_exemptions. That field could even be an empty object.
  • Remove balance_exemptions from required in the openapi spec.

I know that in general, this is not a big issue, a client app can just ignore the missing balance_exemptions. In my case, I'm using generated typescript clients using openapi generator. The parser breaks the whole call because it expects the field to be present.

Thanks!
Fernando

Example for Combine request

Hi, can you provide an example on how to generate the signature for the Combine call?

Here's the reference code:

combineResp, rosettaErr, err := client.ConstructionAPI.ConstructionCombine(
  context.Background(),
  &types.ConstructionCombineRequest{
    NetworkIdentifier:   netID, 
    UnsignedTransaction: payloadsResp.UnsignedTransaction,
    Signatures: []*types.Signature{
      {
        Bytes: signature, // <- how is this generated?
        PublicKey: &types.PublicKey{
          Bytes:     publicKey, // <- generated by crypto.CompressPubkey(&privateKey.PublicKey)
          CurveType: types.Secp256k1,
        },
        SigningPayload: payloadsResp.Payloads[0],
        SignatureType:  types.EcdsaRecovery,
      },
    },
  },
)

Im interested in part where Bytes: signature is used. Any ideas?

[Ropsten] Unable to Get Traces

When running rosetta-ethereum on Ropsten, I ran across an error where I could not get traces for certain blocks:
image

This is 99% likely to be caused by too short of a trace timeout and/or geth response timeout (where response time is elevated due to concurrent fetches).

Add CI test using rosetta-cli to run on each PR

Is your feature request related to a problem? Please describe.
Right now we don't run rosetta-cli with any PR. Would be good to run some basic rosetta cli check, if not the data check which can take time (unless we can have a dummy network which can mimic the actual and be fast)

Describe the solution you'd like
Add CI test using rosetta-cli to run on each PR (likely on a regtest network)

Unreviewed commit on master!

Unreviewed commit(s) COMPARE was merged to master by patrick-ogrady.

Comment with appropriate number of 👍 to approve.


Reviewed requirements satisfied? No
Ancestors reviewed? Yes

Change the name of `Blockchain` and `Network` fields to be lowercase to match bitcoin-rosetta, celo-rosetta etc

Is your feature request related to a problem? Please describe.

Other Rosetta implementations use lowercase blockchain and network names. E.g. bitcoin and mainnet or celo and 44787. The ethereum implementation uses Titlecase not but I can't find a good reason why..

Describe the solution you'd like

  • Change the blockchain name internally to ethereum
  • Change the network names to be lowercase e.g. mainnet, testnet, ropsten, rinkeby and goerli

Describe alternatives you've considered

  • Lowercasing the network identifier values and re-titlecasing them - adds a lot of cruft

Additional context

  • This is about making it consistent with other implementations
  • Happy to create a PR for this

Implement `/mempool/transaction` endpoint

Is your feature request related to a problem? Please describe.

Currently rosetta-ethereum does not support querying transaction in a mempool.

Describe the solution you'd like

Implementation of /mempool/transaction as described here

geth is using huge disk space on testnet

Running eth node with MODE: ONLINE and NETWORK: TESTNET (Ropsten)
ends up with humungous (787GB) amount of disk space usage.

Is this expected behaviour? Considering the Ropsten size is around 60GB

image_2020-11-17_14-10-53

construction/payloads: `Input` should be `Data` to match geth `eth` namespace RPC specification

Describe the bug

https://github.com/coinbase/rosetta-ethereum/blob/52fe4d87715b6ea13471acf3d68fe4a6de3bcf2d/services/construction_service.go#L268

The geth eth namespace RPC spec states that there should be a data field not input.

input is the return valueof signing anunsigned_transaction`

The payload returned by this cannot be passed to a signer as they all expect data.

To Reproduce

Call construction/payloads endpoint

Expected behavior

unsigned_transaction.input field to be unsigned_transaction.data

Additional context

ERC-20 tokens support

Is it possible to transfer ERC-20 tokens using the construction API of the rosetta-ethereum implementation?

Incorrect Mining Reward for Genesis Block

Describe the bug
I believe the miningReward calculation for the genesis block (height = 0) is possibly incorrect

https://github.com/coinbase/rosetta-ethereum/blob/79a9b97d0a3ed08ae151a3f313aa57b88dd128a4/ethereum/client.go#L971-L976

To Reproduce

curl -XPOST --head localhost:8080/block -d'{                                                                                                                                                            
  "network_identifier": {
    "blockchain": "Ethereum",
    "network": "Mainnet"
  },
  "block_identifier": {
    "index": 0
  }
}'

Expected behavior

The mining reward for the genesis block is 5 ETH. that is according to https://etherscan.io/block/0

Additional context

If this is expected, then that is fine by me too! just checking here because etherscan and rosetta mismatch here. thanks!

Move from CircleCI to Github Actions

Move from CircleCI to Github Actions.

CircleCI is not triggering CI automatically. (some hacks like closing and re-opening the PR are used to trigger CI)

Bug report: call tracer in rosetta-ethereum does not recognize internal error

Describe the bug
JS call tracer used by rosetta-ethereum cannot parse CALL which contains internal failed call(caused by failed CREATE opcode).
JS call tracer used by Geth works fine for same CALL.

TLDR
The trace result by JS call tracer (= callTracerLegacy) by Geth. Take a look calls field which contains internal calls in this tx.

  • There is no to field.
  • There is error field which contains error message.
{
  "type": "CALL",
  "from": "0xca7a99380131e6c76cfa622396347107aeedca2d",
  "to": "0xe213d8b68ca3d01e51a6dba669de59ac9a8359ee",
  "value": "0x0",
  "gas": "0x17c0a5e8",
  "gasUsed": "0x2888f",
  "input": "0x160d2ed00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000036d6f6d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036461750000000000000000000000000000000000000000000000000000000000",
  "error": "execution reverted",
  "time": "2.218877542s",
  "calls": [
    {
      "type": "CREATE",
      "from": "0xe213d8b68ca3d01e51a6dba669de59ac9a8359ee",
      "value": "0x0",
      "gas": "0xdb612228",
      "gasUsed": "0x20530",
      "input": "0x608060405234801561001057600080fd5b506040516103353803806103358339810180604052604081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8281019050602081018481111561006157600080fd5b815185600182028301116401000000008211171561007e57600080fd5b50509291906020018051906020019092919050505081600090805190602001906100a99291906100b8565b5080600181905550505061015d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100f957805160ff1916838001178555610127565b82800160010185558215610127579182015b8281111561012657825182559160200191906001019061010b565b5b5090506101349190610138565b5090565b61015a91905b8082111561015657600081600090555060010161013e565b5090565b90565b6101c98061016c6000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c01000000000000000000000000000000000000000000000000000000009004806306fdde0314610058578063262a9dff146100db575b600080fd5b6100606100f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a0578082015181840152602081019050610085565b50505050905090810190601f1680156100cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3610197565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561018f5780601f106101645761010080835404028352916020019161018f565b820191906000526020600020905b81548152906001019060200180831161017257829003601f168201915b505050505081565b6001548156fea165627a7a72305820f533e6576b68db195c74bfd2c7cf3342bed686f7be1afd2664c4fbd44a0198ee00290000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000036461750000000000000000000000000000000000000000000000000000000000",
      "error": "internal failure"
    }
  ]
}

BUT JS call tracer by rosetta-ethereum do wrong parse for this CALL like below.
image

To Reproduce

  1. Run local geth built by this repo.
  • I just added a line to trigger failed CREATE opcode by force.
  • Deploy bytecode 0x608060405234801561001057600080fd5b506108a1806100206000396000f3fe608060405234801561001057600080fd5b5060043610610069576000357c01000000000000000000000000000000000000000000000000000000009004806306fdde031461006e578063160d2ed0146100f1578063262a9dff14610257578063fcf5ed0614610275575b600080fd5b6100766102bf565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100b657808201518184015260208101905061009b565b50505050905090810190601f1680156100e35780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102556004803603608081101561010757600080fd5b810190808035906020019064010000000081111561012457600080fd5b82018360208201111561013657600080fd5b8035906020019184600183028401116401000000008311171561015857600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050919291929080359060200190929190803590602001906401000000008111156101c557600080fd5b8201836020820111156101d757600080fd5b803590602001918460018302840111640100000000831117156101f957600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019092919050505061035d565b005b61025f610462565b6040518082815260200191505060405180910390f35b61027d610468565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156103555780601f1061032a57610100808354040283529160200191610355565b820191906000526020600020905b81548152906001019060200180831161033857829003601f168201915b505050505081565b818160405161036b9061048e565b8080602001838152602001828103825284818151815260200191508051906020019080838360005b838110156103ae578082015181840152602081019050610393565b50505050905090810190601f1680156103db5780820380516001836020036101000a031916815260200191505b509350505050604051809103906000f0801580156103fd573d6000803e3d6000fd5b50600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550836000908051906020019061045492919061049b565b508260018190555050505050565b60015481565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6103358061054183390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106104dc57805160ff191683800117855561050a565b8280016001018555821561050a579182015b828111156105095782518255916020019190600101906104ee565b5b509050610517919061051b565b5090565b61053d91905b80821115610539576000816000905550600101610521565b5090565b9056fe608060405234801561001057600080fd5b506040516103353803806103358339810180604052604081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8281019050602081018481111561006157600080fd5b815185600182028301116401000000008211171561007e57600080fd5b50509291906020018051906020019092919050505081600090805190602001906100a99291906100b8565b5080600181905550505061015d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100f957805160ff1916838001178555610127565b82800160010185558215610127579182015b8281111561012657825182559160200191906001019061010b565b5b5090506101349190610138565b5090565b61015a91905b8082111561015657600081600090555060010161013e565b5090565b90565b6101c98061016c6000396000f3fe608060405234801561001057600080fd5b5060043610610053576000357c01000000000000000000000000000000000000000000000000000000009004806306fdde0314610058578063262a9dff146100db575b600080fd5b6100606100f9565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156100a0578082015181840152602081019050610085565b50505050905090810190601f1680156100cd5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100e3610197565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f01602080910402602001604051908101604052809291908181526020018280546001816001161561010002031660029004801561018f5780601f106101645761010080835404028352916020019161018f565b820191906000526020600020905b81548152906001019060200180831161017257829003601f168201915b505050505081565b6001548156fea165627a7a72305820f533e6576b68db195c74bfd2c7cf3342bed686f7be1afd2664c4fbd44a0198ee0029a165627a7a72305820ee16a4449d9a61a2f830b6eb4cabb3539fd5cc525ea6887595e1f11e684d976c0029. This can be obtained by compiling Mom contract.
  1. Call build with parameters. I already created encoded input 0x160d2ed00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000036d6f6d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036461750000000000000000000000000000000000000000000000000000000000, so you can send transaction like eth.sendTransaction({from: "0x<sender>", to: "0x<contractAddress>", input: <encodedInput>, gas: ...}).
  2. After you send transaction executing Mom.build method then you can trace it by using debug.traceBlockByHash.

Expected behavior
rosetta-ethereum must parse failed internal CALL (caused by failed CREATE opcode) and return block structure like below.
Below result is produced by fixed version of rosetta-ethereum by myself. Check this out. I only added 3 lines to call debug api for using Geth js call tracer.

Please check the below parsed CALL when use Geth js call tracer.

  • There is an error message and revert field is false. (CORRECT!)

image

The result of fetching block from rosetta-ethereum which uses Geth JS tracer is below(IT MUST BE RETURNED LIKE BELOW):

{
    "block": {
        "block_identifier": {
            "index": 10112,
            "hash": "0xcd9514963ee9e738af0ab76b6250ed8d3aaf7e81dd5824c6d418a12f2f82a2fa"
        },
        "parent_block_identifier": {
            "index": 10111,
            "hash": "0xf74fa2ba652500054c408392d8674119c86c10c64b8d911b7938b2813c7b7952"
        },
        "timestamp": 1651646778000,
        "transactions": [
            {
                "transaction_identifier": {
                    "hash": "0xcd9514963ee9e738af0ab76b6250ed8d3aaf7e81dd5824c6d418a12f2f82a2fa"
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "MINER_REWARD",
                        "status": "SUCCESS",
                        "account": {
                            "address": "0xcA7A99380131e6C76cfa622396347107aeEDCA2D"
                        },
                        "amount": {
                            "value": "2000000000000000000",
                            "currency": {
                                "symbol": "ETH",
                                "decimals": 18
                            }
                        }
                    }
                ]
            },
            {
                "transaction_identifier": {
                    "hash": "0xc32b05d2d9294b6105288af61fa8dac0b254d30def6dfd2def51b8be1825c743"
                },
                "operations": [
                    {
                        "operation_identifier": {
                            "index": 0
                        },
                        "type": "FEE",
                        "status": "SUCCESS",
                        "account": {
                            "address": "0xcA7A99380131e6C76cfa622396347107aeEDCA2D"
                        },
                        "amount": {
                            "value": "-186446000000000",
                            "currency": {
                                "symbol": "ETH",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 1
                        },
                        "related_operations": [
                            {
                                "index": 0
                            }
                        ],
                        "type": "FEE",
                        "status": "SUCCESS",
                        "account": {
                            "address": "0xcA7A99380131e6C76cfa622396347107aeEDCA2D"
                        },
                        "amount": {
                            "value": "186446000000000",
                            "currency": {
                                "symbol": "ETH",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 2
                        },
                        "type": "FEE",
                        "status": "SUCCESS",
                        "account": {
                            "address": "0xcA7A99380131e6C76cfa622396347107aeEDCA2D"
                        },
                        "amount": {
                            "value": "-1305122",
                            "currency": {
                                "symbol": "ETH",
                                "decimals": 18
                            }
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 3
                        },
                        "type": "CREATE",
                        "status": "FAILURE",
                        "account": {
                            "address": "0x0f8CF0bD26383587e1Cc3a54D64EA7746Ae7C580"
                        },
                        "metadata": {
                            "error": "internal failure"
                        }
                    },
                    {
                        "operation_identifier": {
                            "index": 4
                        },
                        "related_operations": [
                            {
                                "index": 3
                            }
                        ],
                        "type": "CREATE",
                        "status": "FAILURE",
                        "account": {
                            "address": "0x0000000000000000000000000000000000000000"
                        },
                        "metadata": {
                            "error": "internal failure"
                        }
                    }
                ],
                "metadata": {
                    "gas_limit": "0x7a120",
                    "gas_price": "0x3b9aca0e",
                    "receipt": {
                        "blockHash": "0xcd9514963ee9e738af0ab76b6250ed8d3aaf7e81dd5824c6d418a12f2f82a2fa",
                        "blockNumber": "0x2780",
                        "contractAddress": "0x0000000000000000000000000000000000000000",
                        "cumulativeGasUsed": "0x2d84e",
                        "gasUsed": "0x2d84e",
                        "logs": [],
                        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                        "root": "0x",
                        "status": "0x0",
                        "transactionHash": "0xc32b05d2d9294b6105288af61fa8dac0b254d30def6dfd2def51b8be1825c743",
                        "transactionIndex": "0x0",
                        "type": "0x2"
                    },
                    "trace": {
                        "calls": [
                            {
                                "error": "internal failure",
                                "from": "0x0f8cf0bd26383587e1cc3a54d64ea7746ae7c580",
                                "gas": "0x6ac01",
                                "gasUsed": "0x1fe22",
                                "input": "0x608060405234801561001057600080fd5b506040516103183803806103188339810180604052604081101561003357600080fd5b81019080805164010000000081111561004b57600080fd5b8281019050602081018481111561006157600080fd5b815185600182028301116401000000008211171561007e57600080fd5b50509291906020018051906020019092919050505081600090805190602001906100a99291906100b8565b5080600181905550505061015d565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100f957805160ff1916838001178555610127565b82800160010185558215610127579182015b8281111561012657825182559160200191906001019061010b565b5b5090506101349190610138565b5090565b61015a91905b8082111561015657600081600090555060010161013e565b5090565b90565b6101ac8061016c6000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806306fdde031461003b578063262a9dff146100be575b600080fd5b6100436100dc565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610083578082015181840152602081019050610068565b50505050905090810190601f1680156100b05780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6100c661017a565b6040518082815260200191505060405180910390f35b60008054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156101725780601f1061014757610100808354040283529160200191610172565b820191906000526020600020905b81548152906001019060200180831161015557829003601f168201915b505050505081565b6001548156fea165627a7a72305820a093ae8cb087f19f24d4f91e4ad2b4b63f3797de1b1b54517edeef2669b6366100290000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000036461750000000000000000000000000000000000000000000000000000000000",
                                "type": "CREATE",
                                "value": "0x0"
                            }
                        ],
                        "error": "execution reverted",
                        "from": "0xca7a99380131e6c76cfa622396347107aeedca2d",
                        "gas": "0x74a48",
                        "gasUsed": "0x28176",
                        "input": "0x160d2ed00000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000001400000000000000000000000000000000000000000000000000000000000000036d6f6d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000036461750000000000000000000000000000000000000000000000000000000000",
                        "time": "3.045584ms",
                        "to": "0x0f8cf0bd26383587e1cc3a54d64ea7746ae7c580",
                        "type": "CALL",
                        "value": "0x0"
                    }
                }
            }
        ]
    }
}

Additional context
I don't have an idea why rosetta-ethereum uses its own call tracer which seems not working correctly.

geth v1.10.x support

Describe the bug

go-ethereum v.1.10.0 introduces breaking changes to the GraphQL APIs:

GraphQL changes
We have made several backwards-incompatible changes to GraphQL APIs to better match the specification. In cases where the specification was vague, we have coordinated with the Besu development team to match their implementation.

  • Receipt status is now returned as an integer instead of a hex string. (#22187)
  • estimateGas and cumulativeGas queries now return an integer instead of a hex string. (#22126)
  • The gasLimit and gasUsed fields in responses are now integers instead of hex strings. (#21883)
  • Retrieving blocks by number now works correctly. (#22153)

To Reproduce

Steps to reproduce the behavior:

{
  "network_identifier": {
    "blockchain": "Ethereum",
    "network": "Mainnet",
    "metadata": {}
  },
  "account_identifier": {
    "address": "<address>",
    "metadata": {}
  },
  "metadata": {}
}
  • Will crash because number in response is returned as Int, not a string hash with the following response:
{
  "code": 2,
  "message": "geth error",
  "retriable": false,
  "details": {
    "context": "json: cannot unmarshal number into Go struct field .data.block.number of type string"
  }
}

Expected behavior

GraphQL based endpoints to not crash with casting errors.

Additional context

If you expose port 5454 and use the GraphQL UI endpoint and query something like:

{ 
	block(number: 96795){
		hash
		number
		account(address:"...") {
			balance
			transactionCount
			code
		}
	}
}

Response will be:

{
  "data": {
    "block": {
      "hash": "0xebab537d5d0fb5d561b9f164d5e911812a2ab4ff63fc59b28accfaf2be306246",
      "number": 123123123123,
      "account": {
        "balance": "0x0",
        "transactionCount": "0x0",
        "code": "0x"
      }
    }
  }
}

This shows that the issue is related to the GraphQL endpoint.

RFC: EIP-1559 vs EIP-3416 impact on Client Apps/Wallets

Dear Rosetta-Ethereum client devs, we are looking forward to improving the Market Fee on Ethereum blockchain. We are a couple of engineers proposing an EIP improvement based on EIP-1559. We estimate 1559 is great but we propose an improvement to:

  • further reduce the gas price volatility with a median function (on premium gas price on top of base fees);
  • reduce base fees volatility with an additive function (linear dynamic) instead of multiplicative (ie. exponential dynamic);
  • reduce the footprint of the changes on wallets and clients by maintaining the same tx format and UI.

I know you have probably expressed your opinion before but we will appreciate if you can leave a Support +1 , NotSupport -1, or NeedMoreInfo opinion or comments on the forums from client/wallet apps before the AllCoreDevs meeting this Friday:

Proposal:
https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3416.md
EIP-33416 proposal for London fork:
ethereum/pm#294
Discord (Fee Market):
https://discord.com/channels/595666850260713488/749160974506000444

UI Comparison Diagram:
image
Best,
HexZorro
image

Add XinFin-XDC Network support in Coinbase wallet

It will be great if Would you consider to Add ETH compatible DPOS chain (XinFin Network) support

XinFin Digital Contract or XDC — the XinFin network’s native crypto — is a one-stop solution that combines speed, scalability, and sustainability into an immaculate package. XDC is built on XinFin’s exclusive consensus mechanism — the XinFin Delegated Proof-of-Stake or XDPoS protocol that was specially developed to overcome the shortcomings of the technology that came before it.

Github:- https://github.com/XinFinOrg/XDPoSChain
CMC :- https://coinmarketcap.com/currencies/xinfin-network/
Circulating Supply:- https://explorerapi.xinfin.network/publicAPI?module=balance&action=getcirculatingsupply
Total Supply:- https://explorerapi.xinfin.network/publicAPI?module=balance&action=totalXDC
Docker FullNode:- https://github.com/xinfinorg/XinFin-Node
Integration Code example: https://xinfin.org/exchange-listing-resource

Technical Community Support available at:

Telegram Community: https://t.me/XinFinDevelopers
Slack Community: https://xinfin-public.slack.com/messages/CELR2M831/
Slack Invitation Link: https://launchpass.com/xinfin-public
Technical help Resource: http://howto.xinfin.org/

Hope you will revert soon.

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.