How do I use openzeppelin CLI with a Kaleido network?

OpenZeppelin is a very powerful and popular smart contract library, with high quality and secure Solidity code for implementing many types of Ethereum smart contracts like tokens, and role-based permissioning.

OpenZeppelin CLI is a useful tool to manage smart contracts life cycles. It integrates with the upgradable contracts library which makes it even more interesting to Solidity developers.

Due to the security protection on Kaleido blockchain nodes, all connections require authentication with the app credentials. This requires some custom coding to replace the simpleprotocol, host, portbased settings in the CLI's network definition.

Use the following technique innetwork.jsto create provider instances for the openzeppelin CLI to use:

const HttpProvider = require('web3-providers-http');
module.exports = {
  networks: {
    kaleido: {
      provider: new HttpProvider(process.env.ETH_URL),
      gasPrice: 0,
      networkId: '*'
    }
  }
};

The environment variableETH_URLmust be set to the full URL pointing to a Kaleido node, in the formathttps://username:password@hostname, that can be obtained from theConnectmenu of the target Kaleido node.

To try this out in a sample project, checkout this sample repository.

Was this article helpful?
0 out of 0 found this helpful