How to Build and Run Astar Network from Source

May 25, 2022 | Blockchain

Astar Network is an interoperable blockchain based on the Substrate framework and serves as a hub for decentralized applications (dApps) within the Polkadot Ecosystem. In this article, we will guide you through the process of building and running Astar Network from source code.

Prerequisites

Before you begin, ensure you have the following:

  • macOS or Debian-based operating system
  • Basic understanding of terminal commands
  • Git installed on your machine
  • Cargo and Rust setup (check the Rust installation guide)

Setting Up the Development Environment

Getting your development environment ready is critical for a smooth setup. Here’s a step-by-step guide:

# Install Substrate development environment via the automatic script
curl https://getsubstrate.io -sSf | bash -s -- --fast

# Clone the Git repository
git clone --recurse-submodules https://github.com/AstarNetwork/Astar.git

# Change current working directory
cd Astar

# Compile the node
curl build --profile production

# Show list of available commands
./target/production/astar-collator --help

Purchasing a car is akin to compiling code; initially, the driving process might seem daunting, but once you’ve navigated past the complexity of the dealership (as in setting up your environment), the thrill of the open road (sorting through compiled code) awaits. Just remember, if you encounter any hiccups along the way—like not having the right tools (wasm32-unknown-unknown)—don’t hesitate to equip yourself with the necessary resources.

Building with Nix

If you prefer using Nix, here’s how to build Astar:

# Install Nix package manager
curl https://nixos.org/nix/install | sh

# Run from root of the project folder (Astar folder)
nix-shell -I nixpkgs=channel:nixos-21.05 ./third-party/nix-shell.nix --run cargo build --release

Running a Collator Node

To set up a collator node, follow these steps:

# Start the Shiden collator node
./target/release/astar-collator \
   --base-path path_to_save_blocks \
   --name node_display_name \
   --port 30333 \
   --rpc-port 9944 \
   --telemetry-url wss://telemetry.polkadot.io/submit 0 \
   --rpc-cors all \
   --collator

# Send rotate_keys request
curl -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"author_rotateKeys","id":1}' localhost:9933

Following the completion of the process, you should have a validator node online equipped with a session key that identifies your node. It feels akin to starting a new journey with your freshly built vehicle—just make sure you familiarize yourself with the controls (owning your session key) to cruise smoothly.

Troubleshooting

As you embark on this journey, you may encounter some obstacles. Here are some troubleshooting ideas:

  • If you receive errors related to the wasm32-unknown-unknown toolchain, ensure it’s installed and updated.
  • If the collator node fails to start, double-check your command arguments for any typos.
  • For key management and validator rewards, refer to our validator guide online.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Versioning and Dependency Management

Understanding versioning is critical for effective project management. Here are the key points:

  • Astar Network has a standard semantic versioning approach and a new runtime versioning approach.
  • Dependencies should be managed in the root Cargo.toml file.
  • When adding a dependency, always check if it’s already defined to avoid duplication.

Further Reading

If you are looking for more resources and information, check out the following links:

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox