Smart Contracts
Deploy and interact with smart contracts on Paxeer Network
Paxeer Network is fully compatible with Ethereum smart contracts and tooling.
Overview
Deploy and interact with smart contracts on Paxeer Network. Fully EVM-compatible with Ethereum tooling including Hardhat, Foundry, and Remix.
Deployment Options
Deploy with Hardhat
Configure Hardhat to deploy on Paxeer Network.
Install dependencies
npm install --save-dev hardhat @nomicfoundation/hardhat-toolboxConfigure hardhat.config.js
require("@nomicfoundation/hardhat-toolbox");
module.exports = {
solidity: "0.8.20",
networks: {
paxeer: {
url: "https://public-rpc.paxeer.app/rpc",
chainId: 125,
accounts: [process.env.PRIVATE_KEY]
}
},
etherscan: {
apiKey: {
paxeer: "YOUR_API_KEY"
},
customChains: [
{
network: "paxeer",
chainId: 125,
urls: {
apiURL: "https://paxscan.paxeer.app/api",
browserURL: "https://paxscan.paxeer.app"
}
}
]
}
};Deploy
npx hardhat run scripts/deploy.js --network paxeerTip
Store your private key in a .env file and never commit it to version control.
Deploy with Foundry
Use Foundry to deploy contracts on Paxeer Network.
Install Foundry
curl -L https://foundry.paradigm.xyz | bash
foundryupCreate project
forge init my-project
cd my-projectDeploy
forge create src/MyContract.sol:MyContract \
--rpc-url https://public-rpc.paxeer.app/rpc \
--private-key $PRIVATE_KEY \
--chain-id 125Tip
Use --verify flag to verify your contract on PaxeerScan after deployment.
Deploy with Remix
Use Remix IDE to deploy contracts via MetaMask.
Open Remix
Go to remix.ethereum.org
Write or Import Contract
Write or import your Solidity contract in the file explorer
Compile Contract
Use the Solidity compiler to compile your contract
Connect MetaMask
Connect MetaMask to Paxeer Network (Chain ID: 125)
Select Environment
In the Deploy & Run tab, select "Injected Provider - MetaMask"
Deploy
Click "Deploy" and confirm the transaction in MetaMask
Make sure your MetaMask is connected to Paxeer Network before deploying.
Example Contract
Here's a simple ERC-20 token contract example:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract MyToken is ERC20 {
constructor() ERC20("MyToken", "MTK") {
_mint(msg.sender, 1000000 * 10 ** decimals());
}
}Deploying the Example
const hre = require("hardhat");
async function main() {
const MyToken = await hre.ethers.getContractFactory("MyToken");
const token = await MyToken.deploy();
await token.waitForDeployment();
console.log("MyToken deployed to:", await token.getAddress());
}
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});Run the deployment:
npx hardhat run scripts/deploy.js --network paxeerforge create src/MyToken.sol:MyToken \
--rpc-url https://public-rpc.paxeer.app/rpc \
--private-key $PRIVATE_KEY \
--chain-id 125Verifying Contracts
After deployment, verify your contract on PaxeerScan for transparency and easier interaction.
Using Hardhat
npx hardhat verify --network paxeer DEPLOYED_CONTRACT_ADDRESSUsing Foundry
forge verify-contract \
--chain-id 125 \
--compiler-version v0.8.20 \
DEPLOYED_CONTRACT_ADDRESS \
src/MyToken.sol:MyToken \
--etherscan-api-key YOUR_API_KEYInteracting with Contracts
Using ethers.js
import { ethers } from 'ethers';
const provider = new ethers.JsonRpcProvider(
'https://public-rpc.paxeer.app/rpc'
);
const contract = new ethers.Contract(
contractAddress,
contractABI,
provider
);
// Read contract data
const balance = await contract.balanceOf(address);
// Write contract data (requires signer)
const signer = await provider.getSigner();
const contractWithSigner = contract.connect(signer);
await contractWithSigner.transfer(recipientAddress, amount);Using wagmi
import { useReadContract, useWriteContract } from 'wagmi';
// Read contract
const { data: balance } = useReadContract({
address: '0x...',
abi: tokenABI,
functionName: 'balanceOf',
args: [userAddress],
});
// Write contract
const { writeContract } = useWriteContract();
function transfer() {
writeContract({
address: '0x...',
abi: tokenABI,
functionName: 'transfer',
args: [recipientAddress, amount],
});
}Best Practices
Network Information
| Parameter | Value |
|---|---|
| Network Name | Paxeer Network |
| RPC URL | https://public-rpc.paxeer.app/rpc |
| Chain ID | 125 |
| Currency | PAX |
| Block Explorer | https://paxscan.paxeer.app |
Next Steps
How is this guide?