Development
Frameworks, development networks, compiling, and deploying smart contracts.
This guide covers the development workflow for smart contracts on MAPO-Relay-Chain, including frameworks, local development networks, compilation, and deployment.
Development Frameworks
Building a complete decentralized application requires different technologies. Frameworks provide the features you need or a plugin system to select tools.
Framework Features
Local blockchain for development
Smart contract editing and testing utilities
Client-side application development integration
Network connection and contract deployment configuration
IPFS integration for decentralized storage
Popular Frameworks
Development Networks
When developing smart contracts, you may want to test locally before deploying to a public network. Development networks offer faster iteration than public testnets.
Public Testnets
MAPO maintains public testnets for testing before mainnet deployment.
Local Development Tools
Ganache - Part of the Truffle suite, provides a personal blockchain for development:
Desktop application (Ganache UI) and CLI (
ganache-cli)
Hardhat Network - Built-in local network for Hardhat:
Deploy contracts, run tests, debug code
Compiling Contracts
The EVM runs bytecode, so Solidity contracts must be compiled before deployment.
Compilation Process
Solidity source code:
Compiles to EVM bytecode:
Application Binary Interface (ABI)
The compiler also produces the ABI - a JSON file describing the contract's functions. This allows web applications to interact with the contract.
JavaScript client libraries read the ABI to call contract functions from web applications.
Deploying Contracts
To deploy a smart contract, send a transaction containing the compiled bytecode without specifying a recipient.
Requirements
Contract bytecode - Generated through compilation
MAPO coins for gas - Deployment requires more gas than simple transfers
Deployment script or plugin - Automates the deployment process
Access to a MAPO node - Run your own or connect to a public node
Deployment Steps
Compile your contract to get bytecode and ABI
Configure your deployment script with network settings
Execute deployment transaction
Contract receives an address on the blockchain
Deployment Tools
Development Workflow
Setup - Choose a framework and configure your project
Write - Develop smart contracts in Solidity
Compile - Generate bytecode and ABI
Test - Run tests on local development network
Deploy to Testnet - Test on public testnet
Deploy to Mainnet - Final deployment
Further Reading
Last updated