
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@celo/devchain-anvil
Advanced tools
This package contains anvil state that allows you to start an anvil instance in seconds.
This anvil instance serves at localhost:8545 on your machine, and comes pre-configured with core contracts like the Registry contract (at 0x000000000000000000000000000000000000ce10). You can make RPC calls against this anvil instance as if you were interacting with Celo on Alfajores or Mainnet.
npm install --save-dev @celo/devchain-anvil
anvil --state <path_to_devchain.json>
Files in this package:
devchain.json for a Celo L1-like devchain.l2-devchain.json for a Celo L2-like devchain.Make a test directory
# Create a demo directory
$ mkdir ~/Documents/local-anvil-demo
# Move into the demo directory
$ cd ~/Documents/local-anvil-demo
Install the package
$ npm install --save-dev @celo/devchain-anvil
Start an anvil instance with the state file from the package
$ anvil --state node_modules/@celo/devchain-anvil/devchain.json
                             _   _
                            (_) | |
      __ _   _ __   __   __  _  | |
     / _` | | '_ \  \ \ / / | | | |
    | (_| | | | | |  \ V /  | | | |
     \__,_| |_| |_|   \_/   |_| |_|
    0.2.0 (f625d0f 2024-04-02T00:16:42.824772000Z)
    https://github.com/foundry-rs/foundry
Available Accounts
==================
(0) 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000.000000000000000000 ETH)
# ...
Listening on 127.0.0.1:8545
Make RPC calls against the anvil instance serving at http://127.0.0.1:8545
Foundry allows you to start anvil instances with state you read from json files.
The idea is to save the state of an anvil instance at a certain point in time, and then load it back up later.
$ anvil --state <PATH>
    This is an alias for both --load-state and --dump-state.
    It initializes the chain with the state and block environment stored at the file, if it
    exists, and dumps the chain's state on exit.
Source: Anvil docs
We use this feature to pre-configure an anvil instance with core contracts and other state, and then start it up in seconds for testing.
We call this a "devchain". The scripts we use to configure the devchain are here: celo-org/celo-monorepo/ > packages/protocol/migrations_sol
The anvil instance is not a full Celo node. It is a lightweight, in-memory instance that you can use for testing.
We are a GitHub-first team, which means we have a strong preference for communicating via GitHub. Please use GitHub to:
🧑💻 Contribute!
🚔 Report a security vulnerability
[!TIP]
Please avoid messaging us via Slack, Telegram, or email. We are more likely to respond to you on GitHub than if you message us anywhere else. We actively monitor GitHub, and will get back to you shortly 🌟
FAQs
Anvil based devchain that contains core smart contracts of celo
The npm package @celo/devchain-anvil receives a total of 14 weekly downloads. As such, @celo/devchain-anvil popularity was classified as not popular.
We found that @celo/devchain-anvil demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.