A guide to help you get started with deploying your smart contracts on MAGNE Layer1 Blockchain.
Welcome to the MAGNE Layer1 Blockchain deployment quickstart guide! This comprehensive walkthrough will help you set up your environment and deploy smart contracts on MAGNE Layer1 Blockchain. Whether you're a seasoned developer or just starting out, this guide has got you covered.
By the end of this quickstart, you'll be able to:
MAGNE Layer1 Blockchain is a mobile-first, EVM-compatible, PoW-based Layer1 chain where smartphones and edge devices can participate in mining and consensus, ensuring security, decentralization, and performance.
mkdir my-MAGNE-project && cd my-MAGNE-project
curl -L https://foundry.paradigm.xyz | bash foundryup
This installs Foundry and updates it to the latest version.
Copy
forge init
Your Foundry project is now ready. You'll find an example contract in the src directory, which you can replace with your own contracts. For the purposes of this guide, we'll use the Counter contract provided in src/Counter.sol
Foundry provides a suite of tools for EVM application development, including Forge (for testing), Cast (for interacting with the chain), and Anvil (for setting up a local node). You can learn more about Foundry here.
To deploy your smart contracts to MAGNE Layer1 Blockchain, you need two key components:
Let's set up both of these:
MAGICAL_RPC_URL="https://rpc.testnet.magicalhash.com"
source .env
Magne L1 Testnet is the test network for MAGNE Layer1 Blockchain, which we will use for the rest of this guide. You can obtain free MHA from one of the faucets .
cast wallet import deployer --interactive
Your private key is stored in ~/.foundry/keystores which is not tracked by git.
Never share or commit your private key. Always keep it secure and handle with care.
Now that your environment is set up, let's deploy your contracts to Magne L1 Testnet.
forge create ./src/Counter.sol:Counter --rpc-url $MAGICAL_RPC_URL --account deployer
Note the format of the contract being deployed is <contract-path>:<contract-name>.
COUNTER_CONTRACT_ADDRESS="0x..."
source .env
To ensure your contract was deployed successfully:
cast call $COUNTER_CONTRACT_ADDRESS "number()(uint256)" --rpc-url $MAGNE_RPC_URL
This will return the initial value of the Counter contract's number storage variable, which will be 0.
Congratulations! You've deployed your smart contracts to MAGNE L1 chain!
A guide to help you get started with deploying your smart contracts on M Hash Layer2 Blockchain
Welcome to the M Hash Layer2 Blockchain deployment quickstart guide! This comprehensive walkthrough will help you set up your environment and deploy smart contracts on M Hash Layer2 Blockchain. Whether you're a seasoned developer or just starting out, this guide has got you covered.
By the end of this quickstart, you'll be able to:
M Hash Layer2 Blockchain is a high-performance Layer 2 network built on opStack with an asynchronous consensus mechanism, separating consensus from execution to significantly boost throughput and efficiency while ensuring security and low-cost transactions.
mkdir my-MAGNE-project && cd my-MAGNE-project
curl -L https://foundry.paradigm.xyz | bash foundryup
This installs Foundry and updates it to the latest version.
forge init
Your Foundry project is now ready. You'll find an example contract in the src directory, which you can replace with your own contracts. For the purposes of this guide, we'll use the Counter contract provided in src/Counter.sol
Foundry provides a suite of tools for EVM application development, including Forge (for testing), Cast (for interacting with the chain), and Anvil (for setting up a local node). You can learn more about Foundry here.
To deploy your smart contracts to M Hash Layer2 Blockchain, you need two key components:
Let's set up both of these:
MAGICAL_RPC_URL="https://l2-rpc.testnet.magicalhash.com"
source .env
M Hash L2 Testnet is the test network for M Hash Layer2 Blockchain, which we will use for the rest of this guide. You can obtain free MHA from one of the faucets .
cast wallet import deployer --interactive
Your private key is stored in ~/.foundry/keystores which is not tracked by git.
Never share or commit your private key. Always keep it secure and handle with care.
Now that your environment is set up, let's deploy your contracts to M Hash L2 Testnet.
forge create ./src/Counter.sol:Counter --rpc-url $MAGICAL_RPC_URL --account deployer
Note the format of the contract being deployed is <contract-path>:<contract-name>.
COUNTER_CONTRACT_ADDRESS="0x..."
source .env
To ensure your contract was deployed successfully:
cast call $COUNTER_CONTRACT_ADDRESS "number()(uint256)" --rpc-url $MAGNE_RPC_URL
This will return the initial value of the Counter contract's number storage variable, which will be 0.
Congratulations! You've deployed your smart contracts to M Hash L2 chain!