📂 Guides > Smart Contracts Platform

# Self-serve Integration

Table of Contents

Assuming you have determined that your platform is compatible, you can attempt to do the integration yourself by following the steps below.

# Part 1: Protocol contract deployment

Replace parts starting with $

  1. Clone the Airnode monorepo (opens new window) (currently you need to use the pre-alpha branch)
git clone --single-branch --branch pre-alpha https://github.com/api3dao/airnode.git
1
  1. Install its dependencies and build it
cd airnode
yarn run bootstrap
yarn run build
1
2
3
  1. Go to the protocol package (opens new window)
cd packages/protocol
1
  1. Create a credentials.json file, similar to credentials.example.json (opens new window)
cp credentials.example.json credentials.json
1
  1. Add the following entry to credentials.json
"$CHAIN_NAME" :{
  "mnemonic": "$MNEMONIC",
  "providerUrl": "$PROVIDER_URL"
}
1
2
3
4

$CHAIN_NAME is the name that will be used to refer to your chain.

$MNEMONIC is the mnemonic of the wallet that you will use to deploy the protocol contracts. Make sure that it is funded (if applicable).

$PROVIDER_URL is the URL of the node JSON-RPC API you will use to deploy the protocol contracts.

  1. Add the following entry to hardhat.config.js (opens new window)
$CHAIN_NAME: {
      url: credentials.$CHAIN_NAME.providerUrl || '',
      accounts: { mnemonic: credentials.$CHAIN_NAME.mnemonic || '' },
    }
1
2
3
4
  1. Add the following script to package.json (opens new window)
"deploy:$CHAIN_NAME": "hardhat deploy --network $CHAIN_NAME"
1
  1. Finally, run the added script to deploy the contracts, which will record the deployment details including the contract address in the /deployments (opens new window) directory.
yarn run deploy:$CHAIN_NAME
1

If your chain has a customized flow for deploying contracts, you can find the bytecodes of the compiled contracts in the artifacts/ directory.

Note that you will need to deploy both Airnode.sol and Convenience.sol.

# Part 2: Make a test call

After completing Part 1, you must have two contract addresses, one for Airnode.sol and one for Convenience.sol. Now follow the steps below to make a test call:

  1. Clone the airnode-starter (opens new window) repo
git clone --single-branch --branch pre-alpha https://github.com/api3dao/airnode-starter.git
1
  1. Open the config.example.json (opens new window) file in config/. Replace the following values:

    • nodeSettings.chains.0.id: 3 -> The ID of your chain
    • nodeSettings.chains.contracts.Airnode: 0xF8d32C3e53F7DA6e7CB82323f2cAB2159776b832 -> The address of the Airnode.sol contract you have deployed
    • nodeSettings.chains.contracts.Convenience: 0x1552cF617711D6Da04E0EDC9e5C26eBbA08625ac -> The address of the Convenience.sol contract you have deployed
  2. Follow the instructions (opens new window) (both Step 1 and 2). Note that you can use the $MNEMONIC and the $PROVIDER_URL you have used while deploying the contracts in your .env file.

The final step of the instructions is to run the make-request script, which will make a request on your chain for the Airnode to fulfill it. This example project working as intended is a very good indicator that the integration has succeeded. After doing this, you are recommended to take a deep dive into our docs (opens new window) next to learn more about Airnode and its protocol.

Last Updated: 8/9/2022, 2:28:25 PM