Chapter 11 · Platform
One interface file, field by field — plus the script classes that actually do transaction-shaped work. The chapter's value is the boundary: this library describes, wallets build.
FIGURE 11.1 · The boundary the library sits on.
src/transaction/RawTransaction.ts is 24 lines and every one of them is a field. Read it
as a decoder map for getrawtransaction output, not as a builder:
| Field | Type | What it tells you |
|---|---|---|
hex | string | The serialised transaction — the only field a node will accept back |
txid | string | Double-SHA256 of the transaction, byte-reversed for display |
overwintered | boolean | Whether the Zcash-era Overwinter format applies |
version / versiongroupid | number / string | Format generation. Verus inherits Zcash's version-group scheme, which is why both exist |
locktime, expiryheight | number | Earliest spend height, and the height after which the tx is no longer valid |
vin / vout | ApiPrimitive[] | Inputs and outputs — deliberately untyped here (see below) |
vjoinsplit, vShieldedSpend, vShieldedOutput, bindingSig | arrays / string | The shielded half of the format; empty on transparent transactions |
valueBalance / valueBalanceZat | number | Net shielded value, in VRSC and in zats |
blockhash, height, confirmations, time, blocktime | optional | Present only when the tx is confirmed and the node was asked for block context |
vin and vout are untyped
They are Array<ApiPrimitive> — a permissive type covering the JSON shapes the
daemon returns for a scriptSig, a scriptPubKey, a reserve transfer output, an identity output. Typing
every output shape would mean mirroring the daemon's entire RPC schema; the library deliberately does
not. The practical consequence: you can read a transaction confidently, and you should not
construct one from these types.
The script layer, under pbaas/transaction/:
| Class | Shape | Used by |
|---|---|---|
VerusScript | chunks: ScriptChunk[]; buffer ⇄ chunks via compile/decompile | Any output script; throws "Cannot deserialize a truncated script push" on a bad read |
SmartTransactionScript | Smart-transaction output script | Reserve transfers and PBaaS operations |
IdentityScript | Identity-bearing output script | Identity registration and updates |
VerusScript is the one to read: fromBuffer decompiles a slice into chunks and
refuses a truncated push, which is the same class of error you would otherwise only see as an invalid
script on the node.
There is no input selection, no fee estimation, no signing loop, no toHex() for a
transaction you assembled. In the reference applications built on this library, transaction construction happens in the
wallet and in the provisioning webhook's RPC calls (registernamecommitment,
registeridentity) — not in this package. When a task says "build a tx", the work is
elsewhere; this library's job is the object that goes inside it.
src/transaction/RawTransaction.ts # the whole directory src/pbaas/transaction/VerusScript.ts # chunks ⇄ script bytes src/pbaas/transaction/SmartTransactionScript.ts src/pbaas/transaction/IdentityScript.ts src/utils/script.ts # compile() / decompile() src/utils/pushdata.ts # OP_PUSHDATA encoding