torvyon-core 0.1.3

Keys, addresses, post-quantum signing and transaction building for the Torvyon blockchain
Documentation

torvyon-core

ML-DSA-65 post-quantum keys, qbt1/tqbt1 addresses, signing, and V4 transaction support for the Torvyon blockchain.

Pure logic — no network, no I/O, no async. Encodings are tested against vectors generated by the Torvyon node and the public TypeScript SDK.

Post-quantum keys and addresses

use torvyon_core::{pq::{PQKeypair, PQNetwork}, pq_sign, pq_verify};

let seed = [0u8; 32];
let wallet = PQKeypair::from_seed(&seed);
let address = wallet.address(PQNetwork::Mainnet)?; // qbt1…
let testnet_address = wallet.address(PQNetwork::Testnet)?; // tqbt1…

let message = b"Torvyon PQ test";
let signature = wallet.sign(message)?;
assert!(pq_verify(wallet.public_key(), message, signature.as_bytes()));

ML-DSA-65 uses 1,952-byte public keys, 4,032-byte expanded private keys, and 3,309-byte signatures. qbt1 is the mainnet PQ address family and tqbt1 is the testnet PQ address family.

PQ V4 witnesses

UnsignedV4Transaction supports ML-DSA-65 witness signatures. Build the V4 base transaction, then sign an input locally with sign_pq_input or attach a verified external signature with with_pq_signature. The wire scheme is mldsa65.

let signed = unsigned.sign_pq_input(0, &wallet)?.finish()?;
let body = signed.to_json()?;

Networks and integration

Amounts are exact nibbles (1 Byte = 100,000,000 nibbles); no floats are used. Private key material is redacted in Debug output and zeroized where held by the core key types.

The crate retains the original transaction APIs for applications migrating to the PQ format. New integrations should use the ML-DSA-65 APIs above.

Protocol specification, test vectors, and the node API (OpenAPI) are in the repository. JavaScript/TypeScript: @torvyon/sdk.

License: MIT.