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

Framework
Description
Links

Hardhat

Flexible development environment with plugins

Truffle

Development environment with testing framework

Foundry

Fast Rust-based toolkit

Remix

Browser-based IDE

OpenZeppelin SDK

Secure contract development

Tenderly

Debugging and monitoring platform

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:

Hardhat Network - Built-in local network for Hardhat:

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

  1. Compile your contract to get bytecode and ABI

  2. Configure your deployment script with network settings

  3. Execute deployment transaction

  4. Contract receives an address on the blockchain

Deployment Tools

Tool
Description

Script-based deployment with plugins

Migration-based deployment

Browser-based deployment

Deployment with monitoring

Development Workflow

  1. Setup - Choose a framework and configure your project

  2. Write - Develop smart contracts in Solidity

  3. Compile - Generate bytecode and ABI

  4. Test - Run tests on local development network

  5. Deploy to Testnet - Test on public testnet

  6. Deploy to Mainnet - Final deployment

Further Reading

Last updated