03 / 13

Chapter 03 · Beginner guide

Transactions

Spend old outputs, make new ones

A transaction is a short message with a big job: it moves PRL from one owner to another.

It says which coins are being spent, who gets them, and it carries a signature proving the owner agreed. That’s all. There are no account numbers and no names.

What’s inside a transaction?

Two lists.

Inputs point to coins you already have. Outputs create new coins for whoever is being paid.

Every coin in the ledger is an output of some earlier transaction. Until someone spends it, it’s an unspent transaction output, or UTXO. Your wallet balance is simply the total of all the UTXOs your keys can unlock.

So a transaction is a little act of recycling: it uses up some old outputs and creates fresh ones.

Why do you get change?

Outputs work like banknotes. You can’t tear one in half, so when you spend an output, you spend all of it.

Say you hold one output worth 10 PRL and want to pay a friend 3 PRL. Your transaction spends the whole 10 PRL output and creates two new ones: 3 PRL for your friend, and the rest back to you. That second output is your change.

Here is a real payment from block 130,825, drawn as boxes.

Input (an old output)4.95654555 PRLspent in fullNew output: the payment2.00000000 PRLNew output: change2.95646640 PRLLeft over for the miner: 7,915 grains
A real Pearl payment (TXID d919e02a…) from block 130,825. The amounts are from the chain. The chain doesn't label change; the round 2 PRL is almost certainly the payment.

Add up the outputs and you get 4.95646640 PRL. The input held 4.95654555 PRL. Keep that small gap in mind; it comes back in a moment.

Make a guess

You hold exactly one output, worth 10 PRL, and want to pay a friend 3 PRL. How many outputs will your transaction create?

Think of your answer first, then check it.

Answer Two.

One output of 3 PRL for your friend, and one change output back to you for a little under 7 PRL. The “little under” is the fee. Your old 10 PRL output is now spent and can never be spent again.

How do you prove the coins are yours?

Every output is locked to a key. To unlock it, the spender attaches a signature made with the matching private key. Pearl uses Schnorr signatures, 64 bytes each.

Any node can check the signature using the public key. And a signature only fits the exact transaction it was made for. Change a single grain of any amount, or swap the recipient’s address, and the signature no longer checks out.

That’s why nobody can intercept your payment and redirect it. They’d need to sign a new one, and only your private key can do that.

The signatures travel in a separate section of the transaction called the witness. Every spend on Pearl has one.

Where does a transaction wait?

A signed transaction hops from node to node, and each node keeps a copy in its mempool, a waiting room for valid transactions that aren’t in a block yet.

When a miner builds its next block, it picks transactions from its mempool. Once yours is in a block, it’s recorded in the ledger.

Why pay a fee?

Remember the gap in the real example? The outputs add up to 7,915 grains less than the input. That difference is the fee.

Nobody writes the fee down. It’s simply left over, and the miner who includes the transaction claims it as part of the block’s reward.

Space in a block is limited: at most 1,000,000 vbytes. A vbyte is Pearl’s unit of size, where signature bytes count a quarter. Miners fill that space with the best-paying transactions first, so what matters is the fee per vbyte, called the fee rate.

The example transaction was 154 vbytes, so its fee rate was about 51 grains per vbyte, which was typical for payments that day. Nodes won’t even pass on a transaction paying less than 1 grain per vbyte.

What kinds of lock can an output have?

Pearl is strict here. Only three kinds of output are valid at all:

  • Taproot, with addresses starting prl1p. Locked to one key, which can also hide extra spending rules. Almost every payment uses this.
  • P2MR, with addresses starting prl1z. Locked to a tree of spending rules with no key in it. Rare today; the quantum safety page explains why it exists.
  • OP_RETURN. Carries a piece of data and can never be spent.

Taproot and P2MR outputs smaller than 333 grains are called dust, because they’re worth so little that spending them would eat a large share of their value in fees. Nodes won’t pass on transactions that create them.

So a payment is now signed, checked and waiting. The next page shows how it gets locked into the ledger for good.

Beginner guide

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.