diff --git a/kip-0041.md b/kip-0041.md new file mode 100644 index 0000000..596f070 --- /dev/null +++ b/kip-0041.md @@ -0,0 +1,36 @@ +--- +KIP: "0041" +Title: SPV Proof Expiration for Cross-Chain Transfers +Author: chessai @chessai +Status: Draft +Type: Standard +Category: Chainweb +Created: 2025-07-16 +--- + +# Motivation + +Chainweb's cross-chain transfers are facilitated through SPV proofs. To briefly summarise, these proofs allow verification that the funds were burned on the source chain, thereby allowing the funds to be minted on the target chain. + +Currently, SPV proofs have no expiration. This requires chainweb-node to retain certain block history indefinitely to validate cross-chain transfers, leading to one source of unbounded storage growth. As the network ages, storage requirements for maintaining complete block header history grow linearly with time, creating scalability concerns for node operators. Allowing the pruning of old state is especially important given the long-term goals of shallow Chainweb nodes, which will run with minimal chain history. Currently, the block state that needs to be retained indefinitely is on the order of tens of gigabytes. + +# Design + +We propose defining a constant `SPV_PROOF_EXPIRATION_BLOCKS`, the "SPV proof expiration window", which defines the maximum age of a valid SPV proof, in a number of block heights. An SPV proof is created at a certain blockheight, and will be valid for the expiration window after its creation. + +This constant is *not* configurable and as such will be adhered to by the entire network. The constant could be changed at a later date if necessary. + +## Proposed constant +23_040 (blocks). + +The current default max TTL of a transaction is 2 days, which is 172_800 seconds. The minimum safe amount of block history for Chainweb to maintain is 2x the default max TTL. In an effort to be conservative, we propose an expiration window of 4x the default max TTL, 8 days, or about 23_040 blocks (172_800 seconds * 4 / 30 seconds per block). + +# Implementation + +SPV proof validation will include an expiration check: a proof is valid if `current_block_height - proof_block_height <= SPV_PROOF_EXPIRATION_BLOCKS` (note that this is simplified; there are some details missing, such as accounting for arithmetic underflow or the diameter of the chain graph). The expiration check uses the target chain's current block height, as this is where the proof is being validated. + +An implementation of SPV proof expiration (pending approval of a constant) is available at: https://github.com/kadena-io/chainweb-node/pull/2050 + +# User Impact + +There will be no change to how users interact with cross-chain transfers, other than the need to complete them within the expiration window. The larger impact will be that in the future we can trim a significant portion of the block state (tens of gigabytes). \ No newline at end of file