zips/drafts/arcalinea-tx-expiry/draft.rst

84 lines
3.9 KiB
ReStructuredText
Raw Normal View History

2018-03-01 11:50:34 -08:00
::
2018-01-09 16:43:07 -08:00
2018-03-01 11:50:34 -08:00
ZIP: 203
Title: Transaction Expiry
Author: Jay Graber <jay@z.cash>
Category: Consensus
Created: 2018-01-09
License: MIT
2018-01-09 16:43:07 -08:00
Abstract
===========
2018-01-11 14:37:52 -08:00
This is an Standards ZIP describing a new consensus rule to set an expiration time for transactions that are not mined to be removed from the mempool.
2018-01-09 16:43:07 -08:00
Motivation
===========
2018-03-01 11:50:34 -08:00
Transactions that have insufficient fees are often not mined. This indeterminism is a source of confusion for users and wallets. Allowing a transaction to set a block height after which it cannot be mined would provide certainty around how long a transaction has to confirm before it is rejected by the network and must be re-sent.
2018-01-09 16:43:07 -08:00
2018-03-01 11:50:34 -08:00
Advantages include optimizing mempool performance by removing transactions that will not be mined, and potentially simplifying bidirectional payment channels by reducing the need to store and compress revocations for past states, since transactions not committed to the chain could expire and become invalid after a period of time.
2018-01-09 16:43:07 -08:00
2018-03-01 11:50:34 -08:00
If the expiry is at block height N, then the transaction must be included in block N or earlier. Block N+1 will be too late, and the transaction will be removed from the mempool.
The new consensus rule will enforce that the transaction will not be considered valid if included in block of height greater than N, and blocks that include transactions which have expired will not be considered valid.
2018-02-12 12:38:52 -08:00
2018-01-09 16:43:07 -08:00
Specification
===============
2018-02-12 12:33:44 -08:00
Transactions will have a new field, nExpiryHeight, which will set the block height after which transactions will be removed from the mempool if they have not been mined.
2018-01-11 14:37:52 -08:00
2018-02-12 12:38:52 -08:00
The data type for nExpiryHeight will be uint32_t. If used in combination with nLockTime, both nLockTime and nExpiryHeight must be block heights. nExpiryHeight will never be a UNIX timestamp, unlike nLockTime values, and thus the maximum expiry height will be 500000000.
2018-01-11 14:37:52 -08:00
For the example below, the last block that the transaction below could possibly be included in is 3539. After that, it will be removed from the mempool.
2018-01-09 16:43:07 -08:00
````
"txid": "17561b98cc77cd5a984bb959203e073b5f33cf14cbce90eb32b95ae2c796723f",
"version": 3,
"locktime": 2089,
2018-02-12 12:34:13 -08:00
"expiryheight": 3539,
2018-01-09 16:43:07 -08:00
```
2018-01-29 12:46:13 -08:00
Default: TBD. Current proposal is 24 blocks, or about 1 hour assuming 2.5 minute block times. Can add a config option to set user's default.
2018-01-11 16:45:25 -08:00
Minimum: No minimum
Maximum: 499999999, about 380 years
2018-02-12 12:36:41 -08:00
No limit: To set no limit on transactions (so that they do not expire), nExpiryHeight should be set to 0.
2018-02-23 15:18:06 -08:00
Coinbase: nExpiryHeight on coinbase transactions is ignored, and is set to 0 by convention.
2018-01-09 16:43:07 -08:00
2018-01-29 12:46:13 -08:00
Every time a transaction expires and should be removed from the mempool, so should all its dependent transactions.
2018-01-09 16:43:07 -08:00
Wallet behavior and UI
-----------------------
2018-01-11 14:37:52 -08:00
With the addition of this feature, zero-confirmation transactions with an expiration block height set will have even less guarantee of inclusion. This means that UIs and services must never rely on zero-confirmation transactions in Zcash.
2018-01-11 16:45:25 -08:00
Wallet should notify user of expired transactions that must be re-sent. See "Notify" section below.
2018-01-09 16:43:07 -08:00
2018-01-11 14:37:52 -08:00
RPC
-----
2018-01-11 16:45:25 -08:00
2018-03-01 11:50:34 -08:00
To make changes to the sendtoaddress and z_sendmany commands backwards compatible for future changes, keyword arguments should be accepted by the RPC interface.
For Overwinter, tx expiry will be set to a default that can be overridden by a flag `txexpirydelta` set in the config file.
-txexpirydelta= set the number of blocks after which a transaction that has not been mined will become invalid
2018-01-11 16:45:25 -08:00
To view:
2018-01-11 14:37:52 -08:00
listtransactions has a new filter attribute, showing expired transactions only:
listtransactions "*" 10 0 "expired"
WalletTxToJSON shows a boolean expired true/false
2018-02-02 23:07:04 -08:00
Config
-------
Default will be user configurable with flag `txblockexpirydelta`
`--txblockexpirydelta=100`
2018-03-01 11:50:34 -08:00
Deployment
------------
This feature will be deployed with Overwinter. The activation blockheight proposal is in [ZIP 201](https://github.com/zcash/zips/blob/master/zip-0201.rst)