§ 05

§ 05 · Transactions

Inputs

Which coins you are spending

An input says which coin you are spending. It doesn’t hold the coin or its value. It just points at an output of an earlier transaction, the way a cheque names an account.

Each input is 41 bytes: a pointer, an empty field and a sequence number. The signature that proves you may spend the coin isn’t in the input at all. It travels in the witness, matched to the input by position.

Try it

Pick the two-input example and hover each input’s fields.

Transaction decoder

Paste raw hex: every byte colored and explained

2 inputs, 2 outputs (block 130,822) 312 bytes
01000000000102207decc85aaf210383704c39294c193864bf8e4255984abab5fe19a891ea0fc50000000000ffffffffd5da316cc9db4a367ce18ef27fb76809601a7fde2d111844962fc7584fceadf70000000000ffffffff02782d7c07000000002251206f03b8c53fff74f0b22844a62fb29f822fda5f4e062d492f1d91bf567361a340c07fdc0b00000000225120e407fefe99e7ae5957da27b1565b4c9568fcd0a7c1b01ee8b79e694f0ec52fbd0140bcdee9e8c70a956f0faf3f19324ff7595aa9d6d377010f12a392d5dfb8a20b05076090f11d7d6523f995c316c40b5c4c635853491a29dd5367e54e899e46063801409c9a3f1689bc718d7cbf2639e1433e7bb0f01896c7f2c14a565d515c41a5b5cd0e4a748978492d8dbda559088b66ef79003d421098cc25ef4ab05b39256790b800000000
Hover or focus the bytes, or a row below, to name each field
All 26 fields
FieldBytesValue
Versionversion4@01int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.
Markermarker1@40x00Segwit marker (BIP-144): says witness data follows the outputs.
Flagflag1@50x01Witness flag; 0x01 is the only value Pearl accepts.
Input countvin.length1@62CompactSize number of inputs.
Previous txidvin[0].txid32@7c50fea91a819feb5ba4a9855428ebf6438194c29394c70830321af5ac8ec7d20The transaction being spent, stored byte-reversed (internal order); shown here in normal display order.
Output indexvin[0].vout4@390Which output of that transaction is spent (uint32 LE).
scriptSig lengthvin[0].scriptSig.length1@430Always 0 for non-coinbase inputs in Pearl: every spend uses the witness instead.
Sequencevin[0].sequence4@440xffffffffFinal (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Previous txidvin[1].txid32@48f7adce4f58c72f964418112dde7f1a600968b77ff28ee17c364adbc96c31dad5The transaction being spent, stored byte-reversed (internal order); shown here in normal display order.
Output indexvin[1].vout4@800Which output of that transaction is spent (uint32 LE).
scriptSig lengthvin[1].scriptSig.length1@840Always 0 for non-coinbase inputs in Pearl: every spend uses the witness instead.
Sequencevin[1].sequence4@850xffffffffFinal (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Output countvout.length1@892CompactSize number of outputs.
Amountvout[0].value8@90125,578,616 grains (1.25578616 PRL)int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script lengthvout[0].scriptPubKey.length1@9834CompactSize length of the locking script.
Locking scriptvout[0].scriptPubKey34@99prl1pdupm33flla60pv3ggjnzlv5lsgha5h6wqck5jtcajxl4vump5dqq3mvacrOP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Amountvout[1].value8@133199,000,000 grains (1.99000000 PRL)int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script lengthvout[1].scriptPubKey.length1@14134CompactSize length of the locking script.
Locking scriptvout[1].scriptPubKey34@142prl1pusrlal5eu7h9j476y7c4vk6vj450e598cxcpa69hne557rk9977skn6lrwOP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Witness itemswitness[0].length1@1761Number of witness stack items for input 0.
Schnorr signature lengthwitness[0][0].length1@17764CompactSize length of this witness item.
Schnorr signaturewitness[0][0]64@178bcdee9e8c70a956f0faf3f19324ff7595aa9d6d377010f12a392d5dfb8a20b05076090f11d7d6523f995c316c40b5c4c635853491a29dd5367e54e899e46063864-byte BIP-340 signature (R.x ‖ s) with SIGHASH_DEFAULT: a Taproot key-path spend.
Witness itemswitness[1].length1@2421Number of witness stack items for input 1.
Schnorr signature lengthwitness[1][0].length1@24364CompactSize length of this witness item.
Schnorr signaturewitness[1][0]64@2449c9a3f1689bc718d7cbf2639e1433e7bb0f01896c7f2c14a565d515c41a5b5cd0e4a748978492d8dbda559088b66ef79003d421098cc25ef4ab05b39256790b864-byte BIP-340 signature (R.x ‖ s) with SIGHASH_DEFAULT: a Taproot key-path spend.
Locktimelocktime4@30800: no time lock.
txidSHA256d without witness, reversed

091166043c8d93530171ca9e5ac883aaeae467934fbb8e4df1ea739c8d71b23e

wtxidSHA256d of everything, reversed

a672e6d9fed5347970cd115556ca4f032b86477084af0f69c86df793f5fa2c74

Size
312 B
vsize
212 vB
178 + ⌈134 / 4⌉
Version
1
Locktime
0
Fee
10,650 grains
50.2 grains/vB
Total out
3.24578616 PRL

2 inputs

#0 Spends

c50fea91a8…5ac8ec7d20 : 0

sequence 0xffffffff

  • Schnorr signature bcdee9e8…9e460638 64 B

#1 Spends

f7adce4f58…c96c31dad5 : 0

sequence 0xffffffff

  • Schnorr signature 9c9a3f16…256790b8 64 B

2 outputs

#0 1.25578616 PRL Taproot (P2TR, witness v1)

prl1pdupm33flla60pv3ggjnzlv5lsgha5h6wqck5jtcajxl4vump5dqq3mvacr

125,578,616 grains

#1 1.99 PRL Taproot (P2TR, witness v1)

prl1pusrlal5eu7h9j476y7c4vk6vj450e598cxcpa69hne557rk9977skn6lrw

199,000,000 grains

Runs in your browser · nothing is sent src/lib/tx.ts · real txs from mainnet

What’s in an input?

One input, as it sits in the transaction
Field Size Type Description
txid 32 hash The transaction that created the output being spent, in internal (reversed) byte order.
vout 4 uint32 LE Which output of that transaction, counting from 0.
scriptSig length 1 CompactSize Always 00 on Pearl, except in a coinbase.
scriptSig 0 script Empty. Coinbase only: 2 to 100 bytes starting with the block height.
sequence 4 uint32 LE Replace-by-fee signal and relative locks. Pearl wallets write ffffffff.

Here is the one input of a real payment from block 130,825, highlighted:

A typical payment: 1 input, 2 outputs 205 bytes
01000000 00 01 01 5939557091bae792be66f26cbd83fc78f16a690a854109e8a1d115e253812133 ab020000 00 ffffffff 02 b0359f1100000000 22 5120d7ab02c96a342bdddb5d07b9f3ebd6c04e077ff41418110b9a1e5997439416b2 00c2eb0b00000000 22 512062e9da3682aab288392cf7218bafc36287288abb3ce200c5d1a50aa234073b2b 01 40 4686c7014749649b25555874c7772ecb7a44e85454893ed5888db11ebcdc82a22d74ce1a1671d02810f5ba1dca3277409e95a653ba9644099f7da26be7a86ba2 00000000
Field Bytes Value
Version version 4 @0 1 int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.
Marker marker 1 @4 0x00 Segwit marker (BIP-144): says witness data follows the outputs.
Flag flag 1 @5 0x01 Witness flag; 0x01 is the only value Pearl accepts.
Input count vin.length 1 @6 1 CompactSize number of inputs.
Previous txid vin[0].txid 32 @7 33218153e215d1a1e80941850a696af178fc83bd6cf266be92e7ba9170553959 The transaction being spent, stored byte-reversed (internal order); shown here in normal display order.
Output index vin[0].vout 4 @39 683 Which output of that transaction is spent (uint32 LE).
scriptSig length vin[0].scriptSig.length 1 @43 0 Always 0 for non-coinbase inputs in Pearl: every spend uses the witness instead.
Sequence vin[0].sequence 4 @44 0xffffffff Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Output count vout.length 1 @48 2 CompactSize number of outputs.
Amount vout[0].value 8 @49 295,646,640 grains (2.95646640 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[0].scriptPubKey.length 1 @57 34 CompactSize length of the locking script.
Locking script vout[0].scriptPubKey 34 @58 prl1p674s9jt2xs4amk6aq7ul867kcp8qwll5zsvpzzu6revewsu5z6eqv9d5z4 OP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Amount vout[1].value 8 @92 200,000,000 grains (2.00000000 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[1].scriptPubKey.length 1 @100 34 CompactSize length of the locking script.
Locking script vout[1].scriptPubKey 34 @101 prl1pvt5a5d5z42egswfv7uscht7rv2rj3z4m8n3qp3w35592ydq88v4seuhn70 OP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Witness items witness[0].length 1 @135 1 Number of witness stack items for input 0.
Schnorr signature length witness[0][0].length 1 @136 64 CompactSize length of this witness item.
Schnorr signature witness[0][0] 64 @137 4686c7014749649b25555874c7772ecb7a44e85454893ed5888db11ebcdc82a22d74ce1a1671d02810f5ba1dca3277409e95a653ba9644099f7da26be7a86ba2 64-byte BIP-340 signature (R.x ‖ s) with SIGHASH_DEFAULT: a Taproot key-path spend.
Locktime locktime 4 @201 0 0: no time lock.
txid
d919e02a4adfd739ceef31d98803f0ddd24e1b1fa67b0fe572cdec42c1b384c9
Size
205 bytes · 154 vbytes
Block
130,825
Fee
7,915 grains

Previous txid

Size
32 bytes
Type
SHA256d hash
Format
Internal byte order (reversed from how explorers show it)

The bytes start 5939557091bae792…. Explorers show transaction IDs with their bytes reversed, so this is the transaction 33218153e215d1a1e80941850a696af178fc83bd6cf266be92e7ba9170553959. The txid page explains why the two orders exist.

Output index (vout)

Size
4 bytes
Type
Unsigned integer
Format
Little-endian

ab020000 is 0x2ab = 683. So the earlier transaction had at least 684 outputs, and this input spends number 683. The txid and index together are an outpoint: a unique name for one output, written 33218153…553959:683.

scriptSig

Size
1 byte (the length, 00)
Type
Script
Format
Empty

In Bitcoin’s original design, the scriptSig held the signature and public key. On Pearl it’s always empty, for a simple reason: every output you can spend is a witness program (Taproot or P2MR), and Pearl’s script engine refuses a non-empty scriptSig on those (“native witness program cannot also have a signature script”). The only scriptSig with content is a coinbase’s.

Sequence

Size
4 bytes
Type
Unsigned integer
Format
Little-endian

ffffffff, the maximum, which Pearl wallets always use: no replace-by-fee, no relative lock. Other values have meanings explained in locktime and sequence.

What doesn’t an input say?

Two important things: how much the coin is worth, and how it’s locked.

Every node already knows both. It keeps a table of every unspent output, the UTXO set, and looks up the outpoint there. For the payment above, the lookup says output 33218153…:683 holds 495,654,555 grains locked to prl1pfvyle3p7penvnezpg9awpa03ylfl0n30z3usygzvf8kt77wyra8suvzxy2.

Leaving them out saves space, but it means a signer has to trust whoever tells them the amounts. Taproot fixes that: the signed message includes every spent amount and locking script (see sighash), so a signer who’s lied to produces a signature that’s simply invalid.

What happens with several inputs?

They are listed one after another, after a count. This payment from block 130,822 has two, each spending output 0 of a different transaction:

2 inputs, 2 outputs 312 bytes
01000000 00 01 02 207decc85aaf210383704c39294c193864bf8e4255984abab5fe19a891ea0fc5 00000000 00 ffffffff d5da316cc9db4a367ce18ef27fb76809601a7fde2d111844962fc7584fceadf7 00000000 00 ffffffff 02 782d7c0700000000 22 51206f03b8c53fff74f0b22844a62fb29f822fda5f4e062d492f1d91bf567361a340 c07fdc0b00000000 22 5120e407fefe99e7ae5957da27b1565b4c9568fcd0a7c1b01ee8b79e694f0ec52fbd 01 40 bcdee9e8c70a956f0faf3f19324ff7595aa9d6d377010f12a392d5dfb8a20b05076090f11d7d6523f995c316c40b5c4c635853491a29dd5367e54e899e460638 01 40 9c9a3f1689bc718d7cbf2639e1433e7bb0f01896c7f2c14a565d515c41a5b5cd0e4a748978492d8dbda559088b66ef79003d421098cc25ef4ab05b39256790b8 00000000
Field Bytes Value
Version version 4 @0 1 int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.
Marker marker 1 @4 0x00 Segwit marker (BIP-144): says witness data follows the outputs.
Flag flag 1 @5 0x01 Witness flag; 0x01 is the only value Pearl accepts.
Input count vin.length 1 @6 2 CompactSize number of inputs.
Previous txid vin[0].txid 32 @7 c50fea91a819feb5ba4a9855428ebf6438194c29394c70830321af5ac8ec7d20 The transaction being spent, stored byte-reversed (internal order); shown here in normal display order.
Output index vin[0].vout 4 @39 0 Which output of that transaction is spent (uint32 LE).
scriptSig length vin[0].scriptSig.length 1 @43 0 Always 0 for non-coinbase inputs in Pearl: every spend uses the witness instead.
Sequence vin[0].sequence 4 @44 0xffffffff Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Previous txid vin[1].txid 32 @48 f7adce4f58c72f964418112dde7f1a600968b77ff28ee17c364adbc96c31dad5 The transaction being spent, stored byte-reversed (internal order); shown here in normal display order.
Output index vin[1].vout 4 @80 0 Which output of that transaction is spent (uint32 LE).
scriptSig length vin[1].scriptSig.length 1 @84 0 Always 0 for non-coinbase inputs in Pearl: every spend uses the witness instead.
Sequence vin[1].sequence 4 @85 0xffffffff Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Output count vout.length 1 @89 2 CompactSize number of outputs.
Amount vout[0].value 8 @90 125,578,616 grains (1.25578616 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[0].scriptPubKey.length 1 @98 34 CompactSize length of the locking script.
Locking script vout[0].scriptPubKey 34 @99 prl1pdupm33flla60pv3ggjnzlv5lsgha5h6wqck5jtcajxl4vump5dqq3mvacr OP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Amount vout[1].value 8 @133 199,000,000 grains (1.99000000 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[1].scriptPubKey.length 1 @141 34 CompactSize length of the locking script.
Locking script vout[1].scriptPubKey 34 @142 prl1pusrlal5eu7h9j476y7c4vk6vj450e598cxcpa69hne557rk9977skn6lrw OP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Witness items witness[0].length 1 @176 1 Number of witness stack items for input 0.
Schnorr signature length witness[0][0].length 1 @177 64 CompactSize length of this witness item.
Schnorr signature witness[0][0] 64 @178 bcdee9e8c70a956f0faf3f19324ff7595aa9d6d377010f12a392d5dfb8a20b05076090f11d7d6523f995c316c40b5c4c635853491a29dd5367e54e899e460638 64-byte BIP-340 signature (R.x ‖ s) with SIGHASH_DEFAULT: a Taproot key-path spend.
Witness items witness[1].length 1 @242 1 Number of witness stack items for input 1.
Schnorr signature length witness[1][0].length 1 @243 64 CompactSize length of this witness item.
Schnorr signature witness[1][0] 64 @244 9c9a3f1689bc718d7cbf2639e1433e7bb0f01896c7f2c14a565d515c41a5b5cd0e4a748978492d8dbda559088b66ef79003d421098cc25ef4ab05b39256790b8 64-byte BIP-340 signature (R.x ‖ s) with SIGHASH_DEFAULT: a Taproot key-path spend.
Locktime locktime 4 @308 0 0: no time lock.
txid
091166043c8d93530171ca9e5ac883aaeae467934fbb8e4df1ea739c8d71b23e
Size
312 bytes · 212 vbytes
Block
130,822
Fee
10,650 grains

The count byte is 02. In the witness, the first stack belongs to input 0 and the second to input 1. Each input carries its own signature, even if the same wallet owns both coins.

Inputs add up. This transaction spends 113,300,000 + 211,289,266 = 324,589,266 grains and creates outputs worth 324,578,616 grains. The difference, 10,650 grains, is the fee.

Does the order of inputs matter?

Yes, in two ways. The witness stacks follow the inputs in the same order, so the first stack proves the first input, and so on. And each signature commits to the index of the input it signs (see sighash), so moving a signature to another input breaks it.

Which coins to use, and in which order, is the wallet’s choice. Pearl’s wallet picks the largest coins first by default, then adds a change output at a random position. Spending several coins together tells the world they probably share an owner, one of the reasons wallets give out a fresh address for every payment.

What does a coinbase input look like?

The first transaction of every block creates new coins, so it has nothing to point at. Its single input uses a null outpoint, 32 zero bytes and index ffffffff, and its scriptSig starts with the block height:

Coinbase of block 130,825 216 bytes
02000000 00 01 01 0000000000000000000000000000000000000000000000000000000000000000 ffffffff 27 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb ffffffff 02 cc84ce1d34000000 22 5120e31e8032a67b9af27dc279f448c003457bae6c5d28de7ee719bc87b6801ede17 0000000000000000 26 6a24aa21a9ed78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 01 20 0000000000000000000000000000000000000000000000000000000000000000 00000000
Field Bytes Value
Version version 4 @0 2 int32 little-endian. Pearl wallets and pearld coinbases use version 1; relay policy accepts 1-2.
Marker marker 1 @4 0x00 Segwit marker (BIP-144): says witness data follows the outputs.
Flag flag 1 @5 0x01 Witness flag; 0x01 is the only value Pearl accepts.
Input count vin.length 1 @6 1 CompactSize number of inputs.
Previous txid vin[0].txid 32 @7 0000000000000000000000000000000000000000000000000000000000000000 All zeros: this input creates new coins (coinbase).
Output index vin[0].vout 4 @39 0xffffffff 0xffffffff together with a zero txid marks a coinbase.
scriptSig length vin[0].scriptSig.length 1 @43 39 CompactSize length of the scriptSig.
Coinbase script vin[0].scriptSig 39 @44 0309ff01048393d76a2f706f6f6c2e6b7279707465782e636f6d2f1550cad31e016e7bf00f2ecb Coinbase data. It starts with the block height 130825 (BIP-34, required in every Pearl block), then anything the miner likes.
Sequence vin[0].sequence 4 @83 0xffffffff Final (0xffffffff): no RBF signal, no relative locktime, and locktime is ignored for this input. Pearl wallets use this.
Output count vout.length 1 @87 2 CompactSize number of outputs.
Amount vout[0].value 8 @88 223,838,373,068 grains (2238.38373068 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[0].scriptPubKey.length 1 @96 34 CompactSize length of the locking script.
Locking script vout[0].scriptPubKey 34 @97 prl1puv0gqv4x0wd0ylwz086y3sqrg4a6umza9r08aecehjrmdqq7mctsmqaqsh OP_1 OP_PUSHBYTES_32 <output key Q>: a Taproot output.
Amount vout[1].value 8 @131 0 grains (0.00000000 PRL) int64 little-endian, in grains (1 PRL = 100,000,000 grains).
Script length vout[1].scriptPubKey.length 1 @139 38 CompactSize length of the locking script.
Locking script vout[1].scriptPubKey 38 @140 witness commitment 78cc1a61dcfcee9c59ddd9f4d56a98764c071e077bcc36fe9d1cf0aad50ebac3 OP_RETURN aa21a9ed ‖ SHA256d(witness Merkle root ‖ nonce): the BIP-141 witness commitment.
Witness items witness[0].length 1 @178 1 Number of witness stack items for input 0.
Witness reserved value length witness[0][0].length 1 @179 32 CompactSize length of this witness item.
Witness reserved value witness[0][0] 32 @180 0000000000000000000000000000000000000000000000000000000000000000 The coinbase witness is one 32-byte value (the witness-commitment nonce); pearld uses zeros.
Locktime locktime 4 @212 0 0: no time lock.
txid
0a2acb6004406b21252d1578585dec84efd7e7547f1bca19c30c17538c51caa0
Size
216 bytes · 189 vbytes
Block
130,825

That’s how nodes recognize a coinbase. The coinbase page decodes its scriptSig.

What rules does an input have to follow?

  • The output must exist and be unspent. Spending the same outpoint twice is a double spend; only one of the two transactions can ever be in the chain.
  • New coins must wait. An output from a coinbase can’t be spent until it is 100 blocks deep.
  • Parents first. If an input spends an output created in the same block, the parent transaction must come earlier in the block. Pearl enforces this from v1.5.1.
  • There must be a witness. Pearl’s mempool rejects a transaction with no witness data at all.

The codex

Suggested

Up and down arrows move through the results, Enter opens one, Escape closes. Anywhere on the site, slash or Command K opens this search, and the square brackets [ and ] go to the previous and next page.