pub struct Transaction {
pub chain_id: ChainId,
pub from: Address,
pub to: Address,
pub nonce: Nonce,
pub tx_type: TransactionType,
pub gas_limit: u64,
pub gas_price: u64,
pub timestamp: Timestamp,
pub memo: Option<String>,
pub pq_public_key: Vec<u8>,
}Expand description
A transaction on Tenzro Network
Transactions represent actions taken by accounts, including transfers, smart contract calls, agent operations, and model inference requests.
§Note
The Default implementation creates a transaction with zero values
and is intended for testing purposes only. Production transactions
should be created with Transaction::new() and properly signed.
§Post-quantum migration
The pq_public_key field carries the ML-DSA-65 verifying key bytes
(FIPS 204, exactly 1952 bytes) and is mandatory. Tenzro Network does
not support classical-only transactions — the field has no Option
wrapper and no serde(default). Decoders reject any payload that omits
or mis-sizes this field. There is no legacy fallback: a classical-only
transaction cannot be constructed in this codebase and cannot be parsed
from any external source.
Fields§
§chain_id: ChainIdThe chain ID this transaction is valid for
from: AddressThe sender’s address
to: AddressThe recipient’s address (or contract address)
nonce: NonceThe nonce for replay protection
tx_type: TransactionTypeThe transaction type and payload
gas_limit: u64Maximum gas to spend
gas_price: u64Gas price in the smallest unit of TNZO
timestamp: TimestampTransaction timestamp
memo: Option<String>Optional memo or metadata
pq_public_key: Vec<u8>ML-DSA-65 verifying key bytes (FIPS 204, exactly 1952 bytes).
Bound into the hash() preimage so a hybrid signer commits to the PQ
key before signing and any key-substitution attempt invalidates the
transaction.
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn new(
chain_id: ChainId,
from: Address,
to: Address,
nonce: Nonce,
tx_type: TransactionType,
gas_limit: u64,
gas_price: u64,
pq_public_key: Vec<u8>,
) -> Self
pub fn new( chain_id: ChainId, from: Address, to: Address, nonce: Nonce, tx_type: TransactionType, gas_limit: u64, gas_price: u64, pq_public_key: Vec<u8>, ) -> Self
Creates a new transaction. The pq_public_key is the ML-DSA-65
verifying key bytes (FIPS 204, exactly 1952 bytes) and is mandatory —
classical-only transactions are not constructible.
Sourcepub fn hash(&self) -> Hash
pub fn hash(&self) -> Hash
Computes the SHA-256 hash of the transaction.
The preimage layout is the canonical signing surface for the network.
The mandatory ML-DSA-65 verifying key (pq_public_key) is included
with an explicit u32 little-endian length prefix so the preimage
is unambiguous and a key-substitution attempt invalidates the hash.
Trait Implementations§
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Transaction
impl Debug for Transaction
Source§impl<'de> Deserialize<'de> for Transaction
impl<'de> Deserialize<'de> for Transaction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Transaction
Source§impl PartialEq for Transaction
impl PartialEq for Transaction
Source§fn eq(&self, other: &Transaction) -> bool
fn eq(&self, other: &Transaction) -> bool
self and other values to be equal, and is used by ==.