RADAR RELAY V2

We’ve updated to 0x V2.See what changed.

Ethereum Nodes

Access to an Ethereum gateway is required to use the Trading APIs. Users may operate their own Ethereum gateway by running a local Ethereum node or may rely on a public Ethereum gateway such as Infura.

Local Node

A local Ethereum node connects to the Ethereum network, maintains a copy of some or all of the Ethereum blockchain, and provides an HTTP, websocket, or IPC interface for reading Ethereum state information and sending transactions. A local node provides access to Ethereum without trusting a third-party service provider.

The dominant node clients are Go-Ethereum ("Geth") by the Ethereum Foundation and Parity Node ("Parity") by Parity.io; both clients offer operating modes with different feature sets, performance characteristics, and resource (hard drive space, network bandwidth) requirements.

Setting up an Ethereum Node

You will need about 100 gigabytes of hard drive storage to store the full Ethereum mainnet blockchain. If you want to test on the Kovan testnet, it will require an additional 50 gigabytes of hard drive storage.

Parity

Install Parity

brew install parity

or install the snap package:

sudo snap install parity

or download the latest release for your platform,

or follow the instructions to build from source.

Run Parity Node

parity --jsonrpc-hosts=all \
       --jsonrpc-interface=all \
       --ws-origins=all \
       --ws-hosts=all \
       --ws-interface=all \
       --chain=mainnet \
       --base-path /path/for/ethereum_node_data

(use --chain=kovan to run the Kovan testnet)

Geth

Install the latest version of Geth for your platform.

Full Archive Node

Running a full archive node will allow for you to obtain the maximum amount of information from the Ethereum blockchain, however, this can often take a full week to fully sync.

geth --gcmode=archive --syncmode=full

Light nodes

A light node allows interaction with the Ethereum blockchain without downloading the entire blockchain. A light node performs worse than a full node, so at this time a light node is not recommended for automated trading.

geth --cache 1024 --v5disc --rpc --syncmode fast --gcmode full

run geth --help for the full configuration options.

Infura

Infura provides a public HTTP interface for reading Ethereum state information and sending transactions. Infura’s free public API removes the need to run a local node, at the cost of trusting Infura to provide truthful Ethereum state information, to properly relay your transactions to the rest of the network, and to manage your personal information (Ethereum address, IP address, web3 applications used) appropriately. Infura is recommended for testing and resource-restricted environments.

Sign up for a free Infura API key: https://infura.io/signup. Infura will work without an API key, but Infura claims that requests without a key are throttled more aggressively.

Unlocked Local Nodes

A local unlocked account may be used to connect and execute Ethereum transactions if no other option is available. Warning: running an unlocked account can be dangerous as it exposes access to your Ethereum account.

NOTE: This should only be done in a secure isolated environment (behind a firewall).

  1. Create a trading Account

Your account will create a private key and address for you on the blockchain. This is how you will interact with your assets.

parity account new
~enter password (don't lose this)
  1. Add funds

Once you have an account you need to send funds to it to start trading.

  1. Unlock The Account

Unlocking your account will allow you to expose your information and interactions with your account locally.

Example:

Creating a Parity Node Config File: /path/to/parity-config.toml

[account]
unlock = ["0x000000000000000000000000000000000000"] (account address created above)
password = ["/home/{account}/.parity-account-pass"] (password saved in plain text)

Run Parity with Unlocked Account

parity --jsonrpc-hosts=all \
       --jsonrpc-interface=all \
       --ws-origins=all \
       --ws-hosts=all \
       --ws-interface=all \
       --chain=mainnet \
       --config /path/to/parity-config.toml \
       --base-path /path/for/ethereum_node_data

Reading and Writing Ethereum with JSONRPC

Reading From Ethereum

Reading data from Ethereum is free and only requires access to an Ethereum gateway—private keys, addresses, signing, and transactions aren’t needed.

To read data, send an HTTP POST request to the Ethereum gateway using a tool such as curl. Send requests to https://mainnet.infura.io/YOURAPIKEY for Infura or http://localhost:8545 for a local node:

$ curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1234}' https://mainnet.infura.io
{"jsonrpc":"2.0","id":1234,"result":"0x5732c4"}

ID: a request identifier for keeping track of which response goes with which request JSONRPC: specifies which version of the Ethereum JSONRPC standard is used METHOD: the Ethereum JSONRPC method to call

A complete list of JSONRPC methods: https://github.com/ethereum/wiki/wiki/JSON-RPC

Some JSONRPC Methods may not be available, depending on the public gateway or local node configuration.

Writing To Ethereum

To write to Ethereum and change its state, such as filling an order, you must create, sign, and send a transaction to the Ethereum network. This requires access to an Ethereum gateway and a private key with transaction-signing faculties and ether for paying transaction fees.

Ethereum Wallets

A private key provides access to the funds held in an Ethereum account and must be managed locally by the user to keep it secure. Software that provides key management and signing functions is called an "Ethereum wallet". Wallet software may be bundled with an Ethereum node as in Geth and Parity, or may instead connect to a local or public Ethereum gateway as in Metamask (a browser extension) and the Radar Relay SDK.

The Radar Relay SDK will create and manage a wallet for you. This is the recommended way to sign and broadcast transactions.

If you run a local node, you can use the node's integrated wallet functions to "unlock" an account that will automatically sign and send transactions. Warning: running an unlocked account can be dangerous as it exposes access to your Ethereum account. This should only be done in a secure isolated environment (behind a firewall). *See "Unlocked Local Nodes" above.