provable-things / ethereum-bridge

Independent bridge to link any Ethereum network with the Provable engine
GNU Affero General Public License v3.0
206 stars 94 forks source link

Description

This tool enables any non-public blockchain instance to interact with the Oraclize service.

Please note that at this point this tool is still experimental and subject to change without notice.

Requirements

Note

(on Ubuntu)

run sudo apt-get install build-essential -y

You should run the following commands from within the ethereum-bridge folder.

Install

via git

git clone https://github.com/oraclize/ethereum-bridge.git
cd ethereum-bridge
npm install

via npm

npm install -g ethereum-bridge

How to use

You have 2 options:

After you have correctly deployed the address resolver and the connector on your blockchain you can load the previous instance using the --oar flag (with the latest oar address generated) or using --instance latest

if you are not using the deterministic OAR you also need to update your contract constructor with the new address resolver generated

see also optional flags

Active mode

ethereum-bridge -H localhost:8545 -a 1

(deploy contracts using the account 1 found on the localhost:8545 node)

Broadcast mode

Generate a new local address:

ethereum-bridge -H localhost:8545 --broadcast --new

(generate a new address locally and deploy contracts (txs broadcasted to localhost:8545 node))

or if you already have one or more account in your keys.json file:

ethereum-bridge -H localhost:8545 --broadcast -a 0

(load the first account in your keys.json file (index n.0) and deploy contracts (txs broadcasted to localhost:8545 node))

Add a custom address resolver

Add OAR = OraclizeAddrResolverI(EnterYourOarCustomAddress); to your contract constructor, example:

Where EnterYourOarCustomAddress is the address resolver generated when you have run the script

contract test() {
    ...

    function test() {
      // this is the constructor
      OAR = OraclizeAddrResolverI(0xf0f20d1a90c618163d762f9f09baa003a60adeff);
    }

    ...
}

Note: The address chosen will be used to deploy all the Oraclize contracts, make sure to not deploy contracts that use Oraclize on the same address.

How to update the bridge

If a new version is detected you can run npm run update to automatically donwload and install the latest version from github.

Optional flags