--- type: slide --- # Launch an ephemeral Polkadot testnet with Zombienet 🧟 --- In this workshop, you'll learn how to launch your own local parachain network and how connecting chains to Polkadot works under the hood. πŸ’ͺ --- ## Workshop plan πŸ—“οΈ - Learn about the big picture: relay chain binary and parachain binaries; genesis configuration - Setup Zombienet to launch a test net - Interact with your testnet - ***Stretch goal**: configure and run cross-chain tests* --- ## Quests Workshop quests are a way to help you apply what we learn during our workshops. # πŸ”Ž --- **Today's quests 🀠** 1. Use the workshop repo and Zombienet to run a local network 2. Interact with your network --- ## Pre-quest prep πŸ“‹ Get a head's start! 1. Download Zombienet (macOS or Linux): https://github.com/paritytech/zombienet/releases 2. Clone the workshop repo --- ## Background Polkadot is a network of "appchains" we call **parachains**. πŸ’‘ Appchains can connect to Polkadot for state validation .. and interoperability with other appchains. --- _Food for thought: in a way, parachains are just like mega complex smart contracts.._ --- Check out [this interactive visual](https://alpha.chainviz.app/) of a Polkadot-like network in action. 😎 --- ## Network nodes - Relay chain nodes: the validators πŸ’ͺ - Collator nodes: the parachain nodes (or sequencers) ⚑️ --- Chains need to be prepared to be able to connect to the relay chain. A couple key points: - Registering parachain ID - Spec raw, genesis header, genesis state, genesis wasm --- ## Quest #1 πŸ”Ž --- ## Clone and download the workshop repo - Contains binaries for the relay chain node and the parachain node - Compiled `polkadot-v1.1.0` including all its system parachains Fun fact: the entire repo took 61m 19s minutes using the Macbook pro M1 chip. 🀯 But that's a lot of parachain binaries ... _you don't want to do this!_ --- ## Taking a look at the binaries.. πŸ‘€ Note: https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot#installing-the-polkadot-binaries ## Install Zombienet Although you can set up zombienet to on the system path of your machine, I recommend this: ```bash wget https://github.com/paritytech/zombienet/releases/download/v1.3.68/zombienet-macos -P ``` or download from the workshop release: https://github.com/sacha-l/local-polkadot-testnet/releases --- ## Big picture πŸ–ΌοΈ _(while we wait for Zombienet to install.. )_ - Take the relay chain binary (polkadot) - Take our parachain binary - Pass them into a config - Run the network with tests --- ## Zombienet CLI 🧟 Now that we've successfully installed Zombienet, let's check out the CLI commands.. Note: https://paritytech.github.io/zombienet/cli/index.html --- ## Node CLI Fun little activity.. πŸ™ˆ Run to interact with your node: ```bash ./bin/polkadot-parachain --help ./bin/pokadot subkey ``` --- ## Set up a simple parachain network πŸ›œ We'll do this together! Launch a network with a single parachain. --- ### Checklist βœ… _Make sure your binaries can be executed for e.g.: `chmod +x`_ - Create a `Config.toml` file to specify how we want to configure the network - Run the `zombienet spawn` command ```bash zombienet-macos -p native spawn ./bin/config.toml ``` Note: See Windows [setup instructions](https://github.com/Polkadot-Blockchain-Academy/pba-zombienet?tab=readme-ov-file#windows) --- ## Download your appchain binaries For this workshop we'll use the provided binary from the repository provided. 😎 --- ## Launch the network πŸš€ ```bash ./zombienet/zombienet-macos -p native -l silent spawn ./zombienet/Config.toml ``` --- # 🚘 Let's have a look what Zombienet does under the hood... - `./bin/polkadot build-spec --chain rococo-local` - `./bin/polkadot-parachain --name parachain-collator01 --node-key` Note: Alice, Bob and Charlie are funded too --- ## Go further: add new system chains to the network and run tests πŸ‹οΈ - Using the binaries in the folder, add new system chains - Update the config file to include different cross-chain tests --- ## Troubleshooting - make sure the permissions for your binaries are updated `chmod +x` - check your zombienet version is up to date (or recent enough!) ---