Transaction

A transaction is a signed section of data that is broadcast to the network and collected into blocks. It typically references previous transaction(s) and dedicates a certain number of novacoins from it to one or more new public key(s).

Currently there are a few transaction types possible.

User operation

This transactions are typically used to redeem novacoins from unspent inputs. It generally references unspent input(s) and creates a new output(s) with specified value(s) an destination(s).

Coinbase

Coinbase have a single input, and this input has a 'coinbase' parameter instead of a scriptSig. The data in 'coinbase' can be anything; it isn't used. Novacoin puts the current compact-format target and the arbitrary-precision 'extraNonce' number there, which increments every time the Nonce field in the block header overflows. The extranonce contributes to enlarge the domain for the proof of work function.

This transactions are used to reward the Proof-of-Work miners. Proof-of-stake blocks have the coinbase transaction too, but with empty output.

Coinstake

This transactions are used to provide a suitable proof for Proof-of-Stake block header. This type is similar to user transactions, but with some differences.

General format of a transaction

FieldTypesizeofDescription
Versionunsigned int4Currently 1
Timestampunsigned int4Transaction timestamp
Inputs countvariable int1 - 9-
Inputs arrayTxIn[]inputs set sizeInputs array or coinbase property
Outputs countvariable int1 - 9-
Outputs arrayTxOut[]outputs set sizeArray of output structures
Lock timeunsigned int4block height or timestamp when transaction is final

Input format

An input is a reference to an output in a different transaction. Multiple inputs are often listed in a transaction. The values of the referenced outputs are added up, and the total is usable in the outputs of this transaction.

FieldTypesizeofDescription
txidunsigned char[]32ID of previous transaction
nunsigned int4Number indexing an output of the to-be-consumed transaction
scriptSigLengthvariable int1-9scriptSig length
scriptSigunsigned char[]-first half of script, signatures for the scriptPubKey
nSequenceunsigned int4Transaction variant number, irrelevant if nLockTime isn't specified. 0xffffffff by default, see this link for a detailed explanation.

Output format

An output contains instructions for sending novacoins. Value is the number of Satoshi (1 NVC = 1,000,000 Satoshi) that this output will be worth when claimed.

FieldTypesizeofDescription
nValueunsigned long int8the number of Satoshis(NVC/106) to be transfered
scriptPubKeyLengthvariable int1-9scriptPubKey length
scriptPubKeyunsigned char[]-second half of script, spending instructions

Destinations

There are three destination types allowed for user and coinbase transactions:

Pay-to-Pubkey

 scriptPubKey: [pubKey] OP_CHECKSIG
 scriptSig: [sig]

Pay-to-PubkeyHash

 scriptPubKey: OP_DUP OP_HASH160 [pubKeyHash] OP_EQUALVERIFY OP_CHECKSIG
 scriptSig: [sig] [pubKey]

Pay-to-ScriptHash

Send to script hash:

 scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] OP_EQUAL
 scriptSig: <depending on inputs type>

Redeem example:

 scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] OP_EQUAL
 scriptSig: [signature] {[pubkey] OP_CHECKSIG}

Empty destinations

 scriptPubKey: (empty)
 scriptSig: (empty)

Non-standard scripts

Anyone-can-spend:

 scriptPubKey: (empty)
 scriptSig: OP_TRUE

BasisNetwork basicsClient softwareRelated pages
Valid XHTML 1.0 Transitional Valid XHTML 1.0 Transitional Valid CSS Valid CSS      I find a bug/typo or I have a suggestion
Adapted for Lynx-like browsers
2013-2017 © Zloy & Co
For donations: 4ZLoY6T8wXKgrbZM9gL8fQt48NUzGo2yAg