geth-wrapper

command module
v0.0.0-...-4d27fde Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2022 License: MIT Imports: 13 Imported by: 0

README

Geth-wrapper

Go application that provides access to the Ethereum transaction system using the Geth node (go-ethereum).

The application uses the PostgresSQL database, which stores the following data:

  • Information on existing wallets on Geth node with the current balance.
  • Information on all withdrawal transactions with information about the purse from which the transfer was made.
  • Information about all transactions related to wallets on a Geth node, with the actual number of confirmations.

Geth

Method unlockAccount not implemented. Tested with the following settings Geth.

geth --rinkeby --gcmode=archive --rpc --rpcapi "eth,net,personal" --unlock 0xd1dffc3c0537d46cd65b10019d4216f9dcd7e114

Database preparation

psql -U postgres -f $GOPATH/src/github.com/dzeckelev/geth-wrapper/data/prepare.sql
psql -U postgres -d unionbase -f $GOPATH/src/github.com/dzeckelev/geth-wrapper/data/migrate.sql

Build

Dependencies are already in the repository.

cd $GOPATH/src/github.com/dzeckelev
git clone https://github.com/dzeckelev/geth-wrapper.git
cd geth-wrapper
go get -u -v gopkg.in/reform.v1/reform
go generate ./...
go install

Run

geth-wrapper -config config.json

API methods

Get Last Transactions

Returns information about the latest receipts for wallets. The latter are considered receipts that have not yet been requested by this method, or have <3 confirmation at the time of a request.

Arguments:

  • Limit: limits the number of transactions in a response.

Example:

curl -X POST -H "Content-Type: application/json" --data '{"method": "api_getLast", "params": [100], "id": 100}' http://localhost:8081/http
SendETH

Sends ETH from one of a unlocked wallet to the specified address.

Arguments:

  • From: sender address.
  • To: recipient address.
  • Amount: The amount of Wei sent with this transaction. (1 ETH = 10^18 Wei)
curl -X POST -H "Content-Type: application/json" --data '{"method": "api_sendETH", "params": ["0xd1dffc3c0537d46cd65b10019d4216f9dcd7e114", "0xd6d39cd7672841789dc3afb97525984b6d31f796", "1000000000000"], "id": 100}' http://localhost:8081/http

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL