[Bitcoin Advent Calendar] Review of Smart Contract Concepts

[Bitcoin Advent Calendar] Review of Smart Contract Concepts
From: Jeremy @ 2021-12-07 23:31 UTC ( / )
  To: Bitcoin development mailing list



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

--
@JeremyRubin <https://twitter.com/JeremyRubin>
<https://twitter.com/JeremyRubin>
From: Prayank @ 2021-12-23 11:55 UTC (permalink / raw)
  To: Jeremy;  Bitcoin Dev

[-- Attachment #1: Type: text/plain, Size: 1885 bytes --]

Hi Jeremy,

> 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. 

> 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

> 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.

> 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.

> 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

> Signing the transaction fee rate as a function of locktime

TIL


-- 
Prayank

A3B1 E430 2298 178F

[-- Attachment #2: Type: text/html, Size: 2825 bytes --]

 permalink raw reply	[|nested]