Bitcoin Scripts and Smart Contracts. Explained.

28 users: 19 contracts

Create your Smart Contract

About Bitcoin Scripts

Scripting languages date back from thousands of years ago. Mathematic formulae are an example of scripting language.
Bitcoin scripts use a specialized scripting language to write secure smart contracts and complex transactions.

Prepare your own Bitcoin Address
A Smart Contract is initiated by computing a Bitcoin P2SH address. P2SH stands for Pay-to-Script-Hash, meaning the Contract Script is hashed into a unique address that will serve as a vault for the funds sent to it.
Spend from the P2SH Address
To spend the funds previously sent to the Smart Contract P2SH address, you will need to provide the original redeem Script as well as one or more private keys required by the Script.
A Script may enforce time conditions that must be met to unlock the funds held at the P2SH address. If you want to spend from the P2SH address of such Script, you may have to wait until the time lock expires.

A Stack-based Scripting System

Bitcoin uses a scripting system for complex transactions. Forth-like, Script is stack-based: instructions are 1-byte opcodes processed from left to right to be pushed on top of the stack sequentially, left-most first. All values are variable length byte arrays. Script is not Turing-complete, with no loops, for optimal security.

Lightning Network: a compelling use case for Bitcoin scripts

The Lightning Network white paper ( draft version dated November 20, 2015) describes a decentralized network for scalable, efficient payment channels. Transactions are sent over this routing network of micropayment channels whose transfer of value occurs off-blockchain. Bitcoin scripts enable time locked and hash locked transactions so that the payment protocol between users, via any number of Lightning Network hubs, remains trustless. This white paper by Joseph Poon and Thaddeus Dryja is probably the most important contribution since the invention of Bitcoin.

Download White Paper

Reach out

I have developped this website to help you write smart contracts using Bitcoin scripts. If you want to suggest a script be added to this demo portfolio, please let me know.

Pierre Noizat
Script Writer & Coder