Skip to content
This repository has been archived by the owner on Sep 22, 2023. It is now read-only.

Run E2E PoC

Jonas Hals edited this page Jan 27, 2020 · 25 revisions

Run a Chainlink node

  1. Set up an .env file:
ROOT=/chainlink
LOG_LEVEL=debug
ETH_CHAIN_ID=3
MIN_OUTGOING_CONFIRMATIONS=2
LINK_CONTRACT_ADDRESS=0x20fe562d797a42dcb3399062ae9546cd06f63280
CHAINLINK_TLS_PORT=0
SECURE_COOKIES=false
ALLOW_ORIGINS=*
ETH_URL=wss://ropsten.infura.io/ws
  1. Start container: docker run -p 6688:6688 -v ./:/chainlink -it --env-file=.env smartcontract/chainlink local n

  2. Follow instructions given to set up an account

Add EI to Chainlink node

  1. Open docker container bash

  2. Authenticate with credentials created above

  3. Add EI with chainlink initiators create test-ei http://$EXTERNAL_INITIATOR_URL:PORT/jobs

Run External Initiator

It is recommended to get familiar with the External Initiator's run instructions before starting: https://github.com/smartcontractkit/substrate-adapter

The EI needs a Postgres database to run. By default, it expects to connect to postgres:password@localhost:5432/ei

  1. Install dependencies: go get

  2. Build executable: go build -o external-initiator

  3. Run EI using credentials generated above and Substrate node: ./external-initiator "{\"name\":\"substrate-node-1\",\"type\":\"substrate\",\"url\":\"ws://$YOUR_SUBSTRATE_NODE_IP:PORT/\"}" --ic_accesskey="$IC_ACCESSKEY" --ic_secret="$IC_SECRET" --ci_accesskey="$CI_ACCESSKEY" --ci_secret="$CI_SECRET"

Run Substrate Adapter

It is recommended to get familiar with the Substrate Adapter's run instructions before starting: https://github.com/smartcontractkit/substrate-adapter

  1. Install subkey

  2. Install dependencies: go get

  3. Build executable: go build -o substrate-adapter

  4. Set applicable environment variables

  5. Run with ./substrate-adapter

Add Substrate Adapter to Chainlink node

  1. Access the Chainlink node GUI at http://localhost:6688/

  2. Head over to Bridges and create new

  3. Give it the name "substrate" and enter the URL the adapter is listening on

Add test jobspec

  1. Create new job in the CL node GUI with the following jobspec:
{
  "initiators": [
    {
      "type": "external",
      "params": {
        "name": "test-ei",
        "endpoint": "substrate-node-1",
        "accountIds": [
          "$YOUR_SUBSTRATE_ADDRESS"
        ]
      }
    }
  ],
  "tasks": [
    {
      "type": "httpget"
    },
    {
      "type": "jsonparse"
    },
    {
      "type": "multiply"
    },
    {
      "type": "substrate"
    }
  ]
}

Send a request on-chain

Clone this wiki locally