Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194]
	helo=mx.sourceforge.net)
	by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76)
	(envelope-from <pete@petertodd.org>) id 1Xmi0r-0000wM-AY
	for bitcoin-development@lists.sourceforge.net;
	Fri, 07 Nov 2014 11:47:33 +0000
Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of petertodd.org
	designates 62.13.148.154 as permitted sender)
	client-ip=62.13.148.154; envelope-from=pete@petertodd.org;
	helo=outmail148154.authsmtp.co.uk; 
Received: from outmail148154.authsmtp.co.uk ([62.13.148.154])
	by sog-mx-4.v43.ch3.sourceforge.com with esmtp (Exim 4.76)
	id 1Xmi0p-0005pE-0M for bitcoin-development@lists.sourceforge.net;
	Fri, 07 Nov 2014 11:47:33 +0000
Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235])
	by punt15.authsmtp.com (8.14.2/8.14.2/) with ESMTP id sA7BlMbP057127;
	Fri, 7 Nov 2014 11:47:22 GMT
Received: from savin.petertodd.org (75-119-251-161.dsl.teksavvy.com
	[75.119.251.161]) (authenticated bits=128)
	by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id sA7BlIXS038478
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO);
	Fri, 7 Nov 2014 11:47:21 GMT
Date: Fri, 7 Nov 2014 06:47:19 -0500
From: Peter Todd <pete@petertodd.org>
To: =?iso-8859-1?Q?Cl=E9ment?= Elbaz <clem.ds@gmail.com>
Message-ID: <20141107114718.GA20990@savin.petertodd.org>
References: <A53D2C60-1D6A-4796-9776-3AF396BEC9F1@bitsofproof.com>
	<545BF0C2.3030201@bluematt.me>
	<CAJHLa0NTj6m4JpHx3+nWtYVV1Zpwf-FaxiyFX9DR821cQYVqsg@mail.gmail.com>
	<545BFAD6.1000504@riseup.net>
	<20141106232649.GD26859@savin.petertodd.org>
	<545C0617.7020300@riseup.net>
	<20141107000310.GA6532@savin.petertodd.org>
	<B29D4E11-E69E-49DE-9E4C-741DDA01B352@bitsofproof.com>
	<20141107084810.GA7878@savin.petertodd.org>
	<CAP63atZv_WJX3Ev6HirVVbZdjn6oayqMfjFDj657TG4VKdL9Nw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe"
Content-Disposition: inline
In-Reply-To: <CAP63atZv_WJX3Ev6HirVVbZdjn6oayqMfjFDj657TG4VKdL9Nw@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Server-Quench: d5ad846e-6673-11e4-b396-002590a15da7
X-AuthReport-Spam: If SPAM / abuse - report it at:
	http://www.authsmtp.com/abuse
X-AuthRoute: OCd2Yg0TA1ZNQRgX IjsJECJaVQIpKltL GxAVKBZePFsRUQkR
	bgdMdgUUFloCAgsB AmIbWlVeVFp7W2E7 bA9PbARUfEhLXhtr
	VklWR1pVCwQmQm0G dEJnOnpydA1Cf3Y+ Z0dlXHUVCEErIU55
	RBtJE2sBZnphaTUb TRJbfgVJcANIexZF O1F6ACIKLwdSbGoL
	NQ4vNDcwO3BTJTpY RgYVKF8UXXNDIj4x DxwDEzsuFlABWzR7
	KBJuNUQdAEcXPQ05 Nl06VFQDLgRwQgZE Hl1MCyZdb1IGSyd5
	RR9aUAYlMRJ9aBx8 NSYJBDBsL3RYRyUw 
X-Authentic-SMTP: 61633532353630.1023:706
X-AuthFastPath: 0 (Was 255)
X-AuthSMTP-Origin: 75.119.251.161/587
X-AuthVirus-Status: No virus detected - but ensure you scan with your own
	anti-virus system.
X-Spam-Score: -1.5 (-)
X-Spam-Report: Spam Filtering performed by mx.sourceforge.net.
	See http://spamassassin.org/tag/ for more details.
	-1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for
	sender-domain
	-0.0 SPF_PASS               SPF: sender matches SPF record
X-Headers-End: 1Xmi0p-0005pE-0M
Cc: bitcoin-development@lists.sourceforge.net,
	Justus Ranvier <justusranvier@riseup.net>
Subject: Re: [Bitcoin-development] The difficulty of writing consensus
 critical code: the SIGHASH_SINGLE bug
X-BeenThere: bitcoin-development@lists.sourceforge.net
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: <bitcoin-development.lists.sourceforge.net>
List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=unsubscribe>
List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=bitcoin-development>
List-Post: <mailto:bitcoin-development@lists.sourceforge.net>
List-Help: <mailto:bitcoin-development-request@lists.sourceforge.net?subject=help>
List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/bitcoin-development>,
	<mailto:bitcoin-development-request@lists.sourceforge.net?subject=subscribe>
