Target Audience: This guide is for systems engineers, security engineers, and cryptographers who want to build and run the replica from source. If you’re an app developer looking to deploy canisters, use the Canister SDK instead.
Prerequisites
Before building the replica, ensure your system meets these requirements:System Requirements
Hardware
- x86-64 based system
- Minimum 16 GB RAM/SWAP
- 100 GB available disk space
Software
- Ubuntu 22.04 or newer
- Podman installed and configured
- Git for cloning the repository
Install Podman
Podman is required for the containerized build environment:Clone the Repository
Building the Replica
The IC repository uses Bazel as its build system, with a containerized build environment for reproducibility.Build Environment
The repository provides a containerized development environment that includes all necessary dependencies:Enter the development container
The This command will:
container-run.sh script automatically pulls or builds the container image and drops you into a shell:- Check for Podman installation
- Pull the
ic-devcontainer image from GitHub Container Registry - Mount your repository and cache directories
- Start an interactive shell inside the container
The first run will download a container image (~2-4 GB). Subsequent runs will reuse the cached image.
Build the replica binary
Inside the container, use Bazel to build the replica:The replica binary will be available at:
Build specific components
Build specific components
You can also build specific subsets of the IC:Build only binaries:Build only canisters:Build IC-OS images:
Verifying the Build
Check the replica binary
Verify the replica binary was built successfully:You should see the binary with a size of several hundred MB.
Verify binary hash
Check the integrity of built binaries using SHA256 checksums:
Example SHA256SUMS output
Example SHA256SUMS output
Running the Replica
The replica binary (bazel-bin/rs/replica/replica) is the core Internet Computer node software. It requires:
- A valid configuration file specifying network topology
- Cryptographic keys for the node
- State directories for blockchain data
- Connection to other replicas (or specific test configuration)
Development Testing
For development and testing purposes, you can:- Unit Tests
- Integration Tests
- Development Images
Run individual component tests:
Code Quality Checks
Before submitting changes, run the linting and formatting checks:Next Steps
Architecture
Understand the replica’s internal architecture
Development
Learn about contributing to the codebase
Testing
Explore the testing infrastructure
IC-OS
Deep dive into the operating system images
Troubleshooting
Podman is not responding
Podman is not responding
If For rootless Podman issues, check:
podman info fails, ensure the Podman service is running:Build fails with 'disk space' error
Build fails with 'disk space' error
The build process requires significant disk space. Check available space:If running low, clean up Bazel cache:
Container image pull fails
Container image pull fails
If the container image pull fails, you can build it locally:This will build the container image from the Dockerfile in
ci/container/.'Working directory is not clean' error
'Working directory is not clean' error
The build script requires a clean Git working directory:
System Architecture Notes
The replica is a complex distributed system with multiple components:- Consensus Layer: Implements the Internet Computer consensus protocol
- Execution Environment: Runs WebAssembly canisters
- Message Routing: Handles cross-subnet communication (XNet)
- Crypto Layer: Provides threshold cryptography and signatures
- Networking: P2P communication between replicas
- State Manager: Manages blockchain state and checkpoints
Additional Resources
- Repository: github.com/dfinity/ic
- Technical Documentation: IC Interface Specification
- Community Forum: forum.dfinity.org
- Rust Docs: docs.dfinity.org