Skip to main content

Installation

cairn is available for five languages. Pick yours and follow the steps below.

Prerequisites

LanguageVersionPackage ManagerInstall Command
Rust1.75+Cargocargo add cairn-p2p
TypeScriptNode 18+npmnpm install cairn-p2p
Go1.24+Go modulesgo get github.com/moukrea/cairn/packages/go/cairn-p2p
Python3.11+pippip install cairn-p2p
PHP8.2+Composercomposer require moukrea/cairn-p2p

Install

cargo add cairn-p2p

Verify Your Installation

Create a node and print your peer ID to confirm everything is working:

use cairn_p2p::{Node, CairnConfig, create};

let node = create(CairnConfig::default())?;
node.start().await?;
println!("Peer ID: {}", node.peer_id());

Common Issues

  • Minimum edition: cairn requires Rust edition 2021 or later. Make sure your Cargo.toml has edition = "2021" or newer.
  • Async runtime: cairn uses Tokio. Ensure you have tokio as a dependency with the full feature enabled.