-
Notifications
You must be signed in to change notification settings - Fork 2
Deployment and Configuration
This page explains how to configure your environment for deploying PeoPay-Core contracts to different networks (local, testnet, mainnet) and how to run deployment scripts. By following these steps, you can quickly set up your environment and deploy the PeoPay ecosystem’s core components (PeoCoin, Staking, Governance, DCS, and Conversion).
- Node.js & npm: Installed and set up (see Getting Started).
-
Hardhat: Already installed via
npm install. -
.envfile: Contains RPC URLs, private keys, and API keys. - Test Network Funds: If deploying to a testnet (e.g., Polygon’s Mumbai), ensure you have test MATIC in your deployer account.
Your .env file provides the sensitive credentials and configuration needed for deployments. For example:
PRIVATE_KEY=0xyourprivatekeyhere
INFURA_API_KEY=your_infura_project_id
ALCHEMY_KEY=your_alchemy_api_keyIf deploying to Polygon or Mumbai:
RPC_URL_MUMBAI=https://polygon-amoy.infura.io/v3/${INFURA_API_KEY}Adjust these variables based on the provider and network you choose.
Check hardhat.config.js to see predefined network settings. For example:
networks: {
hardhat: {
// Local network for testing and development
},
mumbai: {
url: process.env.RPC_URL_MUMBAI,
accounts: [process.env.PRIVATE_KEY]
},
polygon: {
url: "https://polygon-mainnet.infura.io/v3/" + process.env.INFURA_API_KEY,
accounts: [process.env.PRIVATE_KEY]
}
}Customize these entries for the networks you want to target. Make sure process.env.PRIVATE_KEY and relevant RPC URLs are properly set in .env.
To deploy contracts to the local Hardhat network (e.g., for testing):
- Start a local node (optional):
npx hardhat node
- Deploy contracts:
npx hardhat run scripts/deploy_peocoin.js
By default, running without --network uses the hardhat network. This is ideal for quick testing and development.
To deploy to Polygon’s Amoy testnet:
- Ensure
.envincludesRPC_URL_AMOYandPRIVATE_KEY. - Run:
npx hardhat run scripts/deploy_peocoin.js --network amoy
Repeat for other scripts (like deploy_staking.js, deploy_governance.js) as needed. Once deployed, you can verify contracts on Polygonscan if desired.
For production deployments:
- Ensure you have a funded deployer account with MATIC on Polygon mainnet.
- Set
INFURA_API_KEYorALCHEMY_KEYfor a Polygon mainnet RPC URL. - Run:
npx hardhat run scripts/deploy_peocoin.js --network polygon
Use caution when deploying to mainnet. Double-check addresses, contracts, and parameters before execution.
After deployment, you can verify contracts on Polygonscan (or Etherscan if using Ethereum):
npx hardhat verify --network amoy <contract_address> <constructor_args...>This step requires ETHERSCAN_API_KEY or POLYGONSCAN_API_KEY in .env. The verification helps third parties inspect source code and builds trust in your contracts.
-
Insufficient Gas / Funds:
Make sure the deployer account has enough test or mainnet tokens (e.g., MATIC) to cover gas costs. -
Incorrect RPC URLs:
If deployments fail, verify that the RPC endpoints in.envandhardhat.config.jsare correct and active. -
Contract Dependencies:
Some scripts assume prior deployment of certain contracts. Deploy them in logical order (e.g., PeoCoin first, then Staking, then Governance). -
Wait for Confirmations:
On testnets or mainnet, consider waiting for multiple confirmations or verifying block explorers to ensure contracts are properly deployed.
-
Interacting with Deployed Contracts:
See Contracts Overview and Interacting with Contracts (if available) for guidance. -
Testing & QA:
Re-run tests against a locally deployed environment to ensure no regressions. -
Governance & DCS Parameters:
After deployment, consider updating governance parameters or DCS weights if needed. See Governance & DCS Parameters.
By following these guidelines, you can seamlessly configure your environment and deploy PeoPay-Core contracts to various networks. Always review your setup and scripts before deploying to mainnet to maintain security and stability in the PeoPay ecosystem.
PeoPay-Core Wiki
View on GitHub | peopay.io | docs.peopay.io
This content is licensed under the GNU GPLv3. For contributions and bug reports, see our CONTRIBUTING.md and SECURITY.md.
If you have suggestions to improve this Wiki, please open an issue or PR on the main repository!
- Home
- Getting Started
- Contracts Overview
- Deployment & Configuration
- Testing & QA
- Security & Audits
- Governance & DCS Parameters
- FAQ
External Links
Contributing & Security