MCPcopy Index your code
hub / github.com/canopy-network/tanssi

github.com/canopy-network/tanssi @perm-v.1.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release perm-v.1.1 ↗ · + Follow
838 symbols 1,921 edges 133 files 161 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

A permissionless appchain infrastructure protocol designed for swift and effortless deployment of application-specific blockchains

🔎 For more about Tanssi Network, head to our website

📢 Follow our latest updates on Twitter

🤝 Engage with fellow developers on our Discord server

Build the Tanssi Node

To build Tanssi, you will need a proper Substrate development environment.

If you need a refresher setting up your Substrate environment, see Substrate's Getting Started Guide.

# Fetch the code
git clone https://github.com/moondance-labs/tanssi
cd tanssi

# Build the node (The first build will be long (~30min))
cargo build --release

Run tests

Tanssi has Rust unit tests as well as typescript integration tests. These tests are run in CI, and can also be run locally. Tanssi tests (specially those in typescript) depend on sessions being shorter, so you probably want to compile the node first as:

# Build the node with short session times
cargo build --features=fast-runtime --release

Then to run the tests:

# Run the Rust unit tests
cargo test --features=fast-runtime --release

Typescript tests are run with Moonwall. To run these you will need to have pnpm installed:

# Install moonwall
sudo npm i -g pnpm  

# Install dependencies
pnpm i

# Run manual seal orchestrator tests
pnpm moonwall test dev_tanssi

# Run zombienet tests (with container-chains)
pnpm moonwall test zombie_tanssi

Moonwall lets you also run the testing environment wihtout performing any tests on it, as a method for you to manually test certain things:

# Spin up single manual-seal orchestrator
pnpm moonwall run dev_tanssi

# Spin up orchestrator and two container-chains with zombienet
pnpm moonwall run zombie_tanssi

Sealing options

The command above will start the node in instant seal mode. It creates a block when a transaction arrives, similar to Ganache's auto-mine. You can also choose to author blocks at a regular interval, or control authoring manually through the RPC.

# Author a block every 6 seconds.
./target/release/tanssi-node --dev --sealing 6000

# Manually control the block authorship and finality
./target/release/tanssi-node --dev --sealing manual

Prefunded Development Addresses

Running Tanssi in development mode will pre-fund several well-known addresses that (mostly) These addresses are derived from using the well known private key bottom drive obey lake curtain smoke basket hold race lonely fit walk and appending the account name as a hard derivation key to the seed above, e.g., bottom drive obey lake curtain smoke basket hold race lonely fit walk//Alice:

# Alice:
- Address: 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY

# Bob:
- Address: 5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty

# Charlie:
- Address: 5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y

# Dave:
- Address: 5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy

# Eve:
- Address: 5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw

# Ferdie:
- Address: 5CiPPseXPECbkjWCa6MnjNokrgYjMqmKndv2rSnekmSK2DjL

Runtime Architecture

The Tanssi Runtime is built using FRAME and consists of pallets from substrate, frontier, cumulus, and pallets/.

From substrate:

  • Balances: Tracks token balances
  • Sudo: Allows a privileged account to make arbitrary runtime changes - will be removed before launch
  • Timestamp: On-Chain notion of time
  • Transaction Payment: Transaction payment (fee) management
  • Authorship: A pallet where authorship information for orchestrator is stored
  • CollatorSelection: A pallet that selects collators to be assigned to author in container-chains and orchestrator
  • Session: A pallet that handles session-changes and keys
  • AuthorityMapping: A pallet that handles a mapping between collator accounts and authority keys

From cumulus:

  • ParachainSystem: A helper to perform relay-storage verifications and injection of cross-chain messages
  • ParachainInfo: A place to store parachain-relevant constants like parachain id

