Skip to main content
Version: 0.1

Configuration

bbachain-cli Configuration

To configure bbachain-cli, you need to create a configuration file. Follow the steps below:

  1. Create Configuration File: Create a file named config.json in your project directory.

  2. Add Configuration Options: Add the necessary configuration options to the config.json file. Below is an example configuration:

    {
    "network": "mainnet",
    "rpcUrl": "https://mainnet.bbachain.io",
    "privateKey": "your-private-key",
    "gasPrice": "20000000000",
    "gasLimit": "21000"
    }
  3. Environment Variables: Alternatively, you can set environment variables to override the configuration file options. The following environment variables are supported:

    • BBACHAIN_NETWORK: The network to connect to (e.g., mainnet, testnet).
    • BBACHAIN_RPC_URL: The RPC URL of the network.
    • BBACHAIN_PRIVATE_KEY: Your private key for signing transactions.
    • BBACHAIN_GAS_PRICE: The gas price to use for transactions.
    • BBACHAIN_GAS_LIMIT: The gas limit to use for transactions.
  4. Using the Configuration: Once the configuration file is set up, you can use bbachain-cli with the specified options. For example:

    bbachain-cli --config config.json

    Or, if using environment variables:

    export BBACHAIN_NETWORK=mainnet
    export BBACHAIN_RPC_URL=https://mainnet.bbachain.io
    export BBACHAIN_PRIVATE_KEY=your-private-key
    export BBACHAIN_GAS_PRICE=20000000000
    export BBACHAIN_GAS_LIMIT=21000

    bbachain-cli

Make sure to keep your private key secure and never expose it in your code or configuration files.