relay

command module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

README

Relay Go Report Card GoDoc

Kvartalo relay

Usage

Create new wallet keystore:

./relay wallet new

Deploy the token smart contract:

./relay contracts token deploy

(For docs about how to build the Go code for token contract, see https://github.com/kvartalo/relay/tree/master/eth/token/README.md )

Set the config file ./config.yaml

keystorage:
        address: "0xaddress"
        password: "secretpassword"
        keyjsonpath: "./keystorage/keystoragepath"
server:
        Port: "portnumber"
web3:
        url: "web3gateway-url"
        startscanblock: fist-block-to-scan-transfer-txs

contracts:
        token: "0xdeployedAddr"
storage:
        path: ./databasepath

Run Relay

./relay start
Commands
# initializes the database
./relay init

# info about the relay address, eth and tokens
./relay info

# create new keystore
./relay wallet new

# info of the current keystores
./relay wallet info

# deploy the token smart contract
./relay contracts token deploy

# mint tokens that will go to the relay address
./relay contracts token mint [amount]

# transfer tokens to a specified address
./relay contracts token transfer [address] [amount]

# start the relay server
./relay start
API Endpoints
  • GET /balance/:addr

Returns:

{
  "addr": "0x104d6ea578124aa891163a0da51315cccc823939",
  "balance": "23300"
}
  • GET /history/:addr

Returns:

{
  "addr": "0x104d6ea578124aa891163a0da51315cccc823939",
  "count": 2,
  "transfers": [
    {
      "Timestamp": 1556194387,
      "From": "0x104d6ea578124aa891163a0da51315cccc823939",
      "To": "0x653ad143cd78e47db6846d1bd3cc0f69a6fb9225",
      "Value": 3000
    },
    {
      "Timestamp": 1556013327,
      "From": "0x104d6ea578124aa891163a0da51315cccc823939",
      "To": "0x3a05826f99a4ae1460e7c9b39d87dba74b09c3ad",
      "Value": 3000
    }
  ]
}
  • GET /tx/nonce/:addr

Returns:

{
  "addr": "0x104d6ea578124aa891163a0da51315cccc823939",
  "nonce": 11
}
  • POST /tx

Input:

{
  "from": "0x104d6ea578124aa891163a0da51315cccc823939",
  "to": "0x653ad143cd78e47db6846d1bd3cc0f69a6fb9225",
  "value": 3000,
  "r": "sig.r parameter in hex",
  "s": "sig.s parameter in hex",
  "v": 0
}

Returns:

{
  "ethTx": "0xtxhash"
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
eth

Jump to

Keyboard shortcuts

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