Is there a guide to learn how to program smart contracts for the Bitcoin blockchain?


2 Answers 2


Ivy is a higher-level language that allows you to write smart contracts for the Bitcoin protocol. It can compile to instructions for Bitcoin’s virtual machine, Bitcoin Script, and can be used to create SegWit-compatible Bitcoin addresses.

Ivy GitHub Repository

Another interesting approach is to use RSK. Rootstock is a project to execute smart contracts (turing complete) to the ecosystem of Bitcoin. It is a Sidechain that uses as currency the SBTC (Smart-BTC) which is convertible 1: 1 with Bitcoin (2-way peg).

Balzac is an high-level language for writing transactions, verifying their correctness, and compiling them into actual Bitcoin transactions. You can also use Balzac to design Bitcoin smart contracts.


I stepped over the same question, and to my knowledge there is no such guide. But There are some resources here:

https://en.bitcoin.it/wiki/Contract https://en.bitcoin.it/wiki/Smart_Property https://en.bitcoin.it/wiki/Dominant_Assurance_Contracts

and in Andreas' book "Mastering Bitcoin" (2nd edition), there is "CHAPTER 7 Advanced Transactions and Scripting" with examples for multisig, checklocktimeverify (CLTV) and checksequenceverify (CSV), all with nested "if-else-endif" statements.

some reference is here: https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki

some threads on bitcointalk:


and here: https://www.reddit.com/r/Bitcoin/comments/4kit49/is_it_safe_to_use_cltv_for_recurring_payments/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.