Difference between revisions of "Libbitcoin Common"

From Bitcoin Wiki
Jump to: navigation, search
(Example: Update example for v3)
m (General Purpose Features: sort list)
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
The common [https://github.com/libbitcoin/libbitcoin libbitcoin] library is a dependency of all others with the exception of [[Libbitcoin_Consensus|libbitcoin-consensus]]. It was the first library created and originally contained the core functionality of all of the others.
+
The common [https://github.com/libbitcoin/libbitcoin-system libbitcoin-system] (formerly "libbitcoin") library is a dependency of all others with the exception of [[Libbitcoin_Consensus|libbitcoin-consensus]]. It was the first library created and originally contained the core functionality of all of the others.
  
 
==Example==
 
==Example==
Line 10: Line 10:
 
  int main()
 
  int main()
 
  {
 
  {
    const auto block = bc::chain::block::genesis_mainnet();
+
    const auto block = bc::chain::block::genesis_mainnet();
    const auto& tx = block.transactions().front();
+
    const auto& tx = block.transactions().front();
    const auto& input = tx.inputs().front();
+
    const auto& input = tx.inputs().front();
    const auto script = input.script().to_data(false);
+
    const auto script = input.script().to_data(false);
    std::string message(script.begin() + sizeof(uint64_t), script.end());
+
    std::string message(script.begin() + sizeof(uint64_t), script.end());
 
     std::cout << message << std::endl;
 
     std::cout << message << std::endl;
 
     return 0;
 
     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 36: Line 36:
  
 
==General Purpose Features==
 
==General Purpose Features==
 +
* [https://github.com/libbitcoin/libbitcoin-system/wiki Documentation]
 
* Logging utilities
 
* Logging utilities
 
* [http://en.wikipedia.org/wiki/Radix_tree Patricia Trie] template with binary alphabet
 
* [http://en.wikipedia.org/wiki/Radix_tree Patricia Trie] template with binary alphabet

Latest revision as of 01:38, 9 March 2021

The common libbitcoin-system (formerly "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