Prerequisites
- Completion of the Build Smart Contract guide.
- Access to a MetaMask wallet connected to the peaq/agung network.
Instructions
Deploying with Remix
1. Compile the Smart Contract
- Open the Compile Sidebar in Remix:
- Select the Solidity Compiler from the left sidebar.
- Compile the Contract:
- Ensure the Solidity version matches the pragma directive in your contract (e.g.,
^0.8.0). - Click the Compile SimpleStorage.sol button.
- Ensure green checkmark has appeared after successful compilation.
- Ensure the Solidity version matches the pragma directive in your contract (e.g.,
2. Deploy the Contract
- Open the Deploy & Run Transactions Sidebar:
- Select the Deploy & Run Transactions option in the Remix sidebar.
- Select the Environment:
- From the Environment dropdown, select Injected Provider - MetaMask.
- Confirm that MetaMask is connected to the appropriate network by checking the Chain ID.
- Deploy the Contract:
- Click the orange Deploy button to initiate the transaction.
- A MetaMask popup will appear for transaction confirmation. Ensure you have sufficient
$AGUNG/$PEAQtokens in your wallet for gas fees.
3. View Deployment Details
Once the transaction is confirmed, the Remix console will display deployment logs, including:- Transaction Hash: Unique identifier for the transaction sent to the blockchain. The hash allows you to track and and verify the transaction on the chain. It acts like a deployment receipt. You can use this transaction hash in an explorer to view detailed information about the transaction.
- Block Number: The number of the block your transaction was included on-chain. Blocks are used to group transactions together and the number is used to indicate where your contract deployment was recorded.
- Gas Used: The amount of computational effort that the blockchain required to process your transaction. Deploying a contract consumes gas since it involves writing the bytecode on-chain. Gas is used to show how resource-intensive the deployment was.
- Contract Address: The unique address assigned to your deployed smart contract on the blockchain. This address allows you and other users to interact with your contract. It is the location of the contract on the blockchain network.
Deploying with Hardhat
1. Create a Deployment Script
- Set Up the Script:
- In the
ignition/modules/folder, create a file namedSimpleStorage.js
- In the
- Add Deployment Logic:
- Add the following code to deploy your
SimpleStoragejs file:
- Add the following code to deploy your
2. Deploy the Contract
-
Run the Deployment Command:
- In your terminal, navigate to the project’s root directory
- Execute the following command to deploy the contract to the agung test network:
-
View Deployment Output:
- Upon successful deployment, the terminal will display:
- Deployed Contract Address: The unique address assigned to your deployed smart contract on the blockchain. Record the contract address for future interactions.
- Upon successful deployment, the terminal will display:
Deploying with Foundry
Use Foundry to deploy usingforge create or a script.
1. Prepare environment
Create a.env in your project root with:
2. Option A — forge create
3. Option B — Deployment script
Createscript/DeploySimpleStorage.s.sol:
Agung note
If gas estimates are too low on Agung, append:Post-Deployment Validation
Verify Deployment on Blockchain Explorer:- Use the peaq or agung block explorer to search for your transaction hash or the deployed smart contract address.
- Confirm that your contract is successfully deployed.

