local
Flagged{"isSafe":false,"isSuspicious":true,"riskLevel":"high","findings":[{"category":"shell_command","severity":"high","description":"Curl piped to bash executing a remote installation script from https://foundry.paradigm.xyz","evidence":"curl -L https://foundry.paradigm.xyz | bash"}],"summary":"Contains a high-risk pattern: curl piped to bash to install Foundry, which executes remote code without verification. The remainder of the content is standard local development guidance."}
npx machina-cli add skill HCS412/contractkit/local --openclawContractKit: Local Chain
Start a local Anvil blockchain for development and testing.
Process
1. Check Foundry Installation
Verify anvil is installed:
command -v anvil
If not found, instruct user to install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryup
2. Start Anvil
Start Anvil in the background or instruct the user to open a new terminal:
anvil
Default configuration:
- RPC URL:
http://127.0.0.1:8545 - Chain ID:
31337 - Block time: Instant (mines on transaction)
3. Create Environment File
Create or update .env.local in the project:
LOCAL_RPC_URL=http://127.0.0.1:8545
4. Report Status
Print:
- RPC URL
- Note about test accounts being available
- Next step:
/contractkit:deploy local
Test Accounts
Anvil provides pre-funded test accounts. These are for local development only.
Example Usage
User: /contractkit:local
Starting local Anvil chain...
RPC URL: http://127.0.0.1:8545
Chain ID: 31337
Test accounts are pre-funded and ready.
Next: /contractkit:deploy local
Notes
- Anvil must keep running for local deployments to work
- State is reset when Anvil restarts
- Use
--stateflag to persist state if needed
Stopping Anvil
Press Ctrl+C in the terminal running Anvil, or:
pkill anvil
Source
git clone https://github.com/HCS412/contractkit/blob/main/plugins/contractkit/skills/local/SKILL.mdView on GitHub Overview
Start a local Anvil blockchain for development and testing. This skill guides you through verifying Foundry, launching Anvil, and wiring a LOCAL_RPC_URL for your project.
How This Skill Works
The skill first checks that Anvil is installed (command -v anvil). If not found, it guides you to install Foundry with the recommended curl script and foundryup. It then starts Anvil (default RPC URL http://127.0.0.1:8545, Chain ID 31337, instant blocks) and writes LOCAL_RPC_URL to .env.local for use by ContractKit; Anvil must stay running during local deployments.
When to Use It
- You are developing and testing Ethereum smart contracts on a local Anvil chain.
- You need pre-funded test accounts for rapid local testing.
- You want a consistent local RPC URL and chain ID (http://127.0.0.1:8545 and 31337) for tooling.
- You are integrating ContractKit and will run /contractkit:local before deployment.
- You want to know how to stop Anvil and understand the behavior when the state resets.
Quick Start
- Step 1: Check that anvil is installed (command -v anvil). If not, install Foundry: curl -L https://foundry.paradigm.xyz | bash; foundryup.
- Step 2: Start Anvil (anvil) in a terminal or background process.
- Step 3: Create or update .env.local with LOCAL_RPC_URL=http://127.0.0.1:8545
Best Practices
- Check for anvil with command -v anvil before starting the local chain.
- Install Foundry quickly if missing using the provided curl script and foundryup.
- Run Anvil in the background or in a separate terminal to keep it alive during deployments.
- Create or update .env.local with LOCAL_RPC_URL=http://127.0.0.1:8545.
- Remember that state resets when Anvil restarts; use --state if you need persistence and stop Anvil properly.
Example Use Cases
- A developer runs /contractkit:local and uses the printed RPC URL and Chain ID to connect their app.
- Pre-funded test accounts are used to simulate user transactions during local testing.
- The team stores LOCAL_RPC_URL in .env.local and proceeds with /contractkit:deploy local.
- They stop Anvil with Ctrl+C and verify that a restart clears state for a clean test.
- They enable --state to keep contract storage between sessions for debugging.