Bitcoin Scripts and Smart Contracts. Explained.

24 users: 25 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 P2SH 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.

Stack image 3e1cc1ec6380a37d5c1a909064e541ccfe232c76c9d62257a80284d542fe2e85

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.

Team 2 b66414220ad0510c1b1401e84400e4fb0349f221b393225c950858d3276b10b6
Pierre Noizat
Script Writer & Coder