Pre-General Availability: 2026-03-13

Install ERC-20 Smart Contracts

You can use the smart contracts provided with the platform to explore stablecoin and wholesale central bank digital currency (CBDC) scenarios.

The following instructions have been tested on macOS and Linux systems.
  1. Enter the following command to extract the ERC-20 package.
    unzip obp-da-erc20.zip -d <path/to/directory>
  2. Use nvm to install Node.js and npm. For best results, use Node.js version 20.17.0 and npm version 10.8.2.
    For more information about nvm, see Node Version Manager on GitHub.
  3. Run the following command to confirm that version 2.28.0 of Hardhat is installed.
    npx hardhat –version
  4. Navigate to the directory where you extracted the package, run the following command to compile the reference implementations of the smart contracts.
    npx hardhat clean & npx hardhat compile
  5. Run the following command to run unit tests on the contracts.
    npx hardhat test
  6. Deploy the wholesale CBDC reference implementation.
    1. Run the following commands to set the Hardhat configuration variables, as described in the following table.
      npx hardhat vars set BESU_CHAIN_ID <chain_id> 
      npx hardhat vars set BESU_RPC_URL <rpc_url> 
      npx hardhat vars set BESU_RPX_PROXY_AUTH_TOKEN "Bearer <auth-token>"  
      npx hardhat vars set BESU_ACCOUNTS <account keys> 
      npx hardhat vars set BESU_ALLOW_SELF_SIGNED <true or false> 
      Variable Description Default value
      BESU_CHAIN_ID Chain ID of the Besu network 1337
      BESU_RPC_URL URL of the RPC proxy with a passthrough endpoint http://127.0.0.1:8545
      BESU_RPX_PROXY_AUTH_TOKEN Auth token of the Oracle Blockchain Platform RPC proxy ''
      BESU_ACCOUNTS Account keys for deployment ""
      BESU_ALLOW_SELF_SIGNED Flag that allows Hardhat to communicate with Hyperledger Besu by using self-signed certificates without providing CA certificatess (NODE_TLS_REJECT_UNAUTHORIZED=0) true
      In the limited availability version of the platform, the contract is deployed by using the account keys that are configured in the Hardhat variable. Use one of the pre-funded account keys when you deploy.
    2. Run the following command to set the path for the OpenZeppelin manifest file, adjusting the path as needed for your system.
      export MANIFEST_DEFAULT_DIR=.openzeppelin/tests
    3. Run the Hardhat script to deploy the account and the wholesale CBDC smart contract.
      npx hardhat run scripts/deploy-wcbdc.ts –-network besu
      The script runs and shows the contract addresses for the account and the wholesale CBDC contract. Record the contract addresses and the OpenZeppelin manifest files for use when interacting with the contract via RPC proxy HTTP calls.
  7. Deploy the stablecoin reference implementation.
    1. Set the Hardhat configuration variables as described in the previous step.
    2. Run the following command to set the path for the OpenZeppelin manifest file, adjusting the path as needed for your system.
      export MANIFEST_DEFAULT_DIR=.openzeppelin/tests
    3. Run the Hardhat script to deploy the account and the stablecoin smart contract.
      npx hardhat run scripts/deploy-stablecoin.ts –-network besu
      The script runs and shows the contract addresses for the account and the wholesale CBDC contract. Record the contract addresses and the OpenZeppelin manifest files for use when interacting with the contract via RPC proxy HTTP calls.