X-List-Received-Date: Fri, 07 Nov 2014 11:47:33 -0000


--G4iJoqBmSsgzjUCe
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Nov 07, 2014 at 11:30:22AM +0000, Cl=E9ment Elbaz wrote:
> Thinking out loud here : would it make sense to separate the consensus co=
de
> into some kind of "Bitcoin Kernel" (similar to the Linux Kernel) project
> that could be used by anyone ?

That's a pretty old idea, and we're working on it. First step is a
stand-alone script verification library:

https://github.com/theuni/bitcoin/blob/da18a0266c4de76c2a461cc2984aa2fa066c=
42f5/src/script/bitcoinconsensus.h

#ifndef H_BITCOIN_BITCOINCONSENSUS
#define H_BITCOIN_BITCOINCONSENSUS

#if defined(BUILD_BITCOIN_INTERNAL) && defined(HAVE_CONFIG_H)
#include "config/bitcoin-config.h"
  #if defined(_WIN32)
    #if defined(DLL_EXPORT)
      #if defined(HAVE_FUNC_ATTRIBUTE_DLLEXPORT)
        #define EXPORT_SYMBOL __declspec(dllexport)
      #else
        #define EXPORT_SYMBOL
      #endif
    #endif
  #elif defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
    #define EXPORT_SYMBOL __attribute__ ((visibility ("default")))
  #endif
#elif defined(MSC_VER) && !defined(STATIC_LIBBITCOINCONSENSUS)
  #define EXPORT_SYMBOL __declspec(dllimport)
#endif

#ifndef EXPORT_SYMBOL
  #define EXPORT_SYMBOL
#endif

#ifdef __cplusplus
extern "C" {
#else
#include <stdbool.h>
#endif

/** Script verification flags */
enum
{
    bitcoinconsensus_SCRIPT_FLAGS_VERIFY_NONE      =3D 0,
    bitcoinconsensus_SCRIPT_FLAGS_VERIFY_P2SH      =3D (1U << 0), // evalua=
te P2SH (BIP16) subscripts
};

/// Returns true if the input nIn of the serialized transaction pointed to =
by
/// txTo correctly spends the scriptPubKey pointed to by scriptPubKey under
/// the additional constraints specified by flags.
EXPORT_SYMBOL bool bitcoinconsensus_verify_script(const unsigned char *scri=
ptPubKey, const unsigned int scriptPubKeyLen,
                                    const unsigned char *txTo        , cons=
t unsigned int txToLen,
                                    const unsigned int nIn, const unsigned =
int flags);

EXPORT_SYMBOL unsigned int bitcoinconsensus_version();

#ifdef __cplusplus
} // extern "C"
#endif

#undef EXPORT_SYMBOL

#endif // H_BITCOIN_BITCOINCONSENSUS

--=20
'peter'[:-1]@petertodd.org
000000000000000001208038fd7130083ff118147890dbb37913ffa83c1f48cd

--G4iJoqBmSsgzjUCe
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: Digital signature

-----BEGIN PGP SIGNATURE-----

iQGrBAEBCACVBQJUXLFDXhSAAAAAABUAQGJsb2NraGFzaEBiaXRjb2luLm9yZzAw
MDAwMDAwMDAwMDAwMDAwMTIwODAzOGZkNzEzMDA4M2ZmMTE4MTQ3ODkwZGJiMzc5
MTNmZmE4M2MxZjQ4Y2QvFIAAAAAAFQARcGthLWFkZHJlc3NAZ251cGcub3JncGV0
ZUBwZXRlcnRvZC5vcmcACgkQJIFAPaXwkftnDwf9F36EgdMisCiwfNJt1XpNSqRd
ZkPAVA1/Z+5XfkzGLcfYEeYR3EpR3SChCrj2SlJeNa168K1cBczBnXNuqCVddiO4
ECmcE0SOQw3+y8e2e27Hvot6P13ToNZSXQ1Iu6TyGTrhwilfra9G6O9SMIjz5IJR
msZiO05mg2DOz3ZWm8IMLfF/Dh451sq0VSRrXXiD5M8usb00D41IGNf812zMijvm
MCdvpQpqp7PjCuX5qEws4K4bA0SDe9rkyWBU923l2nkcO5JkRumIFdxrVnxShCJO
Aeki5Anq6vxYP02UYUk0iUWekt8TbppQqdGbr51l0uH9pvc5a/6G1/yvl9zZlw==
=Mx6n
-----END PGP SIGNATURE-----

--G4iJoqBmSsgzjUCe--