ethers.js
, web3.js
, etc.
make it straightforward to configure this behavior. For the purpose of demonstration we’ll be using ethers.js
.
ethers.js
installed..env
files).package.json
to alllow for ESM modules..env
file with the following content:.env
file is listed in .gitignore
so it’s not checked into version control.
sendTransaction.js
file (for example) and load the environment variables using dotenv
. Initialize the provider with the peaq RPC endpoint and load the wallet from the environment variable.
gasLimit
in the transaction object. This ensures the transaction will revert if it exceeds the specified gas, protecting you from unexpected costs.
try/catch
block.
ethers.js
library,
explicitly setting a gas limit gives you fine-grained control over your transaction costs on the peaq network. With a carefully chosen gas limit, you can execute
transactions confidently, knowing you’re safeguarded against unexpected fee changes.