# torvyon-core
ML-DSA-65 post-quantum keys, `qbt1`/`tqbt1` addresses, signing, and V4
transaction support for the [Torvyon](https://torvyon.tech) 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
```rust
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`.
```rust
let signed = unsigned.sign_pq_input(0, &wallet)?.finish()?;
let body = signed.to_json()?;
```
## Networks and integration
- Mainnet: `torvyon-mainnet`, `qbt1…`
- Testnet: `torvyon-testnet-1`, `tqbt1…`
- Testnet faucet: <https://testnet.torvyon.tech/faucet/>
- Mainnet API: <https://api.torvyon.tech>
- Testnet API: <https://testnet.torvyon.tech>
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](https://gitlab.com/JAFF7/torvyon-sdk). JavaScript/TypeScript:
[`@torvyon/sdk`](https://www.npmjs.com/package/@torvyon/sdk).
License: MIT.