Smart Contract Overview
As a cheap, fast, and always functional blockchain (24/7 uptime 5 years running!), the AirDAO Network is an ideal place to develop decentralized applications (dApps) to power the Internet of Value. The following Gitbook documents the specifics of building on AirDAO complete with an overview of deploying smart contracts, using token faucets on test net, and leveraging the latest Dev tools!
Deploying Smart Contracts
AirDAO’s EVM compatibility with Ethereum (through the Constantinople Upgrade) means smart contract deployment is extremely similar. The AirDAO RPC as such is Ethereum compatible and supports all Ethereum JSON-RPC methods. This means that developers on AirDAO can leverage all Ethereum JSON-RPC methods without authentication.
Note: Upgrades on Ethereum from Istanbul onwards are NOT supported.
Access to different AirDAO Networks is outlined as follows:
MainNet
RPC Url: https://network.ambrosus.io/
Chain ID: 16718
TestNet
RPC Url: https://network.ambrosus-test.io
Chain ID: 22040
RPC Url: https://testnet-rpc.airdao.io/
DevNet
RPC Url: https://network.ambrosus-dev.io
Chain ID: 30746
RPC Url: https://devnet-rpc.airdao.io/
In line with Ethereum Smart Contract deployment guidelines, AirDAO developers must be attentive to using the correct RPC endpoint and supported EVM version (up through Constantinople on AirDAO). As noted in the Fundamentals of AirDAO GitBook, the following frameworks can be used to deploy smart contracts on AirDAO:
With supporting Developer tools and Software Development Kits (SDKs):
The aforementioned tools and developer kits are equally compatible with AirDAO as they are with Ethereum. Importantly, developers on AirDAO will pay Gas fees in $AMB and route transactions through an Apollo Node, as opposed to the Ethereum equivalent.
Token Faucets
If you need to access TestNet or DevNet $AMB to test out an application, the following token faucets are readily available:
Testnet: https://faucet.ambrosus-test.io/
Devnet: https://faucet.ambrosus-dev.io/
To access the faucets a user must provide an address and then input the amount of testnet or devnet tokens needed.
Verifying Smart Contracts
The AirDAO Explorer - https://airdao.io/explorer/ - supports smart contract verification. All verified contracts have their source code and ABI displayed on the contract page with the user able to call contract methods directly from the explorer.
To verify a contract that you have deployed the following steps should be following:
Open your smart contract in the Ambrosus Explorer.
Visit the contract page by clicking the ‘contract’ tab and click the verify button.
Provide the Contract Artifact file. An example location for a Hardhat project: /artifacts/build-info/123abc456def789abc123def123abc45.json
Confirm Contract verification.
An alternative to this approach is to use the Sourcify API: https://sourcify.ambrosus.io/.
Troubleshooting Smart Contracts
In the event of a reverted transaction with no reason given, you may wish to troubleshoot what exactly went wrong. The following steps can be taken:
Use a static call (eth_call) method with the same parameters as the transaction you want to send. (An example using ethers.js is: yourContract.callStatic.yourMethodName(arg1, arg2, {from: sender, gasLimit: 0x1337, blockTag: 'latest'})
After using a static call method You probably will get the reverted reason but in hex format. An example would be: Reverted 0x08c379a0123abc123abc123abc
This Hex format can then be decoded using an online hex to string converter, or a code snippet as the following: https://github.com/authereum/eth-revert-reason/blob/e33f4df82426a177dbd69c0f97ff53153592809b/index.js#L93
Note: Currently, the AirDAO RPC doesn't return the ‘revert reason’ for the estimateGas method. This is a work in progress by AirDAO Core developers.
Last updated