Reserved IP Address°C
02-14-2025
BSV
$39.47
Vol 24.2m
-3.62%
BTC
$96457
Vol 34280.56m
-1.66%
BCH
$335.88
Vol 172.87m
-2.7%
LTC
$126.64
Vol 1254.81m
-0.74%
DOGE
$0.26
Vol 1496.13m
-1.96%
Getting your Trinity Audio player ready...

This post was first published on Medium. Read Part 2 here.

Previously, we have introduced two ways to delegate the right to spend one’s bitcoin: one at Script level, the other at transaction level.

We generalize the former to delegate to any script/smart contract, instead of a public key only. It allows one to authorize arbitrary smart contract to spend one’s bitcoin.

two hands transfering a thing

The full code is shown below:

Contract DelegateToScript

Line 9 checks the delegated script is signed and thus authorized by the owner. Line 12 and 13 ensure the delegated script goes into the spending transaction’s output as the new locking script using OP_PUSH_TX, similar to the emulation of Pay to Script Hash (P2SH).

Watch: CoinGeek New York presentation, The Path to BitCoin Adoption: How to Turn the Entire Web into Bitcoin Apps

Recommended for you

Evaluating Bitcoin upgrade proposals
As sCrypt says, these proposals aim to enable Bitcoin's limited functionalities rather than tackling the broader need for expressivity and...
February 12, 2025
Bitcoin OP_CAT use cases series #5: Drivechain
sCrypt has created a smart contract operating similarly to the hashrate escrow mechanism in Bitcoin’s Drivechain proposal.
February 10, 2025
Advertisement
Advertisement
Advertisement