Configuration
bbachain-cli Configuration
To configure bbachain-cli, you need to create a configuration file. Follow the steps below:
-
Create Configuration File: Create a file named
config.jsonin your project directory. -
Add Configuration Options: Add the necessary configuration options to the
config.jsonfile. Below is an example configuration:{
"network": "mainnet",
"rpcUrl": "https://mainnet.bbachain.io",
"privateKey": "your-private-key",
"gasPrice": "20000000000",
"gasLimit": "21000"
} -
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.
-
Using the Configuration: Once the configuration file is set up, you can use
bbachain-cliwith the specified options. For example:bbachain-cli --config config.jsonOr, 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.