Truffle
Verify your SmartContract using Truffle
Verifying Contracts on Lumia Chain with Truffle
Truffle is a popular development framework for Ethereum and compatible networks like Lumia chain. It provides a convenient way to verify contracts directly from the command line interface (CLI) using the truffle-plugin-verify
plugin.
In this tutorial, we'll guide you through the process of verifying your contracts on the Lumia chain network using Truffle.
Prerequisites
Before getting started, ensure that you have the following:
Truffle installed globally:
npm install -g truffle
truffle-plugin-verify
plugin installed:npm install -g truffle-plugin-verify
A Lumia L2 Explorer API key
Lumia Chain Testnet
Let's start by verifying a contract on the Lumia chain Testnet. You can explore the Lumia chain Testnet Explorer to view verified contracts and transactions.
Open your Truffle configuration file (
truffle-config.js
) and add the following configuration:
module.exports = {
// ...
plugins: ['truffle-plugin-verify'],
api_keys: {
lumia_l2_explorer: 'YOUR_LUMIA_L2_EXPLORER_API_KEY',
},
networks: {
lumia_testnet: {
provider: () => new HDWalletProvider(mnemonic, 'https://testnet-rpc.lumia.org/'),
network_id: 1001,
timeoutBlocks: 200,
confirmations: 5,
},
},
// ...
};
Make sure
Deploy your contracts to the Lumia L2 Testnet:
truffle migrate --network lumia_testnet
Verify your contracts using the
truffle run verify
command:
truffle run verify ConvertLib MetaCoin --network lumia_testnet
Wait for the verification process to complete. Truffle will display a success message once the contracts are verified.
View your verified contracts on the Lumia chain Testnet Explorer.
Lumia Chain Mainnet
To verify your contracts on the Lumia chain Mainnet, follow these steps:
Update your Truffle configuration file (
truffle-config.js
) with the Lumia chain Mainnet settings:
module.exports = {
// ...
plugins: ['truffle-plugin-verify'],
api_keys: {
lumia_l2_explorer: 'YOUR_LUMIA_L2_EXPLORER_API_KEY',
},
networks: {
lumia_mainnet: {
provider: () => new HDWalletProvider(mnemonic, 'https://mainnet.lumia.org'),
network_id: 8888,
timeoutBlocks: 200,
confirmations: 5,
},
},
// ...
};
Replace 'YOUR_LUMIA_L2_EXPLORER_API_KEY'
with your actual Lumia chain Explorer API key.
Deploy your contracts to the Lumia chain Mainnet:
truffle migrate --network lumia_mainnet
Verify your contracts using the
truffle run verify
command:
truffle run verify ConvertLib MetaCoin --network lumia_mainnet
Wait for the verification process to complete. Truffle will display a success message once the contracts are verified.
View your verified contracts on the Lumia chain Mainnet Explorer.
If you encounter any issues during the verification process, feel free to reach out to the Lumia chain community on Discord for assistance.
By following this tutorial, you can easily verify your contracts on the Lumia chain network using Truffle, enhancing the transparency and trust in your decentralized applications.
Last updated
Was this helpful?