You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: llms.txt
+38Lines changed: 38 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -22562,6 +22562,44 @@ Once a block author selects transactions from the pool, the transactions are exe
22562
22562
22563
22563
Events are also written to storage. Runtime logic should not emit an event before performing the associated actions. If the associated transaction fails after the event was emitted, the event will not revert.
22564
22564
22565
+
## Transaction Mortality
22566
+
22567
+
Transactions in the network can be configured as either mortal (with expiration) or immortal (no expiration). Every transaction payload contains a block checkpoint (reference block number and hash) and an era/validity period that determines how many blocks after the checkpoint the transaction remains valid.
22568
+
22569
+
When a transaction is submitted, the network validates it against these parameters, and if the transaction is not included in a block within the specified validity window, it is automatically removed from the transaction queue.
22570
+
22571
+
- **Mortal transactions**: have a finite lifespan and will expire after a specified number of blocks. For example, a transaction with block checkpoint 1000 and validity period of 64 blocks will be valid from blocks 1000-1064.
22572
+
22573
+
- **Immortal transactions**: never expire and remain valid indefinitely. To create an immortal transaction, set the block checkpoint to 0 (genesis block), use the genesis hash as reference, and set the validity period to 0.
22574
+
22575
+
However, immortal transactions pose significant security risks through replay attacks. If an account is reaped (balance drops to zero, account removed) and later re-funded, malicious actors can replay old immortal transactions.
22576
+
22577
+
The blockchain maintains only a limited number of prior block hashes for reference validation called `BlockHashCount`. If your validity period exceeds `BlockHashCount`, the effective validity period becomes the minimum of your specified period and the block hash count.
22578
+
22579
+
## Unique Identifiers for Extrinsics
22580
+
22581
+
Transaction hashes are **not unique identifiers** in Polkadot SDK-based chains.
22582
+
22583
+
Key differences from traditional blockchains:
22584
+
22585
+
- Transaction hashes serve only as fingerprints of transaction information
22586
+
- Multiple valid transactions can share the same hash
22587
+
- Hash uniqueness assumptions lead to serious issues
22588
+
22589
+
For example, when an account is reaped (removed due to insufficient balance) and later recreated, it resets to nonce 0, allowing identical transactions to be valid at different points:
22590
+
22591
+
| Block | Extrinsic Index | Hash | Origin | Nonce | Call | Result |
| 100 | 0 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Account A reaped |
22594
+
| 150 | 5 | 0x02 | Account B | 4 | Transfer 7 DOT to A | Account A created (nonce = 0) |
22595
+
| 200 | 2 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Successful transaction |
22596
+
22597
+
Notice that blocks 100 and 200 contain transactions with identical hashes (0x01) but are completely different, valid operations occurring at different times.
22598
+
22599
+
Additional complexity comes from Polkadot SDK's origin abstraction. Origins can represent collectives, governance bodies, or other non-account entities that don't maintain nonces like regular accounts and might dispatch identical calls multiple times with same hash values. Each execution occurs in different chain states with different results.
22600
+
22601
+
The correct way to uniquely identify an extrinsic on a Polkadot SDK-based chain is to use the block ID (height or hash) and the extrinsic's index. Since the Polkadot SDK defines blocks as headers plus ordered arrays of extrinsics, the index position within a canonical block provides guaranteed uniqueness.
22602
+
22565
22603
## Additional Resources
22566
22604
22567
22605
For a video overview of the lifecycle of transactions and the types of transactions that exist, see the [Transaction lifecycle](https://www.youtube.com/watch?v=3pfM0GOp02c){target=\_blank} seminar from Parity Tech.
-**Immortaltransactions**:neverexpireandremainvalidindefinitely.Tocreateanimmortaltransaction, settheblockcheckpointto0 (genesisblock), use the genesis hash as reference, and set the validity period to 0.
222
+
223
+
However, immortal transactions pose significant security risks through replay attacks.If an account is reaped (balance drops to zero, account removed) and later re-funded, malicious actors can replay old immortal transactions.
224
+
225
+
The blockchain maintains only a limited number of prior block hashes for reference validation called `BlockHashCount`.If your validity period exceeds `BlockHashCount`, the effective validity period becomes the minimum of your specified period and the block hash count.
226
+
227
+
## UniqueIdentifiersforExtrinsics
228
+
229
+
Transaction hashes are **not unique identifiers**inPolkadotSDK-based chains.
230
+
231
+
Key differences from traditional blockchains:
232
+
233
+
-Transaction hashes serve only as fingerprints of transaction information
234
+
-Multiple valid transactions can share the same hash
235
+
-Hash uniqueness assumptions lead to serious issues
236
+
237
+
For example, when an account is reaped (removed due to insufficient balance) and later recreated, it resets to nonce 0, allowing identical transactions to be valid at different points:
Notice that blocks 100 and 200 contain transactions with identical hashes (0x01) but are completely different, valid operations occurring at different times.
246
+
247
+
Additional complexity comes from PolkadotSDK's origin abstraction.Origins can represent collectives, governance bodies, or other non-account entities that don't maintain nonces like regular accounts and might dispatch identical calls multiple times with same hash values.Each execution occurs in different chain states with different results.
248
+
249
+
The correct way to uniquely identify an extrinsic on a PolkadotSDK-based chain is to use the block ID (height or hash) and the extrinsic's index.Since the PolkadotSDK defines blocks as headers plus ordered arrays of extrinsics, the index position within a canonical block provides guaranteed uniqueness.
250
+
213
251
## AdditionalResources
214
252
215
253
For a video overview of the lifecycle of transactions and the types of transactions that exist, see the [Transaction lifecycle](https://www.youtube.com/watch?v=3pfM0GOp02c){target=\_blank} seminar from Parity Tech.
0 commit comments