GMP API Onboarding Overview

There are two components to onboarding your stack to using the GMP API:

Authentication

Access to the GMP API will be permissioned across all environments and requires a certificate to access any of the API endpoints. The API will be using mTLS authentication, so each partner building a chain integration that desires to leverage the GMP API will require certificates issues by us for each integration.

To authenticate, please do the following:

  1. Generate a CSR and send it to the Interop Labs team, e.g. using a command like this:
openssl req -new -newkey rsa:4096 -keyout client.key -out client.csr -nodes -subj '/CN=<ChainName>/OU=devnet/O=<PartnerName>'

Where:

Once you send us your CSR, we will generate a certificate and send it back to you to use in any of your requests, and any call to any of the API’s endpoints must be secured by that certificate, e.g.

const dotenv = require('dotenv');
const https = require('https');

// Load environment variables from .env file
dotenv.config();

// Load the certificate and key
const cert = fs.readFileSync(process.env.CRT_PATH);
const key = fs.readFileSync(process.env.KEY_PATH);
const gmpAPIURL = process.env.GMP_API_URL;
const httpsAgent = new https.Agent({
    cert,
    key,
});

// query the task GET endpoint

  const latestTask = "01924dc4-698e-7ad2-9f9b-0bad962771ef"; // just an example

  let urlSuffix = '';

  if (latestTask !== '') {
      urlSuffix = `?after=${latestTask}`;
  }
  
  const destinationChain = "CHAIN_B";

  const url = `${gmpAPIURL}/chains/${destinationChain}/tasks${urlSuffix}`;

  console.log('Polling tasks on:', url);

  try {
      const response = await axios({
          method: 'get',
          url,
          httpsAgent,
      });

      const tasks = response.data.tasks;

      if (tasks.length === 0) {
          console.log('No new tasks\\n');
          return;
      }

      for (const task of tasks) {
          await processTask(task, chainConfig, intervalId);
      }
  } catch (error) {
      console.error('Error:', error.message);
  }

Contract Whitelisting

Interop Labs also needs to whitelist the Amplifier contracts for your integration. Simply send us the following addresses for your chain