<p>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. </p>

<p><a href="https://github.com/ivy-lang/ivy-bitcoin" rel="nofollow noreferrer">Ivy GitHub Repository</a></p>

<p>Another interesting approach is to use <a href="https://github.com/rsksmart/rskj/wiki/Creating-Smart-Contracts-in-RSK" rel="nofollow noreferrer">RSK</a>. 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). </p>

<p><a href="https://blockchain.unica.it/balzac/docs/nutshell.html" rel="nofollow noreferrer">Balzac</a> 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. </p>

CC BY-SA 4.0
2018-11-14T19:38:10.043Z
2018-11-14T19:38:10.043Z
Gokul Alex
<p>I stepped over the same question, and to my knowledge there is no such guide. But There are some resources here:</p>

<p><a href="https://en.bitcoin.it/wiki/Contract" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Contract</a>
<a href="https://en.bitcoin.it/wiki/Smart_Property" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Smart_Property</a>
<a href="https://en.bitcoin.it/wiki/Dominant_Assurance_Contracts" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Dominant_Assurance_Contracts</a></p>

<p>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. </p>

<p>some reference is here: <a href="https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki" rel="nofollow noreferrer">https://github.com/bitcoin/bips/blob/master/bip-0112.mediawiki</a></p>

<p>some threads on bitcointalk:</p>

<pre><code>https://bitcointalk.org/index.php?topic=1300723.20
https://bitcointalk.org/index.php?topic=1558207.0
https://bitcointalk.org/index.php?topic=1952248.0
</code></pre>

<p>and here: <a href="https://www.reddit.com/r/Bitcoin/comments/4kit49/is_it_safe_to_use_cltv_for_recurring_payments/" rel="nofollow noreferrer">https://www.reddit.com/r/Bitcoin/comments/4kit49/is_it_safe_to_use_cltv_for_recurring_payments/</a></p>

CC BY-SA 3.0
2017-12-26T20:50:06.767Z
2017-12-26T20:50:06.767Z
pebwindkraft
<p>Is there a guide to learn how to program smart contracts for the Bitcoin blockchain?</p>

CC BY-SA 3.0
2016-10-31T00:09:49.457Z
Possible duplicate of [How do Scripts work?](http://bitcoin.stackexchange.com/questions/553/how-do-scripts-work)
rny
<blockchain><development><smartcontracts>
How do I program smart contracts?
Blackybecks
# How do I program smart contracts?

(Asked by: username_0 on 2016-10-30)

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

**Tags:** blockchain, development, smartcontracts

> **Comments:**
> **username_1**: Possible duplicate of [How do Scripts work?](http://bitcoin.stackexchange.com/questions/553/how-do-scripts-work)  

---

## 2 answers

### Answer by username_2 on 2018-11-14. Score: 1

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](https://github.com/ivy-lang/ivy-bitcoin)

Another interesting approach is to use [RSK](https://github.com/rsksmart/rskj/wiki/Creating-Smart-Contracts-in-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](https://blockchain.unica.it/balzac/docs/nutshell.html) 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.


---

### Answer by username_3 on 2017-12-26. Score: 0

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:
https://bitcointalk.org/index.php?topic=1300723.20
https://bitcointalk.org/index.php?topic=1558207.0
https://bitcointalk.org/index.php?topic=1952248.0

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


---

