Convenience package providing unified access to all Typeberry core packages.
@typeberry/lib is a meta-package that re-exports all Typeberry modules under namespaced identifiers. This simplifies imports when working with multiple Typeberry packages and ensures version compatibility across the entire stack.
npm install @typeberry/lib
Instead of installing and importing individual packages:
// Without @typeberry/lib
import { Blake2b } from "@typeberry/hash";
import { Codec } from "@typeberry/codec";
import { ed25519 } from "@typeberry/crypto";
You can import everything from a single package:
// With @typeberry/lib
import { hash, codec, crypto } from "@typeberry/lib";
const blake2b = await hash.Blake2b.createHasher();
const descriptor = codec.Codec.from(schema);
const keypair = await crypto.ed25519.generateKeypair();
The following modules are available as namespaced exports:
block - Block structures and typesblock_json - JSON serialization for blocksbytes - Byte array utilitiescodec - SCALE codec implementationcollections - Specialized data structuresconfig - Configuration typesconfig_node - Node configuration utilitiescrypto - Cryptographic primitives (Ed25519, Sr25519, BLS)database - Database abstractionserasure_coding - Erasure coding implementationfuzz_proto - Fuzzing protocol supporthash - Hashing functions (Blake2b, etc.)jam_host_calls - JAM-specific host callsjson_parser - JSON parsing utilitieslogger - Logging frameworkmmr - Merkle Mountain Range implementationnumbers - Fixed-size numeric typesordering - Ordering and comparison utilitiespvm - PVM debugger adapterpvm_host_calls - PVM host call implementationspvm_interpreter - PVM bytecode interpreterpvm_program - PVM program utilitiespvm_spi_decoder - Standard PVM Interface decodershuffling - Shuffling algorithmsstate - State managementstate_json - JSON serialization for statestate_merkleization - State Merkleizationstate_vectors - State test vectorstransition - State transition functionstrie - Trie data structuresutils - General utilitiesimport { state, crypto, hash } from "@typeberry/lib";
const blake2b = await hash.Blake2b.createHasher();
const stateRoot = await state.calculateStateRoot(stateData, blake2b);
const signature = await crypto.ed25519.sign(message, secretKey);
import { codec, bytes } from "@typeberry/lib";
const descriptor = codec.Codec.from(schema);
const encoded = descriptor.encode(data);
const decoded = descriptor.decode(encoded);
import { pvm_interpreter, pvm_program, pvm_host_calls } from "@typeberry/lib";
const program = pvm_program.PvmProgram.from(bytecode);
const interpreter = new pvm_interpreter.Interpreter(program, hostCalls);
const result = interpreter.run();