Skip to content

Consensys/tx-api-gw

Repository files navigation

tx-api-gw Actions Status License sonar-quality-gate sonar-coverage sonar-bugs sonar-vulnerabilities

Transaction API Gateway

Description

This module is a standalone HTTP service enabling to submit Ethereum transactions. Supported transactions are the following:

  • legacy Ethereum transactions
  • EIP-1559 Ethereum transactions

This component aims to help with the development of EIP-1559 since there are no wallet providers nor web3 libraries supporting new format transactions.

Don't use it in production and use only debug private keys.

The HTTP service accepts non signed Ethereum transactions and submit them to a configured Ethereum client. The process is the following:

  • receive Ethereum transactions parameter through the REST API
  • encode transactions according to RLP definition
  • sign transactions
  • submit transactions to the Ethereum client using eth_sendRawTransaction RPC endpoint

Installation

Install Prerequisites

  • Java 11

Build Instructions

./gradlew assemble

Usage

java -jar java -jar build/libs/tx-api-gw.jar --rpc-url=http://127.0.0.1:8545

OR

./gradlew bootRun --args="--rpc-url=http://127.0.0.1:8545"

Code Style

We use Google's Java coding conventions for the project. To reformat code, run:

./gradlew spotlessApply

Code style is checked automatically during a build.

API

Open API v3

Go to http://localhost:8080 to see the API definition in a web browser.

API docs specification are available at http://localhost:8080/v3/api-docs

Online version of the API can be found at http://eip1559-tx.ops.pegasys.tech:8080

Docker

Build image

Using plain docker file

docker build -t $IMAGE_NAME .

Using gradle task

./gradlew bootBuildImage --imageName=$IMAGE_NAME

Run container

docker run -p 8080:8080 -t $IMAGE_NAME

Use existing image

docker run -p 8080:8080 abdelhamidbakhtaconsensys/tx-api-gw:latest