MAPO Developer Docs
  • MAPO Developer Docs
  • Base
    • MAPO Introduction
    • MAPO token
    • Omnichain DAPP
    • Differences Between Omnichain Applications and Single or Multi-Chain Applications
    • Differences Between Third-Party Trusted Cross-Chain and Peer-to-Peer Cross-Chain Solutions
    • BTC layer2
      • brc-201
    • Oracle
      • Supra: Decentralized Oracle on MAP Protocol
    • Account
    • Transactions
    • block
    • MPT tree
    • RLP
    • Gas fee
    • Cross Chain Message
    • light client
      • MAPO light client
    • MOS
      • MOS interface and functions
      • deploy MOS
      • Messenger
    • map-relay-chain(atlas)
      • atlas architecture
        • atlas architecture
        • atlas genesis
          • genesis config
          • genesis contract
            • ABI
              • Accounts
              • Election
              • EpochRewards
              • LockedGold
              • Validators
            • address
            • deploy
        • precompile-contract
        • protocol
          • Proof of Stake
          • consensus
          • election
          • rewards
          • governance
      • deploy atlas
        • run atlas
        • run atlas(archive)
        • run atlas(bootnodes)
        • run atlas(validator)
        • run atlas(RPC)
      • Marker tool
        • Genesis
        • Validator
        • Vote
        • Common
      • make private network(atlas)
      • public service
        • public network
      • example
        • how-to-vote
        • how-to-withdraw
        • how-to-become-a-new-validator
        • how-to-become-a-new-validator(advanced)
    • Compass(maintainer,messenger)
      • Compass - arch and model
      • Compass - config
      • Compass - deploy
      • Compass secondary development - define your own routing service based on compass
  • MAPO Stack
    • stack
      • Connected Chains and Corresponding Addresses
    • Compatible-EVM
      • Smart Contracts Language
      • Smart Contracts Anatomy
      • Smart Contracts Libraries
      • Smart Contracts Compile
      • Smart Contracts Testing
      • Smart Contracts Deploy
      • Smart Contracts Composability
      • Smart Contracts Security
      • Formal-Verification
      • Frameworks
      • dev-network
    • MAPO Implement Cross-chain Interoperability
      • integration of MAP with EVM-Compatible Chains
        • light client verify
        • light client update state
        • MOS
      • integration of MAP with TON Network
      • integration of MAP with Non-EVM-Compatible Chains
        • light client verify
        • light client update state
        • MOS
    • How to develop cross-chain applications
    • light client address
    • SDK/API
      • MOS interface
      • Light client interface
      • Atlas RPC
        • json-rpc
          • atlas json rpc
          • atlas consensus rpc
        • javaScript sdk
        • go-sdk
      • Backend API
        • SCAN API
  • Zero-Knowledge Proof
    • zk proof
Powered by GitBook
On this page
  • Introduction to Truffle
  • Project Setup
  • Initialize Truffle
  • Configure Deployment Settings
  • Update truffle-config.js File
  • Compile Contracts
  • Deploy Contracts
  • Deploy Validator-related Contracts
  1. Base
  2. map-relay-chain(atlas)
  3. atlas architecture
  4. atlas genesis
  5. genesis contract

deploy

Introduction to Truffle

Truffle is a world-class development environment, testing framework, and asset pipeline for building decentralized applications on the Ethereum Virtual Machine (EVM). By creating a Truffle project and configuring some settings, you can easily deploy your project on the Atlas chain.

To deploy using Truffle on the Atlas relay chain, you need to set up your local environment. If you don't want to deploy using a local environment, you can use Remix or Replit.

If you are new to Truffle, complete the quickstart tutorial to familiarize yourself with this tool.

Project Setup

Set up the project directory.

Open a terminal window, create a project directory, and navigate to that directory.

Initialize Truffle

Initializing Truffle will create a scaffold for your Truffle project.

truffle init

Configure Deployment Settings

The default truffle.config.js file contains the connection settings required for deployment to the Ethereum network, imports HDWalletProvider, and connects to the mnemonic in your .env file. To deploy to the Atlas network, you need to update this configuration file to point to the Atlas network and add some specifics for Atlas best practices.

Update truffle-config.js File

Open the truffle-config.js file in a text editor and configure its contents as shown in the example below:

module.exports = {
   networks: {
      atlas: {
         host: "https://rpc.maplabs.io",
         port: 7445,
         network_id: "22776"
      }
   }
}

Compile Contracts

truffle compile

Deploy Contracts

Deploy to the specified Atlas network using the following command:

truffle deploy --network atlas

Deploy Validator-related Contracts

First, you need to compile the atlas-contracts project. We need the bytecode of atlas-contracts to generate the genesis.json file.

  1. Download the atlas-contracts project in any folder using the following command: git clone https://github.com/mapprotocol/atlas-contracts.git

  2. Assuming you have node installed, switch to the project file, initialize the project, and use the following command: npm install

  3. Download Truffle using npm install truffle and compile the project using the Truffle compile command: truffle compile. After completion, a directory named "build" will be generated in your atlas-contracts project. We will use this directory to specify the relevant parameters.

PreviousaddressNextprecompile-contract

Last updated 1 year ago