Skip to content
Davide Miceli edited this page Jan 29, 2019 · 2 revisions

Node.js SDK

To handle a chainode peer, there is also the javascript SDK.

Follow the example:

'use strict';

// Require chainode package
const Chainode = require('chainode');


// Run peer
const runPeer = async () => {
  try {
    // Configurations
    const configs = {...};
    // Init the peer
    const agent = new Chainode(configs);
    await agent.start();
    return agent;
  } catch(err) {
    console.error(err.message);
  }
}

// Start peer
runPeer()
  .then(peer => {
    // Do something with peer...
  })
  .catch(console.error);