Profile picture
Yassine Elmandjra @yassineARK
, 13 tweets, 2 min read Read on Twitter
1/ A high-level overview of Script, Bitcoin’s scripting language:
2/ Script’s key design goal: computationally simple and compact, with native support for cryptographic operations
3/ Script is stack-based: Every instruction is executed exactly once in a linear manner (no loops).
4/ Script is Turing Incomplete: Unable to compute arbitrarily powerful functions... by design! “Miners have to run scripts, which are submitted by arbitrary participants in the network. They should not have the power to submit a script that might have an infinite loop.”
5/ An executed Bitcoin script can result in two possible outcomes:
1. Successful execution w/ no errors —> valid transaction accepted on the blockchain
2. Unsuccessful execution w/ an error —> invalid transaction not accepted on the blockchain
6/ Script is small: 1 byte represents 1 instruction. 256 bytes. 256 instructions. 15 are disabled. 75 are reserved.
7/ Script's instructions: basic arithmetic, basic logic, throwing errors, not throwing errors, returning early, hash functions, signature verifications, and other special instructions (CHECKMULTISIG, EQUALVERIFY, DUP, etc.)
8/ Script’s quirk: a multisignature implementation bug. CHECKMULTSIG instruction pops an extra data value off the stack and is dealt with by putting an extra dummy variable onto the stack.
9/ Executing a script: Only thing needed is a stack that can push data to and pop data from. No memory or variables needed.
10/ Bitcoin nodes, by default, have a whitelist of standard scripts, generally refusing to accept scripts that are not on the list. Most common script executed is one that specifies one public key and requires a signature for that public key to spend the coins.
11/ Some other scripts include:

Proof of Burn: script that can never be redeemed. sending coins to script establishes that they've been destroyed.

P2SH: Removes need for complex response from sender. Recipient can just specify a script's hash that the sender sends money to.
12/ Applications of Bitcoin scripts:

Escrow Transactions (implemented using a 2 of 3 multisig transaction), Green Addresses (3rd party trust trick that resolves waiting for confirmation), efficient micropayment, lock time
13/ Info was extracted from none other than “Bitcoin and Cryptocurrency Technologies” textbook. For a deeper dive, check out github.com/Causevest/arch…
Missing some Tweet in this thread?
You can try to force a refresh.

Like this thread? Get email updates or save it to PDF!

Subscribe to Yassine Elmandjra
Profile picture

Get real-time email alerts when new unrolls are available from this author!

This content may be removed anytime!

Twitter may remove this content at anytime, convert it as a PDF, save and print for later use!

Try unrolling a thread yourself!

how to unroll video

1) Follow Thread Reader App on Twitter so you can easily mention us!

2) Go to a Twitter thread (series of Tweets by the same owner) and mention us with a keyword "unroll" @threadreaderapp unroll

You can practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just three indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member and get exclusive features!

Premium member ($30.00/year)

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!