CHIP 2021-05 Targeted Virtual Machine Limits

This proposal replaces several poorly-targeted virtual machine (VM) limits with alternatives which protect against the same malicious cases while significantly increasing the power of the Bitcoin Cash contract system:

  • the 520-byte stack element size limit is raised to 10,000 bytes.
  • The 201 operation limit is removed.
  • A new cumulative hashing limit is introduced, limiting contracts to 660 digest iterations per evaluation.
  • A new stack memory usage limit is introduced, limiting contracts to 130,000 bytes of data on the stack.

This proposal intentionally avoids modifying other properties of the current VM:

  • The limits on maximum standard input bytecode length (A.K.A. MAX_TX_IN_SCRIPT_SIG_SIZE – 1,650 bytes), maximum VM bytecode length (A.K.A. MAX_SCRIPT_SIZE – 10,000 bytes), maximum standard transaction byte-length (A.K.A. MAX_STANDARD_TX_SIZE – 100,000 bytes) and consensus-maximum transaction byte-length (A.K.A. MAX_TX_SIZE – 1,000,000 bytes) are not modified.
  • The cost and incentives around blockchain “data storage” are not measurably affected.
  • The worst-case transaction validation processing and memory requirements of the VM are not measurably affected.

Comments, feedback, and reviews are appreciated, either here or on GitHub issues. Thanks!


Previous discussion on this topic beginning Feb 8, 2021:

Submitted this CHIP to the list at

Great work! Having worked on the Group CHIP and studying the costs of proposed genesis setup that requires hashing operations I found myself wondering why aren’t we counting hash operations and ended up reading this CHIP a few times to give me an idea of the costs involved. :slight_smile:

This proposal is well thought out and allows much more utility without significantly increasing node operating costs, and it would be great if it could make it into 2023 upgrade window.

Btw, I also discovered this analysis of digest and signature verification costs, just for reference: Benchmarking Hash and Signature Algorithms | by Michael Zochowski | Logos Network | Medium