Code Monkey home page Code Monkey logo

ethereum-pos-testnet's Introduction

alt text

Deploy your own Local Ethereum PoS Testnet

license stability-experimental testnet-deployment

This deployment process allows you to setup and deploy your own local ethereum PoS networks with multiple nodes. This repository is targeted to developers who want to quickly modify client source code and deploy a PoS network. This setup can is can serve as a reference for building your own production deployments but better solutions exist for that use case. I'm personally using this for simulating reorgs and byzantine behaviour.

Installation

This project utilizes Git submodules to reference the client code, notably Go-Ethereum and Prysm. However, the scripts can be configured to reference binaries you build locally, making development quicker.

You will need Go 1.20 and JQ installed.

git clone --recursive https://github.com/rzmahmood/ethereum-pos-testnet.git

A helper script that builds the submodules, saving the binaries in a known path

./build-dependencies.sh

Running

Start testnet. This will start a test with a two validators. You should expect blocks to be produced. Logs are stored in ./network/node-*/logs The script is idempotent and will clean up every time it is restarted.

./testnet.sh

Running Testnet

In a new shell, you can then attach to any of the generated nodes. If you have geth in your path you can run:

geth attach network/node-0/execution/geth.ipc 

> net.peerCount
> eth.blockNumber

Alternatively, you can use the built version of geth

./dependencies/go-ethereum/build/bin/geth attach network/node-0/execution/geth.ipc 

> net.peerCount
> eth.blockNumber

You can also interact with a beacon node you spin up

curl localhost:4100/eth/v1/node/identity

You can change the number of nodes to run by changing this line in ./testnet.sh

# Change this number for your desired number of nodes
NUM_NODES=2

If you want to try submitting transactions, add your address to the alloc field in ./genesis.json before running the testnet. This will premine your address some funds.

"alloc": {
    // Replace with your address
    "123463a4b065722e99115d6c222f267d9cabb524": {
        "balance": "0x43c33c1937564800000"
    },

You can then send transactions using cast while the network is running

# Get balance of an address
cast balance -r localhost:8000 0xFe8664457176D0f87EAaBd103ABa410855F81010

# Send 0.01 ether to 0x8D...8E
cast send -r localhost:8000 --private-key $PKEY 0x8D512169343cc6e108a8bB6ec5bc116C416eFc8E --value 0.01ether

Reach out to me on Twitter @0xZorz if you have any issues. DMs are open

Coming Soon

  • Deposits and Withdrawals

FAQ / Common Issues

  • go: cannot find main module, but found .git/config in /home/gopal/ethereum-pos-testnet
          to create a module there, run:
          cd ../.. && go mod init
    

    This occurs because the submodules were not cloned. Make sure to clone with the --recursive flag, i.e. git clone --recursive https://github.com/rzmahmood/ethereum-pos-testnet.git

  • Nil finalized block cannot evict old blobs 
    

    This is expected log from Geth until a block is 'finalized'. The first finalized block will occur after 24 blocks.

Acknowledgements

  • The work of Raul Jordan was a great reference starting point. His setup will suffice requirements that don't demand signficant customization and only require 1 node.

ethereum-pos-testnet's People

Contributors

rzmahmood avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.