🛠️ A powerful CLI tool for Polygon and Ethereum developers, streamlining the process of deploying, interacting with, and testing smart contracts on various networks including Polygon (PoS), zkEVM, and Ethereum testnets.
- 🔒 Secure key management with encryption
- 🌐 Support for multiple networks (Polygon PoS, zkEVM, Ethereum)
- 📝 Simple contract deployment and interaction
- ⚡ Fast and efficient testing tools
- 🔄 Easy network switching
- ⚙️ Configurable RPC endpoints
- Node.js 14.x or higher
- npm 6.x or higher
- A wallet with test tokens for contract deployment
# Install globally
npm install -g polyforge
# Check current network
polyforge network
# Add your private key (encrypted)
polyforge key add default
# Deploy a contract
polyforge deploy ./contracts/MyContract.json -n sepolia
# Interact with contract
polyforge interact <contract-address> ./contracts/MyContract.json getValuenpm install -g polyforgeTo update an existing installation:
npm update -g polyforgeTo verify the installation:
polyforge --versionAfter installation, you need to set up your configuration and add your private keys:
- Run
polyforge networkto view your current network configuration. - Add your private key:
You will be prompted to enter your private key securely. The key will be encrypted and stored safely.
polyforge key add default
Important: Never share or commit your private keys. The key management system securely encrypts your keys.
Deploy a smart contract to the network:
polyforge deploy ./path/to/YourContract.json -n network -k keynameOptions:
-n, --network <network>: Specify the network (pos, amoy, zkevm, zkevm_testnet, sepolia)-k, --key <keyName>: Specify the key to use for deployment (default: "default")
Example:
polyforge deploy ./contracts/MyToken.json -n sepolia -k defaultInteract with a deployed contract:
polyforge interact <contractAddress> ./path/to/ContractABI.json <methodName> [params...]Examples:
# Read contract state
polyforge interact 0x1234...5678 ./MyToken.json balanceOf 0xabcd...efgh
# Write to contract
polyforge interact 0x1234...5678 ./MyToken.json transfer 0xabcd...efgh 1000The tool will automatically wait for write transactions to be mined and confirm their success.
Available networks:
- Polygon Mainnet:
pos - Polygon zkEVM:
zkevm - Polygon Amoy Testnet:
amoy - Polygon zkEVM Testnet:
zkevm_testnet - Ethereum Sepolia:
sepolia
Switch networks using:
polyforge switch <network>Configuration file location: ~/.polyforge/config.json
Default RPC endpoints are provided, but you can customize them:
{
"currentNetwork": "sepolia",
"networks": {
"sepolia": {
"rpcUrl": "https://rpc.sepolia.org",
"chainId": 11155111
}
}
}PolyForge takes security seriously:
- 🔐 Private keys are never stored in plain text
- 🔑 Keys are encrypted with a password you provide
- 📝 No sensitive data in environment files
- ✅ Automatic gitignore for sensitive files
We welcome contributions! Please see our Contributing Guide for details.
MIT © [Your Name]