LearnBitcoin

Bitcoin Dev Archive 2021

Review of Smart Contract Concepts

2 messages, 7 to 23 Dec 2021. Started by Jeremy Rubin.

Jeremy Rubin, Prayank

Permalink Original thread on gnusha.org

Jeremy Rubin permalink original

This post covers some high-level smart contract concepts that different opcodes or proposals could have (or not).

https://rubin.io/bitcoin/2021/12/04/advent-7/

Interested to hear about other properties that you think are relevant!

Best,

Jeremy

Prayank in reply to Jeremy Rubin permalink original

Hi Jeremy,

Quoted text (1 line)
> This post covers some high-level smart contract concepts that different

opcodes or proposals could have (or not). https://rubin.io/bitcoin/2021/12/04/advent-7/

Interesting post. I love the concept of recursion in programming. There is one Indian movie called 'Karthik calling Karthik' which is one of the ways I remember this concept.

Quoted text (1 line)
> Recursive is pretty much just a fancy way of saying “loops”. This is sometimesalso called “Turing Complete”.

Recently asked one dumb question on Stakexchange after reading a comment on reddit, maybe you can add anything new in this:

https://bitcoin.stackexchange.com/questions/111337/loops-in-bitcoin-scripting

Quoted text (1 line)
> Here, the contract terminates after one canceled request by moving the coinelsewhere.  It’s possible to emulate recursive behavior a limited amount by“unrolling” a loop.

I think this is what I did in the above link where for loop was replaced with if-else statements.

Quoted text (1 line)
> However, unrolling has it’s limits. When choices(action A or B) are introduced, unrolling can be less effective since you haveand exponential blowup (that means unrolling even like 32 steps might be toomany). However, there are some tricks that can be employed by a clever andcareful programmer to reduce this complexity through, for example, memoization.

Agree with limits and possibility of optimization.

Quoted text (1 line)
> The key difference being that in the fully enumerated case we must know the exact specifics of the contract and how it will execute, and in the open ended contract case there are bits and pieces we can dynamically specify. If Alice is paid 1 BTC by December 25th, 2021 Midnight, then transfer 100 tokensto one of Bob’s Address B1, B2, or B3 at Bob’s discretion.

Interesting

Quoted text (1 line)
> Signing the transaction fee rate as a function of locktime

TIL