The following pallets are stored in pallets/. They are designed for Tanssi's specific requirements:

  • Registrar: A pallet that stores all registered container-chains
  • Configuration: A pallet storing the current configuration from which several other components depend
  • CollatorAssignment: A pallet implementing collator account to orchestrator/container-chain assignment
  • AuthorityAssignment: A pallet implementing collator authority key to orchestrator/container-chain assignment
  • Initializer: A pallet that handles everything that happens on a session-change
  • AuthorNoting: A pallet that stores the latest author of each of the container-chains

When modifying the git repository for these dependencies, a tool called diener can be used to replace the git URL and branch for each reference in all Cargo.toml files with a single command. This alleviates a lot of the repetitive modifications necessary when changing dependency versions.

Container-chain templates

Currently two templates are offered within this repository

  • Simple template: Which ressembles the parachain-template node from cumulus and substrate, and only basic pallet like pallet-balances, parachain-system and basic configuration.

  • Frontier template: Which ressembles a moonbeam-alike chain, with all pallets necessary for evm and ethereum compatibility

Build container-chain nodes (full nodes only, not collators)

These nodes will only act as full nodes, but not as collators since these are offered by Tanssi:

# Build the simple-template node
cargo build -p container-chain-template-simple-node --release
# Build the frontier-template node
cargo build -p container-chain-template-frontier-node --release

Run with Zombienet directly

You can directly use the zombieTanssi.json file and pass it to zombienet to spawn yourself the network. From the test directory you can do:

# Generates the latest specs for orchestrator and container-chains
npm run build-spec

# Spawns Tanssi and container-chains with zombienet
/path/to/zombienet spawn -p native ./configs/zombieTanssi.json

Extension points exported contracts — how you extend this code

Config (Interface)
(no doc) [21 implementers]
pallets/registrar/src/lib.rs
Config (Interface)
(no doc) [27 implementers]
container-chains/pallets/authorities-noting/src/lib.rs
GetSessionIndex (Interface)
Returns current session index. [3 implementers]
primitives/traits/src/lib.rs
WeightInfo (Interface)
Weight functions needed for pallet_configuration. [2 implementers]
pallets/configuration/src/weights.rs
WeightInfo (Interface)
Weight functions needed for pallet_author_noting. [2 implementers]
pallets/author-noting/src/weights.rs
ApplyNewSession (Interface)
The apply_new_sseion trait. We need to comply with this [2 implementers]
pallets/initializer/src/lib.rs
Config (Interface)
(no doc) [3 implementers]
pallets/services-payment/src/lib.rs
Config (Interface)
(no doc) [3 implementers]
pallets/collator-assignment/src/mock.rs

Core symbols most depended-on inside this repo

clone
called by 171
container-chains/templates/frontier/node/src/rpc/eth.rs
clone
called by 127
node/src/service.rs
map
called by 121
primitives/collator-assignment/src/lib.rs
clone
called by 80
node/src/cli.rs
run_to_block
called by 38
pallets/collator-assignment/src/mock.rs
run_to_block
called by 20
pallets/configuration/src/mock.rs
new_test_ext
called by 20
pallets/registrar/src/mock.rs
run
called by 16
container-chains/pallets/authorities-noting/src/mock.rs

Shape

Method 372
Function 280
Class 125
Interface 38
Enum 23

Languages

Rust94%
TypeScript6%

Modules by API surface

node/src/command.rs36 symbols
container-chains/templates/simple/node/src/command.rs35 symbols
container-chains/templates/frontier/node/src/command.rs35 symbols
node/src/service.rs33 symbols
pallets/author-noting/src/mock.rs30 symbols
client/consensus/src/consensus_orchestrator.rs27 symbols
pallets/registrar/src/tests.rs24 symbols
runtime/dancebox/tests/integration_test.rs23 symbols
pallets/configuration/src/lib.rs23 symbols
node/src/cli.rs21 symbols
container-chains/pallets/authorities-noting/src/lib.rs21 symbols
container-chains/templates/frontier/runtime/src/lib.rs20 symbols

For agents

$ claude mcp add tanssi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page