Deploy Proven AI Smart Contracts
Introduction
This guide will walk you through deploying Proven AI smart contracts to the EVM (Ethereum compatible) mainnet or testnets.
Prerequisites
- Install Foundry CLI
curl -L https://foundry.paradigm.xyz | bash
-
Install Ganache (optional) or use anvil
-
Add your Ganache/Etherium account in to Metamsk
Deploy
- Clone the Proven AI smart contracts repository
git clone https://github.com/ctrl-space-labs/proven-ai.git
- Change directory to the smart contracts repository
cd proven-ai/provenai-blockchain
- Build the smart contracts
forge build
- Deploy the smart contracts
forge script script/ProvenAIAgentUsageScript.s.sol:ProvenAIAgentUsageScript --rpc-url $RPC_URL --private-key $PRIVATE_KEY --gas-limit 500000 --gas-price 3200000
0000 --broadcast
Useful commands
- Get the smart contract address and verify the deployment
<!-- Call method -->
cast call 0x2cEd717C09C6F79B6314F6A8F36792A67Ba861dA "getDailyUsage(address,uint256)" 0x7f2Ab1BfaEb0A312c89E09e4691000Be9cA14d4a 1720396800000 --rpc-url $AMOY_POLYGON_RPC_URL
<!-- send transaction -->
cast send 0x2cEd717C09C6F79B6314F6A8F36792A67Ba861dA "recordDailyUsage(uint256,bytes32)" 1720396800000 0x5468317320abcdef1234567890abcdef1234567890abcdef1234567890abcdef --rpc-url $RPC_URL --private-key $PRIVATE_KEY --gas-limit 50000 --gas-price 200000000000
- Send ETH to an address
cast send <recipient_address> --value <amount_in_wei> --rpc-url <rpc_url> --private-key <private_key>
- Estimate gas
cast estimate 0x2cEd717C09C6F79B6314F6A8F36792A67Ba861dA "recordDailyUsage(uint256,bytes32)" 1720396800000 0x5468317320abcdef1234567890abcdef1234567890abcdef1234567890abcdef --rpc-url $AMOY_POLYGON_RPC_URL