A fresh FABRIC-based Tetcore node, ready for hacking 🚀
This is a minimal Tetcore node template for rapid blockchain prototyping. It provides a foundation for building custom blockchains based on the Tetcore framework.
cargo build --release# Start a development chain
./target/release/tetcore-node-template --dev
# Purge dev chain
./target/release/tetcore-node-template purge-chain --devtetcore-node-template/
├── Cargo.toml # Workspace root
├── node/ # Node binary
│ ├── Cargo.toml
│ └── src/main.rs
├── runtime/ # Runtime (state transition function)
│ ├── Cargo.toml
│ └── src/lib.rs
└── modules/template/ # Sample module
├── Cargo.toml
└── src/lib.rs
The node directory contains the blockchain node implementation:
- chain_spec.rs - Chain specification (genesis configuration)
- service.rs - Node service implementation
- main.rs - Binary entry point
Define your chain's initial state in chain_spec.rs:
- Boot nodes
- Protocol ID
- Token properties (symbol, decimals)
- Genesis accounts and balances
The runtime is the core logic that validates transactions and executes state changes.
- Transaction: Replaces "Extrinsic" - a unit of work submitted to the network
- Module: Replaces "Pallet" - a modular runtime component
- Fabric: Replaces "FRAME" - the framework for building runtimes
Add custom modules to extend functionality:
pub trait Config {
type AccountId;
type Event;
type Call;
}A sample module demonstrating the module structure.
- Create
modules/my-module/src/lib.rs:
use serde::{Deserialize, Serialize};
pub struct Module<T: Config> {
_config: std::marker::PhantomData<T>,
}
pub trait Config {
type AccountId;
}- Add to
runtime/Cargo.toml:
my-module = { path = "../modules/my-module" }- Include in runtime.
#[derive(Serialize, Deserialize)]
pub enum Transaction {
Transfer { to: AccountId, value: Balance },
Custom { call: Call },
}#[storage]
pub struct StorageMap<T: Config> {
_data: std::marker::PhantomData<T>,
}- Tetcore Framework - Main Tetcore implementation
- Tetcore Specifications - Protocol specifications
MIT License - see LICENSE file for details.