<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Libbitcoin_Consensus</id>
	<title>Libbitcoin Consensus - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://en.zaoniao.it/index.php?action=history&amp;feed=atom&amp;title=Libbitcoin_Consensus"/>
	<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Libbitcoin_Consensus&amp;action=history"/>
	<updated>2026-05-15T09:32:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.32.0</generator>
	<entry>
		<id>http://en.zaoniao.it/index.php?title=Libbitcoin_Consensus&amp;diff=5701&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;The [https://github.com/libbitcoin/libbitcoin-consensus libbitcoin-consensus] library is an optional dependency of libbitcoin-blockchain. It is conce...&quot;</title>
		<link rel="alternate" type="text/html" href="http://en.zaoniao.it/index.php?title=Libbitcoin_Consensus&amp;diff=5701&amp;oldid=prev"/>
		<updated>2019-06-09T13:27:36Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The [https://github.com/libbitcoin/libbitcoin-consensus libbitcoin-consensus] library is an optional dependency of &lt;a href=&quot;/Libbitcoin_Blockchain&quot; title=&quot;Libbitcoin Blockchain&quot;&gt;libbitcoin-blockchain&lt;/a&gt;. It is conce...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The [https://github.com/libbitcoin/libbitcoin-consensus libbitcoin-consensus] library is an optional dependency of [[Libbitcoin_Blockchain|libbitcoin-blockchain]]. It is conceptually redundant with native functionality within [[Libbitcoin_Common|libbitcoin]].&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
 #include &amp;amp;lt;cstdint&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;string&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;vector&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;bitcoin/consensus.hpp&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 // For bc::decode_base16 utility.&lt;br /&gt;
 #include &amp;amp;lt;bitcoin/bitcoin.hpp&amp;amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 #define VERIFY_TX \&lt;br /&gt;
 &amp;quot;01000000017d01943c40b7f3d8a00a2d62fa1d560bf739a2368c180615b0a793&amp;quot; \&lt;br /&gt;
 &amp;quot;7c0e883e7c000000006b4830450221008f66d188c664a8088893ea4ddd968902&amp;quot; \&lt;br /&gt;
 &amp;quot;4ea5593877753ecc1e9051ed58c15168022037109f0d06e6068b7447966f751d&amp;quot; \&lt;br /&gt;
 &amp;quot;e8474641ad2b15ec37f4a9d159b02af68174012103e208f5403383c77d5832a2&amp;quot; \&lt;br /&gt;
 &amp;quot;68c9f71480f6e7bfbdfa44904becacfad66163ea31ffffffff01c8af00000000&amp;quot; \&lt;br /&gt;
 &amp;quot;00001976a91458b7a60f11a904feef35a639b6048de8dd4d9f1c88ac00000000&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 #define PREVOUT_SCRIPT \&lt;br /&gt;
 &amp;quot;76a914c564c740c6900b93afc9f1bdaef0a9d466adf6ee88ac&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 // Validate a transaction against a single previous output script.&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
 using namespace libbitcoin::consensus;&lt;br /&gt;
 &lt;br /&gt;
 constexpr uint32_t tx_input_index = 0;&lt;br /&gt;
 constexpr uint32_t flags = verify_flags_p2sh |&lt;br /&gt;
 verify_flags_checklocktimeverify | verify_flags_dersig;&lt;br /&gt;
 &lt;br /&gt;
 const std::string tx(VERIFY_TX);&lt;br /&gt;
 const std::string ps(PREVOUT_SCRIPT);&lt;br /&gt;
 &lt;br /&gt;
 std::vector&amp;amp;lt;uint8_t&amp;amp;gt; tx_data, ps_data;&lt;br /&gt;
 /* bool */ bc::decode_base16(tx_data, tx);&lt;br /&gt;
 /* bool */ bc::decode_base16(ps_data, ps);&lt;br /&gt;
 &lt;br /&gt;
 const auto result = verify_script(&amp;amp;tx_data[0], tx_data.size(),&lt;br /&gt;
 &amp;amp;ps_data[0], ps_data.size(), tx_input_index, flags);&lt;br /&gt;
 &lt;br /&gt;
 return result == verify_result_eval_true ? 0 : 1;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
==Background==&lt;br /&gt;
The consensus library exists to provide consensus validation identical in outcome to [[Bitcoind|bitcoind]]. The integral [[Libbitcoin_Common|libbitcoin]] script engine provides the same checks. However given the complexity of the validation code it is effectively impossible to prove that two implementations are identical in outcome, even with extensive testing. This effectively makes the bitcoind ''implementation'' a standard (as opposed to an RFC or BIP).&lt;br /&gt;
&lt;br /&gt;
That has helped stifle the adoption of alternative full node implementations. While it has been argued that consensus risk from any particular implementation is a red herring it was decided to give Libbitcoin developers and users the option. Following much deliberation and a recommendation by [[Peter_Todd|Peter Todd]] it was decided to package this library independently in order to provide better consistency, a leaner dependency, and more formal isolation from bitcoind. The library is free of both libbitcoin and bitcoind dependencies.&lt;br /&gt;
&lt;br /&gt;
==Verification==&lt;br /&gt;
This library incorporates the files that have been identified as &amp;quot;consensus critical&amp;quot; in bitcoind. It is straightforward to verify the implementation against bitcoind by overlaying the bitcoind sources and performing a difference option. With each tagged release of bitcoind this library is updated with the files identified in the [https://github.com/bitcoin/bitcoin/blob/master/src/Makefile.am libbitcoinconsensus] build.&lt;br /&gt;
&lt;br /&gt;
==Bindings==&lt;br /&gt;
The library exposes a C++ interface and includes [http://www.swig.org SWIG] generated bindings for other languages. Libbitcoin is a C++ toolkit, the underlying bitcoind sources are C++, and SWIG bindings are easily generated over C++. For these reasons the native interface is C++, in contrast to the libbitcoinconsensus interface which is C.&lt;br /&gt;
* [https://github.com/libbitcoin/libbitcoin-consensus/blob/master/include/bitcoin/consensus/export.hpp C++] (native)&lt;br /&gt;
* [https://github.com/libbitcoin/libbitcoin-consensus/tree/master/bindings/java Java]&lt;br /&gt;
* [https://github.com/libbitcoin/libbitcoin-consensus/tree/master/bindings/python Python]&lt;br /&gt;
&lt;br /&gt;
==Dependencies==&lt;br /&gt;
* [https://github.com/bitcoin/secp256k1 libsecp256k1]&lt;br /&gt;
* [http://www.boost.org boost test] (tests only)&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
* [[Libbitcoin]]&lt;br /&gt;
&lt;br /&gt;
==Source==&lt;br /&gt;
&lt;br /&gt;
[http://bitcoin.it/ http://bitcoin.it/]&lt;br /&gt;
[[Category:Open source]]&lt;br /&gt;
[[Category:Software]]&lt;/div&gt;</summary>
		<author><name>Admin</name></author>
		
	</entry>
</feed>