blocktorch
  • Overview
    • Introduction
    • Install/Setup
    • Quickstart
  • Concepts
    • Data Sources
      • EVM Chains
      • Roll-ups
      • Local forks
        • Setup Hardhat fork
        • Setup managed Hardhat Fork
        • Hardhat forking API
      • Smart Contracts
        • Adding smart contracts
      • Custom Event Data
      • Oracles
      • Account Abstraction modules
        • Navigating the AA Explorer
      • Decentralized Datastorage
      • React Frontends
    • Querying data
    • Telemetry
  • Use cases
    • Searching
      • Logs
        • Log Details
      • Sharing search results
    • Monitoring
      • Building monitors
      • Alerting
    • Tracing
      • Stack traces
      • End-2-End Traces
    • Dashboarding
      • Pre-made dashboards
      • Custom graphs
    • Collaborating
      • Inviting others
      • Sharing data
    • Debugging
      • Step debugger
    • Benchmarking
    • Managing incidents
      • Troubelshooting
      • Post mortem
    • Predicting
  • Ressources
    • Demo videos
    • FAQs
  • Contribute
    • Open Source projects
Powered by GitBook
On this page
  1. Concepts
  2. Data Sources
  3. Local forks

Setup Hardhat fork

PreviousLocal forksNextSetup managed Hardhat Fork

Last updated 1 year ago

Prerequisite:

Install Docker for your platform:

Step 1: Select "Hardhat fork", give your fork a name, and press "Save"

Give your fork a recognizable name to make your life easier later on, e.g. when looking for the fork in the list of chains to add contracts deployed on this fork. Especially if you deploy multiple forks, they should have distinguishable names

Step 2: Click on "Setup Agent" to open your setup info guide

Step 3: Get an API Key by clicking on "Create Key" in your setup agent guide

Step 4: Run the following command as prompted in the setup guide in your project, as your guide will include all the relevant variables as for example your API Key. Example here:


docker run \
    -e HARDHAT = true \
    -e SOURCE_NODE=https://eth-mainnet.g.alchemy.com/v2/URADvEwKh-zXgTuUQ \
    -e BLOCKTORCH_API_KEY=undefined \
    -e BLOCKTORCH_CHAIN_ID=c642d08d-ca7e-696-9477-0f9429dcf045 \
    -e BLOCKTORCH_PORJECT_ID=e19f3c34-1217-4df0-b2d6-6084411c0dd \
    -p=8000:8000 -p=8545:8545 \
    ghcr.io/blocktorch-xyz/blocktorch-agent:latest

Step 5: Add the fork to your project on your machine

{
    networks: {
        blocktorch: {
            url: http://127.0.0.1:8545/,
            accounts: [
                example_private_key
            ]
        }
    }
}

Congratulations, you have successfully added your local hardhat fork to blocktorch 🥳 If you now try to to blocktorch that has been deployed on your local hardhat fork you can see your local hardhat fork in the list of available chains

add a smart contract
Mac
Linux
Windows