Skip to content

Commit 1215bc3

Browse files
committed
Add content
1 parent 831198d commit 1215bc3

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

llms.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22562,6 +22562,44 @@ Once a block author selects transactions from the pool, the transactions are exe
2256222562

2256322563
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.
2256422564

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 |
22592+
|-------|----------------|------|-----------|-------|---------------------|-------------------------------|
22593+
| 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+
2256522603
## Additional Resources
2256622604

2256722605
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.

polkadot-protocol/parachain-basics/blocks-transactions-fees/transactions.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,44 @@ Once a block author selects transactions from the pool, the transactions are exe
210210

211211
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.
212212

213+
## Transaction Mortality
214+
215+
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.
216+
217+
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.
218+
219+
- **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.
220+
221+
- **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.
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+
## Unique Identifiers for Extrinsics
228+
229+
Transaction hashes are **not unique identifiers** in Polkadot SDK-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:
238+
239+
| Block | Extrinsic Index | Hash | Origin | Nonce | Call | Result |
240+
|-------|----------------|------|-----------|-------|---------------------|-------------------------------|
241+
| 100 | 0 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Account A reaped |
242+
| 150 | 5 | 0x02 | Account B | 4 | Transfer 7 DOT to A | Account A created (nonce = 0) |
243+
| 200 | 2 | 0x01 | Account A | 0 | Transfer 5 DOT to B | Successful transaction |
244+
245+
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 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.
248+
249+
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.
250+
213251
## Additional Resources
214252

215253
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

Comments
 (0)