Configuration with oapp-utils-bd
Setting up Blockdaemon-Animoca Oracle with your LayerZero Version 2 application.
Blockdaemon has developed a tool called oapp-utils-bd that facilitates the seamless setup of Animoca-Blockdaemon's Oracle for omnichain apps.
Check the detailed steps below for an in-depth guide:
Step 1: Requirements
- Get the oapp-utils-bd by downloading it from the GitHub repository.
- We recommend using NVM for node version management as this is a Typescript project that uses NPM as its package manager and node.
- Test the oapp-utils-bd using the provided mainnet chain. See the documentation for more information.
Step 2: Installing Node 21.5.0
Install Node v21.5.0 using NVM (Node Version Manager): nvm install 21.5.0 && nvm use 21.5.0
.
Step 3: Installing Dependencies
- Open a command line and navigate to the root of your project.
- Run the
npm install
command. This will download and install all dependencies listed in this project'spackage.json
file.
Step 4: Configuring a .env
File
.env
FileNote:
The
.env
file is storing sensitive information such as API keys and private keys. This file should never be shared or included in a public repository.
- Use the .env.example file as a template by copying the environment variables using the command
cp .env.example .env
. - Open the
.env.example
file in your code editor.
BLOCKDAEMON_API_KEY=
MNEMONIC=
OAPP_ADDRESS=
SOURCE_NETWORK="ethereum"
TARGET_NETWORK="polygon"
MESSAGE_LIB_ADDRESS=“0x6c26c61a97006888ea9e4fa36584c7df57cd9da3”
LOG_LEVEL="info"
You need to adjust the following variables:
Variables | Details |
---|---|
BLOCKDAEMON_API_KEY | Your Blockdaemon API key which available at app.blockdaemon.com. |
MNEMONIC | The private key for signing transactions. Ensure your wallet has sufficient balance to cover gas fees. |
OAPP_ADDRESS | The address of your LayerZero v2 application (OApp). Note: In the application, grant permission to modify Oracle to the public key corresponding to the mnemonic listed in the .env file. |
SOURCE_NETWORK | The network you are operating on. Note: Please ensure you choose the supported network. |
TARGET_NETWORK | The destination network you intend to interact with. Note: Please ensure you choose the supported network. |
MESSAGE_LIB_ADDRESS (Optional) | The message library address corresponds to the target network. Note: Please choose send302 for each network. You can find the options in the message library list. |
Step 5: Running the Script
- Save your changes to the
.env
file. - Run the main script using the
npx ts-node src/main/main.ts
command. This command starts the main TypeScript file for your application. - The script validates all environment variables in the
.env
file and establishes a connection with Blockdaemon-Animoca Oracle. - You can monitor the output on your command line as the script performs the necessary configuration and setup.
Step 6: Finalizing the Setup
- Once setup is complete, Blockdaemon-Animoca Oracle will appear in the terminal window as the Updated Oracle address.
- The wallet used for the transaction has a deducted balance to cover the gas fees.
- The application will be fully configured and connected to the Blockdaemon Oracle or LayerZero network.
👋 Need Help?
Contact us through email or our support page for any issues, bugs, or assistance you may need.
Updated 4 months ago