Bitcoin Cash
$469.12 -14.79%
BCH · 2w

"CHIP: Bounded Looping Operations" by Jason Dreyzehner

Ideas CHIP: Bounded Looping Operations

Two new BCH opcodes, OP_BEGIN and OP_UNTIL, would enable loops in BCH contracts without increasing processing or memory requirements.

May 28, 2021 • 1 min read

The Bitcoin Cash virtual machine is strictly limited to prevent maliciously-designed transactions from requiring excessive resources during transaction validation.

Loops were originally excluded from this design on the mistaken assumption that they risk consuming excessive validation resources. In reality, a small number of VM operations make up the majority of resource usage during transaction validation, and any implementation of bounded loops can be many orders of magnitude faster than the most pathological VM bytecode constructions.

Introducing this basic control flow structure would make BCH contracts significantly more powerful and efficient.

The precise implementation is influenced by the BEGIN ... UNTIL indefinite loop construction in the Forth programming language (upon which the rest of the Bitcoin Cash VM is based). This particular construction offers maximal flexibility: definite loops can be easily emulated with these indefinite loops, but indefinite loops could not be emulated with definite loops.

You can find the full specification on GitHub:

bitjson/bch-loops A proposal to enable loops in BCH contracts without increasing processing or memory requirements. - bitjson/bch-loops

Review and feedback are deeply appreciated. Thanks!

Go to blog.bitjson.com
Recent news
BCH -14.79% · read.cash · 2h

Banks services like vs the real deal.

I have a few satoshis in my bank account Wallet of Satoshi, and it is a bank because I don't control my private keys and I am not using the real Bitcoin either when I am using those services either. T...
BCH -14.79% · youtu.be · 9h

lmaooo these memes 🤣🤣

Zoomer loves crypto and wants a lambo soon. But his girlfriend is a bit worried. She asks, "you only invested what you can afford to lose, right?". But Zoome...
BCH -14.79% · youtu.be · 19h

BCH Network Discussion TUBRO EDIT: PMv3

I did my best to keep the meat of the discussion while cutting out as much time as possible. Watch at 1.25x for an even shorter, mostly intelligible experien...