Difference between revisions of "Libbitcoin Common"

From Bitcoin Wiki
Jump to: navigation, search
m (Bitcoin Related Features)
m (Example)
(16 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
==Example==
 
==Example==
    #include <iostream>
+
#include <cstdint>
    #include <string>
+
#include <iostream>
    #include <bitcoin/bitcoin.hpp>
+
#include <string>
   
+
#include <bitcoin/bitcoin.hpp>
    int main()
+
    {
+
// Extract Satoshi's words.
        const auto block = bc::genesis_block();
+
int main()
        const auto& tx = block.transactions[0];
+
{
        const auto& input = tx.inputs[0];
+
    const auto block = bc::chain::block::genesis_mainnet();
        const auto script = save_script(input.script);
+
    const auto& tx = block.transactions().front();
        std::string message(script.begin(), script.end());
+
    const auto& input = tx.inputs().front();
        std::cout << message << std::endl;
+
    const auto script = input.script().to_data(false);
        return 0;
+
    std::string message(script.begin() + sizeof(uint64_t), script.end());
    }
+
    std::cout << message << std::endl;
 +
    return 0;
 +
}
  
    ♦   ↔☺♦EThe Times 03/Jan/2009 Chancellor on brink of second bailout for banks
+
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks
  
 
==Bitcoin Related Features==
 
==Bitcoin Related Features==
Line 27: Line 29:
 
* All published [https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md mnemonic dictionaries]
 
* All published [https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md mnemonic dictionaries]
 
* Curve math, deterministic ECDSA, verification and encryption functions
 
* Curve math, deterministic ECDSA, verification and encryption functions
* Address functions (P2PKH and P2SH/[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki BIP16]),
+
* Address functions (P2PKH and P2SH/[https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki BIP16])
 
* Stealth addresses functions<ref>[https://wiki.unsystem.net/en/index.php/DarkWallet/Stealth DarkWallet Stealth Design Document]</ref> for wallets and blockchain search
 
* Stealth addresses functions<ref>[https://wiki.unsystem.net/en/index.php/DarkWallet/Stealth DarkWallet Stealth Design Document]</ref> for wallets and blockchain search
 
* Wire and text serializable type library (P2P protocol)
 
* Wire and text serializable type library (P2P protocol)
 
* Bitcoin script engine (see [[Libbitcoin_Consensus|libbitcoin-consensus]] for more information)
 
* Bitcoin script engine (see [[Libbitcoin_Consensus|libbitcoin-consensus]] for more information)
* Asynchronous P2P networking stack built on [https://think-async.com ASIO]
+
* Asynchronous P2P networking stack built on [https://think-async.com ASIO] (moved to [[Libbitcoin_Network|libbitcoin-network]] in version 3)
  
 
==General Purpose Features==
 
==General Purpose Features==
 
* Logging utilities
 
* Logging utilities
* [http://en.wikipedia.org/wiki/Radix_tree Patricia Trie] template optimized for binary search
+
* [http://en.wikipedia.org/wiki/Radix_tree Patricia Trie] template with binary alphabet
 
* [http://utf8everywhere.org UTF8 Everywhere] tools and integration for Windows
 
* [http://utf8everywhere.org UTF8 Everywhere] tools and integration for Windows
* Command line, configuration file and help processing utilities
+
* Command line and configuration file utilities based on [http://www.boost.org/doc/libs/1_55_0/doc/html/program_options.html boost program options]
* Uses C++11 advancements and restricts use of pointers and exceptions
 
  
 
==Build and Quality Control==
 
==Build and Quality Control==
 
* Autotools builds for GCC/Clang
 
* Autotools builds for GCC/Clang
 
* All build artifacts generated by [[Libbitcoin_Build|libbitcoin-build]]
 
* All build artifacts generated by [[Libbitcoin_Build|libbitcoin-build]]
* Extensive unit text matrix (based on [http://www.boost.org/doc/libs/1_55_0/libs/test/doc/html/index.html Boost Test])
 
 
* Continuous integration builds via [https://travis-ci.org/libbitcoin/libbitcoin Travis-CI]
 
* Continuous integration builds via [https://travis-ci.org/libbitcoin/libbitcoin Travis-CI]
 +
* Automated test coverage reporting via [https://travis-ci.org/libbitcoin/libbitcoin Coverall]
 
* Visual Studio 2013 project and solution files
 
* Visual Studio 2013 project and solution files
 
* Support for 32/64 bit processors and [http://en.wikipedia.org/wiki/Endianness endianness] differences
 
* Support for 32/64 bit processors and [http://en.wikipedia.org/wiki/Endianness endianness] differences
 +
* Uses C++11 advancements and restricts use of pointers and exceptions
  
==Dependencies==
+
==Dependencies (Version2)==
 
* [http://www.boost.org boost]
 
* [http://www.boost.org boost]
 
* [https://github.com/bitcoin/secp256k1 libsecp256k1]
 
* [https://github.com/bitcoin/secp256k1 libsecp256k1]
 
* [http://site.icu-project.org ICU] (optional)
 
* [http://site.icu-project.org ICU] (optional)
 +
 +
==Dependencies (Version3)==
 +
* [http://www.boost.org boost]
 +
* [https://github.com/bitcoin/secp256k1 libsecp256k1]
 +
* [http://site.icu-project.org ICU] (optional)
 +
* [http://www.libpng.org/pub/png/libpng.html libpng] (optional)
 +
* [https://fukuchi.org/works/qrencode libqrencode] (optional)
  
 
==See Also==
 
==See Also==
 
* [[Libbitcoin]]
 
* [[Libbitcoin]]
* [https://github.com/aantonop/bitcoinbook/blob/develop/appdx-bx.asciidoc Libbitcoin ]
 
  
 
==References==
 
==References==
 +
 +
[[Category:Clients]]
 +
[[Category:Open Source]]
 +
[[Category:Software‏‎]]

Revision as of 08:35, 8 March 2017

The common libbitcoin library is a dependency of all others with the exception of libbitcoin-consensus. It was the first library created and originally contained the core functionality of all of the others.

Example

#include <cstdint>
#include <iostream>
#include <string>
#include <bitcoin/bitcoin.hpp>

// Extract Satoshi's words.
int main()
{
    const auto block = bc::chain::block::genesis_mainnet();
    const auto& tx = block.transactions().front();
    const auto& input = tx.inputs().front();
    const auto script = input.script().to_data(false);
    std::string message(script.begin() + sizeof(uint64_t), script.end());
    std::cout << message << std::endl;
    return 0;
}
The Times 03/Jan/2009 Chancellor on brink of second bailout for banks

Bitcoin Related Features

  • Key formats (raw, BIP32, WIF, compressed/uncompressed, minikey)
  • Encoding functions (base 2/10/16/58/64/85)
  • Hash functions (ripemd160, sha1, sha256, sha512, hmac_sha256, hmac_sha512, pkcs5_pbkdf2_hmac_sha512)
  • URL parsing (BIP21 and BIP72)
  • Mnemonic functions (BIP39)
  • All published mnemonic dictionaries
  • Curve math, deterministic ECDSA, verification and encryption functions
  • Address functions (P2PKH and P2SH/BIP16)
  • Stealth addresses functions[1] for wallets and blockchain search
  • Wire and text serializable type library (P2P protocol)
  • Bitcoin script engine (see libbitcoin-consensus for more information)
  • Asynchronous P2P networking stack built on ASIO (moved to libbitcoin-network in version 3)

General Purpose Features

Build and Quality Control

  • Autotools builds for GCC/Clang
  • All build artifacts generated by libbitcoin-build
  • Continuous integration builds via Travis-CI
  • Automated test coverage reporting via Coverall
  • Visual Studio 2013 project and solution files
  • Support for 32/64 bit processors and endianness differences
  • Uses C++11 advancements and restricts use of pointers and exceptions

Dependencies (Version2)

Dependencies (Version3)

See Also

References