Bitcoin scripting language extensions, collaboration requested
Mark Friedenbach <[email protected]> Tue, 28 Jan 2014 15:34:05 -0800
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Organization | Monetize.io Inc. |
| Message-ID | <[email protected]> |
--xQiF81sN1PBzrqWDk4p7c4ECiFIaEOe4itduNfU
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
My name is Mark Friedenbach and I am a bitcoin-core developer [1]. You
probably know Bitcoin as a peer-to-peer protocol for the digital
money. What you may not know is that Bitcoin uses a simple,
Forth-derived but crippled concatenative language for encoding smart
contracts representing the terms and conditions for transferring
ownership of digital goods.
I'm part of a small volunteer team that is looking at ways we can
extend the Bitcoin protocol so as to be able to perform a broader
range of financial services. For example, a more expressive scripting
language could enable attaching conditionals / "covenants" to assets
which stay with them even as they transfer owners, e.g. a restricted
buy-back option for an IOU certificate, which lets the debtor pay off
the loan without requiring permission of the owner of the debt or
impacting his/her rights in any other way. This is not currently
possible in Bitcoin.
We would like to prototype a replacement contract scripting language
for Bitcoin derived from Joy, or any one of the other purely
functional concatenative languages I see discussed in this list's
archives. This is a chance to help secure and extend the capabilities
of a $10 billion economy, and to make an expressive concatenative
language which will be used by the financial industry for decades to come.
There are also some interesting requirements that we must place on
such a language:
a. The language must be strongly typed with a decidable type system
capable of constructing proofs of nontrivial properties. Examples
beyond ordinary type safety verification might include: proving that
the scripts requirements can be met solely with knowledge of a set of
signature-generating private keys, or proving the opposite (that a
script is unspendable); proving that a script has a constraint
attached (e.g. cannot be spent before block height N, or simple
restricted buy-back capability) which can then be pattern matched
against a whitelist of acceptable constraints.
b. The script must be simple, as thousands of nodes world-wide running
multiple implementations will need to reach global consensus over not
just the outcome of a script, but also some aspects of the execution
(e.g. an instruction counter). Consensus failures whether due to bugs
or faulty designs can lead to unsecured payment networks and possible
losses in the millions of dollars or more. Interpreter escape would be
absolutely catastrophic. So simple, minimal, but expressive
architectures with simple fail-safe implementations are to be
preferred over complex but user-friendly (RISC is better than CISC).
c. The language must support the various cryptographic primitives
necessary for performing core bitcoin functions. Mostly this just
means adding a handful of builtin words for performing strong
cryptographic hashes and elliptic curve signature verification, but
there are some requirements on the language design as well, chiefly in
making decisions about how the stack is represented for hash
operations and in supporting authenticated data structures as
primitive types for external state.
d. Merkle structured compiled form [2]. A script containing quoted
forms may be considered a hierarchical structure, and Merkle
compression allows us to reduce such a script to a single root hash
value (to be placed in the output of a bitcoin transaction) or to
"prune" execution pathways which are not taken when the script is
instantiated at spend time, either to compress a large script or to
provide privacy over the data in branches not taken.
The requirements (a) and (b) are probably the most interesting for
this list. I must admit that type theory is outside of my area of
expertise. I know only enough to know that we need it, but not enough
to design such a system myself. I imagine that it must also be an
interesting challenge to design a minimalistic language that is
trivial to implement, but still capable of generating expressive,
compact, readable programs.
If anyone here is interested in collaborating with us, or even just
sharing their experience in comments, we'd appreciate it very much!
Happy hacking,
Mark Friedenbach
[1]: Bitcoin is a peer-to-peer currency and payment protocol:
http://bitcoin.org/
[2]: By analogy to the Merkle hash-tree:
http://en.wikipedia.org/wiki/Merkle_tree
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iQIcBAEBAgAGBQJS6D5pAAoJEAdzVfsmodw4OD4QAK3PrzboP91SfIsvUbPfTHaS
r14eNHNlAQjS0Hdc7vwDEsMsZVB2G4+O+7dpxY1T/YTCM236wPD9q4c85WL35QFJ
CGXdhNeUUYwfPsS9NUC8wyFgm0fC/y6I8dhmZ2OzfUR4SDJF785UZE7FAlFg6zYK
lNKX4jN4Q6XKte/hmvCruDhZ8h3DkwUBkVrc2YqEYtaRRm6VUEXA/tA0tiIXNqfC
FznADvGMxwgH4QamGErfA1cslqbRUtbjneXTpnC9tNmDLZSpQ2HfuYqyGVNupfLU
4dXPNXY/T63HVABhTy+ERSPy19gh6O9WS0XlwwPPoYUuAFN/H285LeOTJC0AgmaL
0VKP0iKkBmyMw+AysVZxS6hHK/yl14+Rmq6SZb322qv/hf3paPEgUZGKufcH1IvF
0LFIZHK+cWaJIigUzuco8jHao0CPaCiV0rDJkK8ZFFY4Ox5Q+PbiQ0tiDFWzMIiL
Rni34wzQKpp7kowcTTbrPNrKeIyxkKG2krQufh4qtRmOOxjOHgdHWsEuThmrAfGc
hZWwd3SLCV0Abu2WOKoZpikYTgQOgOHEDiRYTRHPz/RH9rql15EFRdSFf1zFIiN4
btFKKQQjzgP9KHgMzRl6tJ76PR2HE1xq0BVZdxnQDlWgZnlnvsHMDG5Z2X4v4ZUB
vGJV4ww+Rz9SVQszIHpr
=5kz9
-----END PGP SIGNATURE-----
--xQiF81sN1PBzrqWDk4p7c4ECiFIaEOe4itduNfU
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body style="background-color: #fff;">
<span style="display:none"> </span>
<!--~-|**|PrettyHtmlStartT|**|-~-->
<div id="ygrp-mlmsg" style="position:relative;">
<div id="ygrp-msg" style="z-index: 1;">
<!--~-|**|PrettyHtmlEndT|**|-~-->
<div id="ygrp-text" >
<p>-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA1<br>
<br>
Hi,<br>
<br>
My name is Mark Friedenbach and I am a bitcoin-core developer [1]. You<br>
probably know Bitcoin as a peer-to-peer protocol for the digital<br>
money. What you may not know is that Bitcoin uses a simple,<br>
Forth-derived but crippled concatenative language for encoding smart<br>
contracts representing the terms and conditions for transferring<br>
ownership of digital goods.<br>
<br>
I'm part of a small volunteer team that is looking at ways we can<br>
extend the Bitcoin protocol so as to be able to perform a broader<br>
range of financial services. For example, a more expressive scripting<br>
language could enable attaching conditionals / "covenants" to assets<br>
which stay with them even as they transfer owners, e.g. a restricted<br>
buy-back option for an IOU certificate, which lets the debtor pay off<br>
the loan without requiring permission of the owner of the debt or<br>
impacting his/her rights in any other way. This is not currently<br>
possible in Bitcoin.<br>
<br>
We would like to prototype a replacement contract scripting language<br>
for Bitcoin derived from Joy, or any one of the other purely<br>
functional concatenative languages I see discussed in this list's<br>
archives. This is a chance to help secure and extend the capabilities<br>
of a $10 billion economy, and to make an expressive concatenative<br>
language which will be used by the financial industry for decades to come.<br>
<br>
There are also some interesting requirements that we must place on<br>
such a language:<br>
<br>
a. The language must be strongly typed with a decidable type system<br>
capable of constructing proofs of nontrivial properties. Examples<br>
beyond ordinary type safety verification might include: proving that<br>
the scripts requirements can be met solely with knowledge of a set of<br>
signature-generating private keys, or proving the opposite (that a<br>
script is unspendable); proving that a script has a constraint<br>
attached (e.g. cannot be spent before block height N, or simple<br>
restricted buy-back capability) which can then be pattern matched<br>
against a whitelist of acceptable constraints.<br>
<br>
b. The script must be simple, as thousands of nodes world-wide running<br>
multiple implementations will need to reach global consensus over not<br>
just the outcome of a script, but also some aspects of the execution<br>
(e.g. an instruction counter). Consensus failures whether due to bugs<br>
or faulty designs can lead to unsecured payment networks and possible<br>
losses in the millions of dollars or more. Interpreter escape would be<br>
absolutely catastrophic. So simple, minimal, but expressive<br>
architectures with simple fail-safe implementations are to be<br>
preferred over complex but user-friendly (RISC is better than CISC).<br>
<br>
c. The language must support the various cryptographic primitives<br>
necessary for performing core bitcoin functions. Mostly this just<br>
means adding a handful of builtin words for performing strong<br>
cryptographic hashes and elliptic curve signature verification, but<br>
there are some requirements on the language design as well, chiefly in<br>
making decisions about how the stack is represented for hash<br>
operations and in supporting authenticated data structures as<br>
primitive types for external state.<br>
<br>
d. Merkle structured compiled form [2]. A script containing quoted<br>
forms may be considered a hierarchical structure, and Merkle<br>
compression allows us to reduce such a script to a single root hash<br>
value (to be placed in the output of a bitcoin transaction) or to<br>
"prune" execution pathways which are not taken when the script is<br>
instantiated at spend time, either to compress a large script or to<br>
provide privacy over the data in branches not taken.<br>
<br>
The requirements (a) and (b) are probably the most interesting for<br>
this list. I must admit that type theory is outside of my area of<br>
expertise. I know only enough to know that we need it, but not enough<br>
to design such a system myself. I imagine that it must also be an<br>
interesting challenge to design a minimalistic language that is<br>
trivial to implement, but still capable of generating expressive,<br>
compact, readable programs.<br>
<br>
If anyone here is interested in collaborating with us, or even just<br>
sharing their experience in comments, we'd appreciate it very much!<br>
<br>
Happy hacking,<br>
Mark Friedenbach<br>
<br>
[1]: Bitcoin is a peer-to-peer currency and payment protocol:<br>
http://bitcoin.org/<br>
<br>
[2]: By analogy to the Merkle hash-tree:<br>
http://en.wikipedia.org/wiki/Merkle_tree<br>
-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v1.4.14 (GNU/Linux)<br>
Comment: GPGTools - http://gpgtools.org<br>
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/<br>
<br>
iQIcBAEBAgAGBQJS6D5pAAoJEAdzVfsmodw4OD4QAK3PrzboP91SfIsvUbPfTHaS<br>
r14eNHNlAQjS0Hdc7vwDEsMsZVB2G4+O+7dpxY1T/YTCM236wPD9q4c85WL35QFJ<br>
CGXdhNeUUYwfPsS9NUC8wyFgm0fC/y6I8dhmZ2OzfUR4SDJF785UZE7FAlFg6zYK<br>
lNKX4jN4Q6XKte/hmvCruDhZ8h3DkwUBkVrc2YqEYtaRRm6VUEXA/tA0tiIXNqfC<br>
FznADvGMxwgH4QamGErfA1cslqbRUtbjneXTpnC9tNmDLZSpQ2HfuYqyGVNupfLU<br>
4dXPNXY/T63HVABhTy+ERSPy19gh6O9WS0XlwwPPoYUuAFN/H285LeOTJC0AgmaL<br>
0VKP0iKkBmyMw+AysVZxS6hHK/yl14+Rmq6SZb322qv/hf3paPEgUZGKufcH1IvF<br>
0LFIZHK+cWaJIigUzuco8jHao0CPaCiV0rDJkK8ZFFY4Ox5Q+PbiQ0tiDFWzMIiL<br>
Rni34wzQKpp7kowcTTbrPNrKeIyxkKG2krQufh4qtRmOOxjOHgdHWsEuThmrAfGc<br>
hZWwd3SLCV0Abu2WOKoZpikYTgQOgOHEDiRYTRHPz/RH9rql15EFRdSFf1zFIiN4<br>
btFKKQQjzgP9KHgMzRl6tJ76PR2HE1xq0BVZdxnQDlWgZnlnvsHMDG5Z2X4v4ZUB<br>
vGJV4ww+Rz9SVQszIHpr<br>
=5kz9<br>
-----END PGP SIGNATURE-----<br>
</p>
</div>
<!--~-|**|PrettyHtmlStart|**|-~-->
<div style="color: #fff; height: 0;">__._,_.___</div>
<table cellspacing=4px style="margin-top: 20px; margin-bottom: 10px;">
<tbody>
<tr>
<td style="font-size: 12px; font-family: arial; font-weight: bold; padding: 7px 5px 5px; color: #FFF; background-color: #F2F2F2; border: 1px solid #EAEAEA " >
<a style="text-decoration: none; color: #2D50FD" href="http://groups.yahoo.com/group/concatenative/post;_ylc=X3oDMTJwNmlnZm0yBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BG1zZ0lkAzQ5NTAEc2VjA2Z0cgRzbGsDcnBseQRzdGltZQMxMzkwOTUyMDQ3?act=reply&messageNum=4950">Reply via web post</a>
</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px; color: #FFF; background-color: #F2F2F2; border: 1px solid #EAEAEA; " >
<a href="mailto:[email protected]?subject=Re%3A%20Bitcoin%20scripting%20language%20extensions%2C%20collaboration%20requested" style="text-decoration: none; color: #2D50FD;">
Reply to sender </a>
</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px; color: #FFF; background-color: #F2F2F2; border: 1px solid #EAEAEA; ">
<a href="mailto:[email protected]?subject=Re%3A%20Bitcoin%20scripting%20language%20extensions%2C%20collaboration%20requested" style="text-decoration: none; color: #2D50FD">
Reply to group </a>
</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px; color: #FFF; background-color: #F2F2F2; border: 1px solid #EAEAEA; " >
<a href="http://groups.yahoo.com/group/concatenative/post;_ylc=X3oDMTJlcmFrMmQxBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA250cGMEc3RpbWUDMTM5MDk1MjA0Nw--" style="text-decoration: none; color: #2D50FD">Start a New Topic</a>
</td>
<td style="font-size: 12px; font-family: arial; padding: 7px 5px 5px; color: #2D50FD; background-color: #F2F2F2; border: 1px solid #EAEAEA; " >
<a href="http://groups.yahoo.com/group/concatenative/message/4950;_ylc=X3oDMTM0cWtlZmY1BF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BG1zZ0lkAzQ5NTAEc2VjA2Z0cgRzbGsDdnRwYwRzdGltZQMxMzkwOTUyMDQ3BHRwY0lkAzQ5NTA-" style="text-decoration: none; color: #2D50FD;">Messages in this topic</a>
(1)
</td>
</tr>
</tbody>
</table>
<!------- Start Nav Bar ------>
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-vital" style="background-color: #f2f2f2; font-family: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">
<span id="vithd" style="font-weight: bold; color: #333; text-transform: uppercase; ">Recent Activity:</span>
<ul style="list-style-type: none; margin: 0; padding: 0; display: inline;">
<li style="border-right: 1px solid #000; font-weight: 700; display: inline; padding: 0 5px; margin-left: 0;">
<span class="cat"><a href="http://groups.yahoo.com/group/concatenative/members;_ylc=X3oDMTJmMGd2MXA3BF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzEzOTA5NTIwNDc-?o=6" style="text-decoration: none;">New Members</a></span>
<span class="ct" style="color: #ff7900;">1</span>
</li>
</ul>
<div style="clear: both; padding-top: 2px; color: #1e66ae;">
<a href="http://groups.yahoo.com/group/concatenative;_ylc=X3oDMTJlZ2oxdTJkBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTM5MDk1MjA0Nw--" style="text-decoration: none;">Visit Your Group</a>
</div>
</div>
<div id="ft" style="font-family: Arial; font-size: 11px; margin-top: 5px; padding: 0 2px 0 0; clear: both;">
<a href="http://groups.yahoo.com/;_ylc=X3oDMTJkcDc3NzQzBF9TAzk3MzU5NzE0BGdycElkAzE4MzkyNzQEZ3Jwc3BJZAMxNzA1MDA2NzY0BHNlYwNmdHIEc2xrA2dmcARzdGltZQMxMzkwOTUyMDQ3" style="float: left;"><img src="http://l.yimg.com/ru/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height="15" width="137" alt="Yahoo! Groups" style="border: 0;"/></a>
<div style="color: #747575; float: right;">Switch to: <a href="mailto:[email protected]?subject=Change Delivery Format: Traditional" style="text-decoration: none;">Text-Only</a>, <a href="mailto:[email protected]?subject=Email Delivery: Digest" class="margin-rt" style="text-decoration: none;">Daily Digest</a> • <a href="mailto:[email protected]?subject=Unsubscribe" style="text-decoration: none;">Unsubscribe</a> • <a href="http://info.yahoo.com/legal/us/yahoo/utos/terms/" style="text-decoration: none;">Terms of Use</a> </div>
</div>
<!-- |**|end egp html banner|**| -->
</div> <!-- ygrp-msg -->
<!-- Sponsor -->
<!-- |**|begin egp html banner|**| -->
<div id="ygrp-sponsor" style="width:160px; float:right; clear:none; margin:0 0 25px 0; background: #fff;">
<!-- Start Recommendations -->
<div id="ygrp-reco">
</div>
<!-- End Recommendations -->
</div> <!-- |**|end egp html banner|**| -->
<div style="clear:both; color: #FFF; font-size:1px;">.</div>
</div>
<img src="http://geo.yahoo.com/serv?s=97359714/grpId=1839274/grpspId=1705006764/msgId=4950/stime=1390952047" width="1" height="1"> <br>
<div style="color: #fff; height: 0;">__,_._,___</div>
<!--~-|**|PrettyHtmlEnd|**|-~-->
</body>
<!--~-|**|PrettyHtmlStart|**|-~-->
<head>
<style type="text/css">
<!--
#ygrp-mkp {
border: 1px solid #d8d8d8;
font-family: Arial;
margin: 10px 0;
padding: 0 10px;
}
#ygrp-mkp hr {
border: 1px solid #d8d8d8;
}
#ygrp-mkp #hd {
color: #628c2a;
font-size: 85%;
font-weight: 700;
line-height: 122%;
margin: 10px 0;
}
#ygrp-mkp #ads {
margin-bottom: 10px;
}
#ygrp-mkp .ad {
padding: 0 0;
}
#ygrp-mkp .ad p {
margin: 0;
}
#ygrp-mkp .ad a {
color: #0000ff;
text-decoration: none;
}
#ygrp-sponsor #ygrp-lc {
font-family: Arial;
}
#ygrp-sponsor #ygrp-lc #hd {
margin: 10px 0px;
font-weight: 700;
font-size: 78%;
line-height: 122%;
}
#ygrp-sponsor #ygrp-lc .ad {
margin-bottom: 10px;
padding: 0 0;
}
#actions {
font-family: Verdana;
font-size: 11px;
padding: 10px 0;
}
#activity {
background-color: #e0ecee;
float: left;
font-family: Verdana;
font-size: 10px;
padding: 10px;
}
#activity span {
font-weight: 700;
}
#activity span:first-child {
text-transform: uppercase;
}
#activity span a {
color: #5085b6;
text-decoration: none;
}
#activity span span {
color: #ff7900;
}
#activity span .underline {
text-decoration: underline;
}
.attach {
clear: both;
display: table;
font-family: Arial;
font-size: 12px;
padding: 10px 0;
width: 400px;
}
.attach div a {
text-decoration: none;
}
.attach img {
border: none;
padding-right: 5px;
}
.attach label {
display: block;
margin-bottom: 5px;
}
.attach label a {
text-decoration: none;
}
blockquote {
margin: 0 0 0 4px;
}
.bold {
font-family: Arial;
font-size: 13px;
font-weight: 700;
}
.bold a {
text-decoration: none;
}
dd.last p a {
font-family: Verdana;
font-weight: 700;
}
dd.last p span {
margin-right: 10px;
font-family: Verdana;
font-weight: 700;
}
dd.last p span.yshortcuts {
margin-right: 0;
}
div.attach-table div div a {
text-decoration: none;
}
div.attach-table {
width: 400px;
}
div.file-title a, div.file-title a:active, div.file-title a:hover, div.file-title a:visited {
text-decoration: none;
}
div.photo-title a, div.photo-title a:active, div.photo-title a:hover, div.photo-title a:visited {
text-decoration: none;
}
div#ygrp-mlmsg #ygrp-msg p a span.yshortcuts {
font-family: Verdana;
font-size: 10px;
font-weight: normal;
}
.green {
color: #628c2a;
}
.MsoNormal {
margin: 0 0 0 0;
}
o {
font-size: 0;
}
#photos div {
float: left;
width: 72px;
}
#photos div div {
border: 1px solid #666666;
height: 62px;
overflow: hidden;
width: 62px;
}
#photos div label {
color: #666666;
font-size: 10px;
overflow: hidden;
text-align: center;
white-space: nowrap;
width: 64px;
}
#reco-category {
font-size: 77%;
}
#reco-desc {
font-size: 77%;
}
.replbq {
margin: 4px;
}
#ygrp-actbar div a:first-child {
/* border-right: 0px solid #000;*/
margin-right: 2px;
padding-right: 5px;
}
#ygrp-mlmsg {
font-size: 13px;
font-family: Arial, helvetica,clean, sans-serif;
*font-size: small;
*font: x-small;
}
#ygrp-mlmsg table {
font-size: inherit;
font: 100%;
}
#ygrp-mlmsg select, input, textarea {
font: 99% Arial, Helvetica, clean, sans-serif;
}
#ygrp-mlmsg pre, code {
font:115% monospace;
*font-size:100%;
}
#ygrp-mlmsg * {
line-height: 1.22em;
}
#ygrp-mlmsg #logo {
padding-bottom: 10px;
}
#ygrp-msg p a {
font-family: Verdana;
}
#ygrp-msg p#attach-count span {
color: #1E66AE;
font-weight: 700;
}
#ygrp-reco #reco-head {
color: #ff7900;
font-weight: 700;
}
#ygrp-reco {
margin-bottom: 20px;
padding: 0px;
}
#ygrp-sponsor #ov li a {
font-size: 130%;
text-decoration: none;
}
#ygrp-sponsor #ov li {
font-size: 77%;
list-style-type: square;
padding: 6px 0;
}
#ygrp-sponsor #ov ul {
margin: 0;
padding: 0 0 0 8px;
}
#ygrp-text {
font-family: Georgia;
}
#ygrp-text p {
margin: 0 0 1em 0;
}
#ygrp-text tt {
font-size: 120%;
}
#ygrp-vital ul li:last-child {
border-right: none !important;
}
-->
</style>
</head>
<!--~-|**|PrettyHtmlEnd|**|-~-->
</html>
<!-- end group email -->
--xQiF81sN1PBzrqWDk4p7c4ECiFIaEOe4itduNfU--