GithubHelp home page GithubHelp logo

alecdwm-forks / academy-pow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from polkadot-blockchain-academy/academy-pow

0.0 0.0 0.0 4.27 MB

PoW blockchain node to gain hands-on experience starting a real network together

License: The Unlicense

JavaScript 18.26% Rust 78.01% CSS 0.20% Dockerfile 3.53%

academy-pow's Introduction

Academy PoW

A Proof of Work blockchain node for use in the Polkadot Blockchain Academy. It happens to be based on Substrate, but no Substrate knowledge is required. Students will use this node to start their own network, and perform hard, soft, and contentious forks.

Instructors, planning to host such an activity should see the docs on setting up a bootnode. TODO Expand that doc into a full guide to running the workshop.

Building the Node

First you will need a Substrate developer environment.

  1. Cloning this repo
  2. Running cargo build --release

Run a Single Development Node

You can use a native binary if you built it in the previous section. Otherwise you can use Docker.

./target/release/academy-pow --dev

Docker Single Node

If you use docker, you need to map the RPC port and specify --rpc-external so that the node listens on 0.0.0.0.

Networking can be challenging for new Docker users, like me. If you are on linux, you may prefer to use --network host which allows the containerized node to operate directly on the local network. Consult the Docker docs for more details.

docker run -p 9944:9944 ghcr.io/polkadot-blockchain-academy/academy-pow:main --dev --rpc-external

MultiNode Testnet

When using the local networking, you can use the --discover-local flag to discover peers on your local network.

# Start the first node.
# Same as a single node network above.
./target/release/academy-pow --dev --mining-algo keccak

# Start the second node
# Choose a non-default rpc port because the default port is taken by the first node.
./target/release/academy-pow --dev --mining-algo sha3 --rpc-port 9955 --discover-local

Docker Multi Node

With Docker, we can't rely on local peer discovery. Instead, copy the bootnode address from the logs of the first node. Look for a line like this

๐Ÿท  Local node identity is: 12D3KooWR2y4tUSpqrPgvSoqfcx9bT8aV2LwHR3BJkWJFTBjZMbZ 
# Start the first node.
# Same as a single node network above.
docker run -p 9944:9944 ghcr.io/polkadot-blockchain-academy/academy-pow:main \
    --dev \
    --mining-algo keccak \
    --rpc-external

# Start the second node.
# Publish all exposed ports to RANDOM ports on the host.
# Specify the bootnode address you copied from the first node
docker run --publish-all ghcr.io/polkadot-blockchain-academy/academy-pow:main \
    --dev \
    --mining-algo sha3 \
    --rpc-external \
    --bootnodes /ip4/127.0.0.1/tcp/30333/p2p/12D3KooWR2y4tUSpqrPgvSoqfcx9bT8aV2LwHR3BJkWJFTBjZMbZ

Actually, even the above command doesn't get the nodes to peer properly. The problem is that I don't know the proper ip address to use for the bootnode. It isn't 127.0.0.1 because that is in the container still. See https://stackoverflow.com/questions/24319662/from-inside-of-a-docker-container-how-do-i-connect-to-the-localhost-of-the-mach?noredirect=1&lq=1 for possible solutions using docker compose.

More Help

academy-pow --help

academy-pow's People

Contributors

joshorndorff avatar nczhu avatar notlesh avatar fbielejec avatar cecton avatar ltfschoen avatar nuke-web3 avatar pmikolajczyk41 avatar asiniscalchi avatar 4meta5 avatar laboon avatar arikan avatar kevcoxe avatar wirednkod avatar alecdwm 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.