### Install Foundry with curl Source: https://docs.mantrachain.io/using-foundry Installs Foundry using a curl command to download and execute the installation script. This is the initial step to get Foundry set up on your system. ```shell curl -L https://foundry.paradigm.xyz | bash ``` -------------------------------- ### Development Tooling Overview Source: https://docs.mantrachain.io/mantra-chain-evm/getting-started-1 Introduces essential development tools for building on MANTRA Chain's EVM module. Hardhat is highlighted for managing smart contract development tasks, while Foundry is noted for its speed and Solidity-based testing capabilities. ```APIDOC Tooling: Hardhat: Function: Development environment for Ethereum software, managing and automating tasks for building smart contracts and dApps. Foundry: Function: Command-line interface for the Foundry development toolkit, known for speed and Solidity testing. ``` -------------------------------- ### Wallet Keyring Management Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/validator-nodes Commands to manage your wallet keyring, including creating a new wallet or recovering an existing one, and listing available wallets. Ensure you securely store your mnemonic phrase. ```bash mantrachaind keys add $KEY_NAME # Example Output: # - address: mantra1q55nrzygas0nespfu8mwt2yntq8gxll3kyug82 # name: validator-mchain-test-node-keys # pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A/YebpAX8AqUNcNXcqIy53fJo8BGFCSaQA5A0XQWMlCG"}' # type: local # # **Important** write this mnemonic phrase in a safe place. # It is the only way to recover your account if you ever forget your password. # # expect kid unfair uniform calm debris meadow despair vintage arrive walnut vast upset cart step funny truth vault naive note capable spray shine human ``` ```bash mantrachaind keys list ``` ```bash mantrachaind keys add $KEY_NAME --recover ``` -------------------------------- ### Install Git Version Control Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Commands to install Git, a distributed version control system, on Linux, macOS, and instructions for Windows. ```bash sudo apt-get install git brew install git ``` -------------------------------- ### Install Beaker for CosmWasm Contracts Source: https://docs.mantrachain.io/developing-on-mantra-chain/dapp-tooling/developer-resources Installs Beaker, a tool designed for managing and deploying CosmWasm smart contracts. The `-f` flag ensures you get the most up-to-date version. ```bash cargo install -f beaker ``` -------------------------------- ### Install CosmWasm Library Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Commands to download and install the CosmWasm library (libwasmvm.so) required by MantraChain. Includes instructions for both x86_64 and arm64 architectures. ```bash sudo wget -P /usr/lib sudo wget -P /usr/lib ``` -------------------------------- ### MANTRA Chain DuKong Testnet Endpoints Source: https://docs.mantrachain.io/mantra-chain-evm/getting-started-1 Provides access details for interacting with the MANTRA Chain DuKong Testnet, including Cosmos and EVM specific endpoints for API, RPC, and WebSocket connections. ```APIDOC Chain Details: EVM Chain ID: 5887 COSMOS Endpoints: API: https://api.dukong.mantrachain.io RPC: https://rpc.dukong.mantrachain.io GRPC: grpc.dukong.mantrachain.io EVM Endpoints: RPC: https://evm.dukong.mantrachain.io WS: https://evm.dukong.mantrachain.io/ws Additional URLs: COSMOS Explorer: https://mantrascan.io/dukong (ALPHA), https://explorer.mantrachain.io/MANTRA-Dukong, https://mintscan.io/mantra-dukong EVM Explorer: https://mantrascan.io/dukong (ALPHA) OM Faucet: https://faucet.dukong.mantrachain.io/ ``` -------------------------------- ### Build Mantra Chain Node from Source Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/running-a-node Instructions for building the mantrachaind binary from source code. Requires Go to be installed. This method compiles and installs the executable. ```go make install ``` -------------------------------- ### Hardhat Ignition Deployment Example Output Source: https://docs.mantrachain.io/using-hardhat/deployment-with-hardhat Shows an example of the output when successfully deploying a smart contract using Hardhat Ignition to the MANTRA Omstead network. ```bash $ npx hardhat ignition deploy ./ignition/modules/USDC.js --network omstead ✔ Confirm deploy to network omstead (5887)? … yes Hardhat Ignition 🚀 Deploying [ TokenModule ] Batch #1 Executed TokenModule#Token [ TokenModule ] successfully deployed 🚀 TokenModule#Token - <0xHash of the deployed contract> ``` -------------------------------- ### Install Rust and Wasm Target (Linux/Mac) Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Installs the Rust toolchain using rustup, updates the stable channel, and adds the wasm32-unknown-unknown target for WebAssembly compilation. Requires Go version 1.18+. ```bash rustup default stable cargo version # If this is lower than 1.55.0+, update rustup update stable rustup target list --installed rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Install jq JSON Processor Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Commands to install the jq command-line JSON processor on various operating systems (Linux, macOS, Windows). ```bash sudo apt-get install jq brew install jq winget install jqlang.jq ``` -------------------------------- ### Install Rust and Wasm Target (Windows) Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Installs the Rust toolchain using rustup, updates the stable channel, and adds the wasm32-unknown-unknown target for WebAssembly compilation. Requires Go version 1.18+ and Visual C++ Build Tools 2019. ```bash rustup default stable cargo version # If this is lower than 1.55.0, update rustup update stable rustup target list --installed rustup target add wasm32-unknown-unknown ``` -------------------------------- ### Install Cargo Generate and Cargo Run Script Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Installs the cargo-generate tool for creating Rust projects from templates and cargo-run-script for executing scripts defined in Cargo.toml. The vendored-openssl feature is used for openssl dependency management. ```bash cargo install cargo-generate --features vendored-openssl cargo install cargo-run-script ``` -------------------------------- ### Install Go 1.20 Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/configuring-mantrachain-with-systemd Installs Go version 1.20 using a script. This is a prerequisite for running Cosmovisor, which is used to manage the mantrachaind node. ```bash wget -q -O - https://git.io/vQhTU | bash -s -- --remove wget -q -O - https://git.io/vQhTU | bash -s -- --version 1.20 ``` -------------------------------- ### Install Hardhat Dependencies Source: https://docs.mantrachain.io/using-hardhat/deployment-with-hardhat Installs the necessary Hardhat and Hardhat Toolbox dependencies using npm for smart contract development. ```bash npm install --save-dev hardhat npm install --save-dev @nomicfoundation/hardhat-toolbox ``` -------------------------------- ### Retrieve Validator Public Key Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/validator-nodes Command to fetch the public key associated with your Tendermint validator. This key is essential for the create-validator transaction. ```bash mantrachaind tendermint show-validator ``` -------------------------------- ### MantraChain CLI Command Reference Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Provides a comprehensive overview of the mantrachaind command-line interface, including available commands, their descriptions, and global flags. This serves as an API reference for interacting with the node. ```APIDOC mantrachaind CLI Reference: Usage: mantrachaind [command] Available Commands: add-genesis-account Add a genesis account to genesis.json collect-gentxs Collect genesis txs and output a genesis.json file config Create or query an application CLI configuration file debug Tool for helping with debugging your application export Export state to JSON gentx Generate a genesis tx carrying a self delegation help Help about any command init Initialize private validator, p2p, genesis, and application configuration files keys Manage your application's keys migrate Migrate genesis to a specified target version query Querying subcommands rollback rollback cosmos-sdk and tendermint state by one height start Run the full node status Query remote node for status tendermint Tendermint subcommands tx Transactions subcommands validate-genesis validates the genesis file at the default location or at the location passed as an arg version Print the application binary version information Flags: -h, --help help for mantrachaind --home string directory for config and data (default "/Users/\u003cyour-user-name\u003e/.mantrachain") --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errors ``` -------------------------------- ### Create Validator Transaction Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/validator-nodes Submits the transaction to create a validator. This involves preparing a JSON configuration file with validator details and then executing the create-validator command. Ensure your wallet has sufficient OM tokens. ```json { "pubkey": $(mantrachaind tendermint show-validator), "amount": "10000uom", "moniker": "MANTRA Chain Foundation", "identity": "xxxxxx", "website": "https://mantrachain.io", "security": "security@mantrachain.io", "details": "MANTRA is a purpose-built RWA Layer 1 Blockchain, capable of adherence to real world regulatory requirements.", "commission-rate": "0.1", "commission-max-rate": "0.2", "commission-max-change-rate": "0.01", "min-self-delegation": "1" } ``` ```bash echo "{ \"pubkey\": $(mantrachaind tendermint show-validator), \"amount\": \"10000uom\", \"moniker\": \"MANTRA Chain Foundation\", \"identity\": \"xxxxxx\", \"website\": \"https://mantrachain.io\", \"security\": \"security@mantrachain.io\", \"details\": \"MANTRA is a purpose-built RWA Layer 1 Blockchain, capable of adherence to real world regulatory requirements.\", \"commission-rate\": \"0.1\", \"commission-max-rate\": \"0.2\", \"commission-max-change-rate\": \"0.01\", \"min-self-delegation\": \"1\" } " > validator.json mantrachaind tx staking create-validator validator.json --from $KEY_NAME --chain-id mantra-dukong-1 --gas="auto" --gas-adjustment 2 --gas-prices="0.01uom" ``` -------------------------------- ### Rust: CosmWasm Schema Generation (`examples/schema.rs`) Source: https://docs.mantrachain.io/developing-on-mantra-chain/cosmwasm-quick-start-guide/understanding-cosmwasm-file-structure Explains the role of `examples/schema.rs` in CosmWasm projects for generating schemas using the `cargo schema` command. These generated schemas are essential for client-side interaction with smart contracts, similar to ABIs in EVM. ```rust // examples/schema.rs // Contains the logic to generate schemas when we run `cargo schema`. // The generated schemas are stored in the `/schema` folder. // We'll use this folder for declaring our schemas. ``` -------------------------------- ### Create MANTRA Chain Wallets Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/setting-up-dev-environment Adds new encrypted private keys to the mantrachaind keyring for testing purposes. The command outputs the wallet's address, name, public key, and a mnemonic phrase for recovery. ```bash # add wallets for testing mantrachaind keys add wallet mantrachaind keys add wallet2 ``` -------------------------------- ### Import Wallet into Mantrachaind Keyring Source: https://docs.mantrachain.io/setup-instructions Instructions for importing an existing wallet into the mantrachaind command-line interface. This process allows you to manage your MANTRA chain assets using the CLI, specifying the coin type for address derivation. ```Shell mantrachaind keys add --recover --coin-type 60 # or mantrachaind keys add --seed "" --coin-type 60 # When using bank balance commands, specify the node: # mantrachaind query bank balances --node ``` -------------------------------- ### Install Cosmovisor Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/configuring-mantrachain-with-systemd Installs the Cosmovisor tool using `go install`. Cosmovisor is a utility designed for managing and upgrading Cosmos SDK-based blockchain nodes, simplifying daemon operations. ```bash go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@latest ``` -------------------------------- ### Download and Unzip mantrachaind CLI (Linux) Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Downloads the mantrachaind binary for Linux ARM64 architecture using curl and then unzips the downloaded archive. This binary is the backbone of the CosmWasm platform for MANTRA DuKong Chain. ```bash # Download the CLI curl -LO < https://github.com/MANTRA-Chain/mantrachain/releases/download/v5.0.0-rc0/mantrachaind-5.0.0-rc0-linux-arm64> # Unzip the CLI unzip mantrachaind-5.0.0-rc0-linux-arm64 ``` -------------------------------- ### Instantiate Smart Contract Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/deployment-and-interaction Creates a new instance of a smart contract on the MANTRA Chain using a previously uploaded Code ID and a specific initialization message. It also shows how to query contract details and balances. ```bash # Prepare the instantiation message (example for a purchase/transfer contract) INIT='{"purchase_price":{"amount":"100","denom":"uom"},"transfer_price":{"amount":"999","denom":"uom"}}' # Instantiate the contract without admin privileges mantrachaind tx wasm instantiate $CODE_ID "$INIT" --from wallet --label "name service" $TXFLAG -y --no-admin # Query contract details and account balance after instantiation # Note: $NODE variable might need to be set to the RPC endpoint CONTRACT=$(mantrachaind query wasm list-contract-by-code $CODE_ID $NODE --output json | jq -r '.contracts[-1]') echo "Contract Address: $CONTRACT" mantrachaind query wasm contract $CONTRACT $NODE mantrachaind query bank balances $CONTRACT $NODE ``` -------------------------------- ### Install lz4 Source: https://docs.mantrachain.io/appendix/frequently-asked-questions/validator-faqs/how-do-i-create-a-backup-snapshot-of-a-node Installs the lz4 compression utility, which is required for creating the compressed snapshot file. ```bash sudo apt install lz4 ``` -------------------------------- ### Download mantrachaind CLI (MacOS) Source: https://docs.mantrachain.io/developing-on-mantra-chain/getting-started/install-prerequisites Downloads the mantrachaind binary for MacOS, providing separate links for Intel (amd64) and Apple Silicon (arm64) chips. This binary is essential for interacting with the MANTRA DuKong Chain. ```bash # Download the CLI for Intel chips curl -LO # Download the CLI for Silicon chips (M1, M2...) curl -LO ``` -------------------------------- ### Start Mantrachain Node Source: https://docs.mantrachain.io/appendix/frequently-asked-questions/validator-faqs/how-do-i-restore-a-node-from-a-snapshot Starts the mantrachain daemon service using systemctl. This command initiates the node process after the snapshot has been restored. ```bash systemctl start mantrachaind ``` -------------------------------- ### Connect Sidecar API Response Example Source: https://docs.mantrachain.io/node-and-validator-operations/node-setup-and-deployment/validator-nodes/connect-sidecar Example JSON output from the /connect/oracle/v2/prices endpoint, showing fetched cryptocurrency prices and metadata. ```json { "prices": { "ATOM/USD": "4308207537", "BTC/USD": "6693024042", "ETH/USD": "2602324302", "OM/USD": "1501599", "OSMO/USD": "53054083", "USDT/USD": "999750064", "USDY/USD": "1054483" }, "timestamp": "2024-10-17T12:09:39.899360574Z", "version": "v2.0.1" } ```