Home

Awesome

Ethereum tx sender

An interface for creating and sending transactions on the Ethereum Blockchain.

Ethereum dApps are applications which use the Ethereum Blockchain. These dApps need to automatically create and send blockchain transactions as an essential part of the user experience. Dynamically creating and sending blockchain transactions consistently is actually quite complex, with a number of challenging nuances. For example, sent transactions can be blocked, the nonce supplied by the user's wallet could be wrong, the gas settings need to be relatively reasonable, etc. These are essential things that every dApp developer needs to address.

The purpose of this system is to provide a ready-to-use interface for creating and sending transactions on Ethereum, allowing developers to focus on their core business logic rather than deal with blockchain complications.

Features:

Install & start ethereum-tx-sender

Prerequisites

The only required software to run the ethereum-tx-sender are docker and docker-compose.

If you don't already have them installed, you can follow this link to install them (free).

Start a local ethereum-tx-sender

  1. Clone this repo

    git clone https://github.com/hydroprotocol/ethereum-tx-sender.git
    
  2. Change your working directory

    cd ethereum-tx-sender
    
  3. Build and start

    docker-compose -f configs/docker-compose.yaml pull && docker-compose -f configs/docker-compose.yaml up -d
    

    This step may takes a few minutes. When complete, it will start all the necessary services.

    It will use ports 3000, 5432 and 8545 on your computer. Please make sure these ports are available.

  4. Check out your ethereum-tx-sender

    Open http://localhost:3000/ on your browser to access your ethereum-tx-sender

Send transaction by ethereum-tx-sender

ethereum-tx-sender comes with two interfaces: send_transaction and query_transaction. For more details see api doc.

  1. sending a transaction

    // send request 
    curl -X POST http://localhost:3000/launch_logs -d \
    '{
      "from": "0x31ebd457b999bf99759602f5ece5aa5033cb56b3",
      "to": "0x3eb06f432ae8f518a957852aa44776c234b4a84a",
      "value": "2000000000000000000",
      "data": [],
      "item_type": "engine",
      "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451221"
    }'
    
    // response
    {
      "status": 0,
      "desc": "success",
      "data": {
        "data": {
          "hash": "0x20f1b07522f385e84e8f75f99b3e2d7b22d915bc735824336d662bcbae7e542a",
          "item_type": "engine",
          "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451221",
          "status": 2,
          "gas_price": "13000000000",
          "gas_limit": "25200"
        }
      }
    }
    
  2. querying a transaction result

    // send request
    curl -X GET http://localhost:3000/launch_logs -d \
    '{
        "hash": "0x20f1b07522f385e84e8f75f99b3e2d7b22d915bc735824336d662bcbae7e542a",
     }'
    
    // response
    {
      "status": 0,
      "desc": "success",
      "data": {
        "data": [
          {
            "hash": "0x20f1b07522f385e84e8f75f99b3e2d7b22d915bc735824336d662bcbae7e542a",
            "item_type": "engine",
            "item_id": "7e36a266-1b32-4eaa-bc95-6d7b47451221",
            "status": 3,
            "gas_price": "13000000000",
            "gas_used": 21000,
            "executed_at": 1579542180
          }
        ]
      }
    }
    

Configurations

You can configure DATABASE_URL, ETHEREUM_NODE_URL, PRIVATE_KEYS environment variables as you need. For details see envs.md.

Notice

What next

Contributing

  1. Fork it (https://github.com/HydroProtocol/ethereum-tx-sender/fork)
  2. Create your feature branch (git checkout -b feature/fooBar)
  3. Commit your changes (git commit -am 'Add some fooBar')
  4. Push to the branch (git push origin feature/fooBar)
  5. Create a new Pull Request

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details