Advertisement

Libbitcoin slides

Mar. 2, 2015
Advertisement

More Related Content

Advertisement

Libbitcoin slides

  1. libbitcoin
  2. Typical Bitcoin Company Application Centralized API Provider Gem, Chain, Blockchain.info, Coinbase, BlockCypher, ... Shopping, Escrow, Smart contracts, Tipping, etc...
  3. libbitcoin is a Blockchain API Application libbitcoin- server Open Source, Decentralized Shopping, Escrow, Smart contracts, Tipping, etc...
  4. libbitcoin is a Power-user CLI Tool libbitcoin- explorer (BX) libbitcoin- server Scripting, Research, Exploration, ... $ bx fetch-height 345896
  5. libbitcoin is a Blockchain Toolkit libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  6. Why does this matter? ● Right now, most of the network runs a single piece of software (the Satoshi node) ● The Bitcoin Foundation controls this software ● Monocultures are bad! ● libbitcoin is a complete third-party Bitcoin Blockchain implementation
  7. libbitcoin Users ● DarkWallet ● OpenBazaar ● AirBitz
  8. libbitcoin Tour libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  9. libbitcoin ● Modern C++11 codebase. ● Designed as a collection of simple, decoupled classes ● You can use as much or as little funtionality as you like
  10. libbitcoin ● Basic blockchain types – Blocks, Transactions, Scripts, Crypto primitives, ... ● Wallet types – Base58, Addresses, URLs, HD keys, Message signing, … ● P2P Protocol
  11. libbitcoin Tour libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  12. libbitcoin-blockchain ● High-performance blockchain database ● Custom-designed on-disk hash table ● Rich indexes for high-speed queries – Transactions – Addresses – Stealth
  13. libbitcoin Tour libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  14. libbitcoin-server ● Formerly known as “obelisk” ● Provides a low-level Blockchain API ● Uses ZeroMQ
  15. libbitcoin-server ● fetch_history ● fetch_transaction ● fetch_last_height ● fetch_block_header ● fetch_transaction_index ● fetch_stealth ● broadcast_transaction ● subscribe
  16. libbitcoin Tour libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  17. libbitcoin-client ● C++ wrapper around the libbitcoin-server RPC interface ● Server API calls are as easy as calling a C++ function
  18. darkwallet/python-obelisk ● For those who want to use libbitcoin-server from python
  19. darkwallet/gateway ● Bridges libbitcoin-server to Websockets ● For those who want to use libbitcoin-server from Javascript
  20. libbitcoin Tour libbitcoin libbitcoin-blockchain libbitcoin-client libbitcoin-node libbitcoin-server libbitcoin-explorer Server Stack Client Stack
  21. libbitcoin-explorer ● Short name is “bx” ● Replaces an earlier project called “sx” ● Command-line interface to lots of Bitcoin goodies
  22. libbitcoin-explorer ● Server Commands – fetch-balance, fetch-header, fetch-height, fetch-history, fetch-public-key, fetch- stealth, fetch-tx, fetch-tx-index, fetch-utxo ● Wallet – input-set, input-sign, input-validate, message-sign, message-validate, send-tx, send-tx-node, send-tx-p2p, tx-decode, tx- encode, tx-sign
  23. libbitcoin-explorer ● HD Keys – hd-new, hd-private, hd-public, hd-to-address, hd- to-ec, hd-to-public, hd-to-wif ● EC Math – ec-add, ec-add-secrets, ec-lock, ec-multiply, ec- multiply-secrets, ec-new, ec-to-address, ec-to- public, ec-to-wif, ec-unlock ● Hashes – bitcoin160, bitcoin256, sha160, sha256, sha512, ripemd160
  24. libbitcoin-explorer ● Format conversions – address-decode, address-encode – base16-decode, base16-encode – base58-decode, base58-encode – base64-decode, base64-encode – btc-to-satoshi, satoshi-to-btc – wif-to-ec, wif-to-public ● And lots more…
  25. Installing bx ● Available as a single-file pre-compiled binary: – https://github.com/libbitcoin/libbitcoin- explorer/wiki/Download-BX – Linux, OS X, and Windows! ● Or you can compile it yourself: – https://github.com/libbitcoin/libbitcoin-explorer – Use the install.sh script for an hands-off compile, including dependencies – Or follow the manual build instructions
  26. Installing libbitcoin-server ● Stable binaries are not yet available – Hopefully soon! ● Source code is here: – https://github.com/libbitcoin/libbitcoin-server ● To run: $ initchain $ bitcoin_server
  27. libbitcoin-server Servers ● https://wiki.unsystem.net/en/index.php/Obelisk/Servers ● The BX default is tcp://obelisk.airbitz.co:9091 ● Feel free to use the AirBitz servers! – If you install your own servers, please let us use them too
  28. Installing libbitcoin ● Source code is here: – https://github.com/libbitcoin/libbitcoin
  29. libbitcoin Example #include <bitcoin/bitcoin.hpp> #include <iostream> #include <string.h> int main() { char line[256]; std::cout << "Please enter a secret phrase: "; std::cin.getline(line, 256); bc::data_chunk seed(line, line + strlen(line)); bc::hash_digest hash = bc::sha256_hash(seed); std::cout << "Hash: " << bc::encode_base16(hash) << std::endl; std::cout << "Private key: " << bc::secret_to_wif(hash) << std::endl; bc::payment_address address; bc::set_public_key_hash(address, bc::bitcoin_short_hash(bc::secret_to_public_key(hash))); std::cout << "Address: " << address.encoded() << std::endl; return 0; }
  30. libbitcoin Example - Header #include <bitcoin/bitcoin.hpp>
  31. libbitcoin Example – Grab some text char line[256]; std::cout << "Please enter a secret phrase: "; std::cin.getline(line, 256); bc::data_chunk seed(line, line + strlen(line));
  32. libbitcoin Example – Hashing bc::hash_digest hash = bc::sha256_hash(seed); std::cout << "Hash: " << bc::encode_base16(hash) << std::endl; std::cout << "Private key: " << bc::secret_to_wif(hash) << std::endl;
  33. libbitcoin Example – Addresses bc::payment_address address; bc::set_public_key_hash(address, bc::bitcoin_short_hash( bc::secret_to_public_key(hash))); std::cout << "Address: " << address.encoded() << std::endl;
  34. libbitcoin Example – Makefile CXXFLAGS = $(shell pkg-config --cflags libbitcoin) LIBS = $(shell pkg-config --libs libbitcoin) test: test.o $(CXX) -o test test.o $(LIBS) test.o: test.cpp $(CXX) -c -o test.o test.cpp $(CXXFLAGS)
  35. Future Plans ● New libbitcoin-server protocol – We want a full query language – libbitcoin-protocol ● SPV client library – libitcoin-server is fast, so we don't want to lose that – The client uses block headers to verify server responses
  36. Slides ● Slides are here: – http://www.slideshare.net/swansontec/libbitcoin- slides
Advertisement