The Pay to Anchor (P2A) output script will not be a “locking script” in that sense. It requires no extra enter to turn out to be legitimate for inclusion within the blockchain. It’s “ANYONE_CAN_SPEND”, i.e., anybody can create an enter that references the transaction output per its outpoint and spend it with an empty enter script and witness stack. After all each output continues to be distinctive (recognized per its outpoint) can solely be spent by one transaction.
P2A falls within the class of native segwit output scripts. Native segwit output scripts observe the sample
. Because the segwit mushy fork was activated, all native segwit output scripts are thought-about legitimate except extra particular guidelines encumber them. This makes it simple to mushy fork in new guidelines for future output varieties: unupgraded nodes take into account all of them legitimate however non-standard. They’ll settle for them in confirmed transactions, however is not going to settle for transactions utilizing unknown output varieties into their mempool or ahead them. In the meantime, nodes that implement a mushy fork implement the brand new extra guidelines one the corresponding outputs.
When Pay to Witness Public Key Hash (P2WPKH) and Pay to Witness Script Hash (P2WSH) have been launched, they have been designated “native segwit model 0” which is why their output scripts begin with OP_0
(which produces addresses that begin with bc1q
. Witness packages of 20-byte size should adhere to P2WPKH guidelines, witness packages of 32-byte size should adhere to P2WSH guidelines, and all different lengths beside 20 and 32 bytes have been declared invalid.
A unique method was chosen for native segwit model 1. When Pay to Taproot (P2TR) was launched, it was designated that P2TR guidelines solely apply to Native Segwit outputs of 32-byte witness packages, and all different lengths have been left unencumbered. Native segwit v1 output scripts begin with OP_1
which produces addresses that begin with bc1p
.
P2A can also be a Native Segwit v1 output script and due to this fact additionally begins with OP_1
and due to this fact its addresses additionally begin with bc1p
. The witness program was chosen to be the minimal permitted witness program size of two bytes. The 2 bytes have been chosen as a result of they trigger the ensuing tackle to include the string “charges”. P2A is all the time legitimate, just because all native segwit output scripts are thought-about legitimate and no different guidelines limit it. The P2A guidelines declare transactions with a single P2A output commonplace if accompanied by one other transaction that instantly spends it, which implies that implementing nodes settle for a pair of transactions linked by way of a spent P2A output to their mempool and ahead them to their friends. Anybody can spend any P2A output just by referencing the output’s outpoint (txid:vout
) in a transaction enter with none additional info being obligatory within the enter. As with all inputs spending native segwit outputs, the enter script (aka scriptSig
) is empty, however for P2A the witness stack can also be empty.
As a result of the witness program is a mere two bytes, the P2A output script is simply 4 bytes: 0x51024e73
, OP_1, OP_PUSHBYTES_2, and the 2 byte witness program. This makes your entire output 13 bytes (8 bytes for the output quantity, one byte for the size of the output script, 4 bytes output script). And your entire enter 41 bytes (36 bytes for the outpoint that identifies which UTXO is being spent (32 bytes for the txid, 4 bytes for the vout), 4 bytes for the nSequence
, and
Let’s search for instance at transaction 5bad…32dc. It has one P2TR keypath enter, one P2A output, and one P2TR output:
Should you check out the serialized transaction (by way of yogh.io), you see this:
(1) The 02
byte signifies two outputs, the following (2) eight bytes 6d 03 00 00 00 00 00 00
encode an quantity of 877 satoshis, the (3) 04
signifies the size of the four-byte output script, and (4) we spot the mentioned P2A output script 0x51024e73
.
The transaction that spends the P2A output 58a8bf720444561ca4cb9ae76d117854fbed5671dbbad0de4c81397e9fee05ae on the opposite facet, accommodates an enter that solely identifies which output it’s spending with an empty enter script and witness script:
Sadly, it appears like yogh.io can’t deal with transactions with P2A inputs but. Anyway, the transaction’s hex is:
0200000001dc3244a5e18ef8b38987a375956282839f96e36f04b75f068dcf63a837c1ad5b0000000000fdffffff010000000000000000116a0f696e20666565732077652072757374ac800d00
02000000 ↦ tx model 2
01 ↦ one enter
dc3244a5…37c1ad5b ↦ spent output’s txid (little endian) 5badc137…a54432dc
00000000 ↦ output’s place 0 in prior tx
00 ↦ enter script size of 0
fdffffff ↦ nSequence MAX-2
01 ↦ one output
0000000000000000 ↦ quantity of 0
11 ↦ 17 bytes of output script to observe
6a ↦ OP_RETURN
0f ↦ OP_PUSHBYTES_15
696e20666565732077652072757374 ↦ ASCII for "in charges we rust"
ac800d00 ↦ locktime of 884908
As you’ll be able to see, the enter has no witness stack, and the enter script size is zero, so the enter has the minimal weight of 41 bytes. Which means that a P2A output plus enter merely manner 64 vB, which is way much less even than the prior champion amongst spendable commonplace transaction outputs, P2WPKH, which is available in at 99 vB (output of 31 vB + enter of 68 vB).
As a result of P2A has so little weight, it makes for an inexpensive manner of permitting any social gathering to bump a transaction per a toddler transaction.