Reserved IP Address°C
02-23-2025
BSV
$37.35
Vol 15.7m
-0.2%
BTC
$95589
Vol 16279.06m
-1.15%
BCH
$325.66
Vol 140.95m
1.5%
LTC
$127.87
Vol 597.05m
-0.73%
DOGE
$0.24
Vol 715.73m
-1.74%
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

Majorana 1 chip offers breakthroughs in quantum computing
Microsoft's Majorana 1 chip signifies a leap in quantum computing, but developers in the blockchain community should still be wary...
February 21, 2025
Ransomware losses tumble but threat remains: Chainalysis
A new report shows that collaboration between authorities and victims' refusal to negotiate with bad actors caused a decline in...
February 20, 2025
Advertisement
Advertisement
Advertisement