Expand description
Core TRON primitives: addresses, amounts, resource codes, signatures.
§tronz-primitives
Leaf primitive types for the tronz TRON SDK.
This crate performs no network I/O and contains no protobuf code. It only defines the small, widely-shared value types that every other crate in the workspace depends on.
§Types
| Type | Description |
|---|---|
Address | 21-byte TRON address (0x41 prefix + 20-byte body); parses base58check (T…) and hex |
Trx | Amount denominated in sun (1 TRX = 1_000_000 sun); wraps i64 to match protobuf |
ResourceCode | Bandwidth, Energy, or TronPower — the stakeable network resources |
RecoverableSignature | 65-byte r ‖ s ‖ v secp256k1 signature with embedded recovery id |
Common byte/arithmetic types (U256, B256, Bytes, keccak256) are
re-exported from alloy_primitives so the rest of the workspace has a single
import surface.
§License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Structs§
- Address
- A TRON network address (
0x41prefix + 20-byte body). - Bytes
- Wrapper type around
bytes::Bytesto support “0x” prefixed hex strings. - Recoverable
Signature - A secp256k1 ECDSA signature plus the recovery id needed to recover the signing public key.
- Trx
- An amount of TRX, stored internally as
i64sun.
Enums§
- Address
Error - Errors produced when parsing or validating a TRON
Address. - Amount
Error - Errors produced when constructing a
Trxamount. - Resource
Code - The kind of network resource obtained by staking TRX.
- Signature
Error - Errors produced when constructing a
RecoverableSignature.
Constants§
- ADDRESS_
LEN - Length of a raw TRON address in bytes (prefix + 20-byte body).
- ADDRESS_
PREFIX - The TRON mainnet address prefix byte.
- EVM_
ADDRESS_ LEN - Length of the EVM-style address body (without the
0x41prefix). - SIGNATURE_
LEN - Length of the serialized signature:
r(32) || s(32) || v(1). - SUN_
PER_ TRX - Number of sun in one TRX.
Functions§
- keccak256
- Simple interface to the
Keccak-256hash function.
Type Aliases§
- B256
- 32-byte fixed byte-array type.
- TxId
- A transaction id:
sha256of the protobuf-encoded raw transaction. - U256
- 256-bit unsigned integer type, consisting of 4, 64-bit limbs.