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
@@ -22995,6 +22995,44 @@ Once a block author selects transactions from the pool, the transactions are exe
22995
22995
22996
22996
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.
22997
22997
22998
+
## Transaction Mortality
22999
+
23000
+
Transactions in the network can be configured as either mortal (with expiration) or immortal (without 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.
23001
+
23002
+
When a transaction is submitted, the network validates it against these parameters. If the transaction is not included in a block within the specified validity window, it is automatically removed from the transaction queue.
23003
+
23004
+
- **Mortal transactions**: have a finite lifespan and will expire after a specified number of blocks. For example, a transaction with a block checkpoint of 1000 and a validity period of 64 blocks will be valid from blocks 1000 to 1064.
23005
+
23006
+
- **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 a reference, and set the validity period to 0.
23007
+
23008
+
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.
23009
+
23010
+
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.
23011
+
23012
+
## Unique Identifiers for Extrinsics
23013
+
23014
+
Transaction hashes are **not unique identifiers** in Polkadot SDK-based chains.
23015
+
23016
+
Key differences from traditional blockchains:
23017
+
23018
+
- Transaction hashes serve only as fingerprints of transaction information
23019
+
- Multiple valid transactions can share the same hash
23020
+
- Hash uniqueness assumptions lead to serious issues
23021
+
23022
+
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:
23023
+
23024
+
| Block | Extrinsic Index | Hash | Origin | Nonce | Call | Result |
| 100 | 0 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Account A reaped |
23027
+
| 150 | 5 | 0x02 | Account B | 4 | Transfer 7 DOT to A | Account A created (nonce = 0) |
23028
+
| 200 | 2 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Successful transaction |
23029
+
23030
+
Notice that blocks 100 and 200 contain transactions with identical hashes (0x01) but are completely different, valid operations occurring at different times.
23031
+
23032
+
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 the same hash values. Each execution occurs in different chain states with different results.
23033
+
23034
+
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 index. Since the Polkadot SDK defines blocks as headers plus ordered arrays of extrinsics, the index position within a canonical block provides guaranteed uniqueness.
23035
+
22998
23036
## Additional Resources
22999
23037
23000
23038
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 a 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 the 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 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