libbitcoin / libbitcoin-client Goto Github PK
View Code? Open in Web Editor NEWBitcoin Client Query Library
License: Other
Bitcoin Client Query Library
License: Other
Hi I'm having trouble getting started. Is there a way to enable network debug output?
$ examples/console/console
type "help" for instructions
> connect tcp://mainnet.libbitcoin.net:9093
connecting to tcp://mainnet.libbitcoin.net:9093
> height
[... pauses forever, not returning ... ]
I have tried to get the balance of a P2SH address by using blockchain_fetch_history3(), but the returned value is not what I expected. It will return the value of all of the transactions related to this address no matter these transactions are spent or not.
Similar problems happened when I was trying to get UXTO of P2SH address. It will return all of the transactions even though those transactions have been spent.
These APIs work fine when address is normal P2KH address.
Can somebody help me out? The following are the definitions of my functions.
void fetch_UXTO( chain::points_value& retPoints, const wallet::payment_address &payaddress,uint64_t satoshis )
{
auto on_error = []( const code ec ){
std::cerr << "[Fetch_UXTO] Error Code: " << ec.message() << std::endl;
};
auto on_reply = [&]( const chain::points_value& Points ){
if( Points.points.size() != 0 ){
std::cout << "\nTotal value: " << satoshi_to_btc(Points.value()) << " BTC." << std::endl;
}
retPoints = Points;
};
//Connecting to p2p network.
client::obelisk_client client(8,3);
if( connect( client ) ){
client.blockchain_fetch_unspent_outputs( on_error, on_reply, payaddress , satoshis,
wallet::select_outputs::algorithm::greedy );
client.wait();
}
}
void fetch_balance( uint64_t &balance, const wallet::payment_address &payaddress ){
auto on_done = [&](const client::history::list& rows){
uint64_t unspent_balance = 0;
for(const client::history row: rows){
// spend unconfirmed (or no spend attempted)
if ( row.spend.hash() == null_hash ){
unspent_balance += row.value;
}
}
//encode_base10(unspent_balance, 8);
balance = unspent_balance;
};
auto on_error = [](const code ec){
std::cerr << "[Fetch_balance] Error Code: " << ec.message() << std::endl;
};
//Connecting to p2p network.
client::obelisk_client client(8,3);
if( connect( client ) ){
client.blockchain_fetch_history3( on_error, on_done, payaddress );
client.wait();
}
}
Creating a spending transaction for multisig p2sh address, with duplicate spending signatures, it validates as valid transaction (and added to pool).
Example:
For public/private keys:
[A0], [A1], [A2]
Transaction Redeem Script:
2 [A0] [A1] [A2] 3 CHECKMULTISIG
ScriptSig:
zero [Sig:A0] [Sig:A0] [redeemScript]
validates as valid spending script (counts as 2 valid signatures)
$ make
CXX src/src_libbitcoin_client_la-obelisk_client.lo
src/obelisk_client.cpp: In member function ‘void libbitcoin::client::obelisk_client::wait()’:
src/obelisk_client.cpp:105:28: error: no match for ‘operator==’ (operand types are ‘libbitcoin::protocol::zmq::identifiers’ and ‘libbitcoin::protocol::zmq::identifier {aka long int}’)
poller.wait(delay) == socket_.id())
^
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:28:0,
from /usr/local/include/bitcoin/bitcoin.hpp:19,
from /usr/local/include/bitcoin/protocol.hpp:17,
from ./include/bitcoin/client/obelisk_client.hpp:24,
from src/obelisk_client.cpp:20:
/usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:83:13: note: candidate: bool libbitcoin::operator==(const libbitcoin::hash_number&, uint64_t)
BC_API bool operator==(
^
/usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:83:13: note: no known conversion for argument 1 from ‘libbitcoin::protocol::zmq::identifiers’ to ‘const libbitcoin::hash_number&’
src/obelisk_client.cpp: In member function ‘void libbitcoin::client::obelisk_client::monitor(uint32_t)’:
src/obelisk_client.cpp:125:28: error: no match for ‘operator==’ (operand types are ‘libbitcoin::protocol::zmq::identifiers’ and ‘libbitcoin::protocol::zmq::identifier {aka long int}’)
poller.wait(delay) == socket_.id())
^
In file included from /usr/local/include/bitcoin/bitcoin/constants.hpp:28:0,
from /usr/local/include/bitcoin/bitcoin.hpp:19,
from /usr/local/include/bitcoin/protocol.hpp:17,
from ./include/bitcoin/client/obelisk_client.hpp:24,
from src/obelisk_client.cpp:20:
/usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:83:13: note: candidate: bool libbitcoin::operator==(const libbitcoin::hash_number&, uint64_t)
BC_API bool operator==(
^
/usr/local/include/bitcoin/bitcoin/math/hash_number.hpp:83:13: note: no known conversion for argument 1 from ‘libbitcoin::protocol::zmq::identifiers’ to ‘const libbitcoin::hash_number&’
Makefile:943: recipe for target 'src/src_libbitcoin_client_la-obelisk_client.lo' failed
make: *** [src/src_libbitcoin_client_la-obelisk_client.lo] Error 1
GCC:
$ g++ --version
g++ (Debian 5.3.1-20) 5.3.1 20160519
It seems to be a problem finding czmqpp
, even though /opt/local/lib/pkgconfig/libczmq++.pc
exists and its directory is in PKG_CONFIG_PATH
.
See https://gist.github.com/e40ebb40375f98f6cb164bf2bbbf67be for the log.
libbitcoin4-client.build.log.txt
make fails fairly early in the process.
I am currently attempting with install.sh with --build-boost to see if that differs.
-=-
CentOS 7 x86_64 with boost 1.58.0 and with many other libbitcoin project builds working
EDIT - install.sh works even with modifying to use boost 1.58.0 so the issue likely is on my end.
config.status: executing depfiles commands
config.status: executing libtool commands
CXX src/obelisk/src_libbitcoin_client_la-obelisk_codec.lo
CXX src/obelisk/src_libbitcoin_client_la-obelisk_router.lo
CXX src/src_libbitcoin_client_la-socket_stream.lo
CXXLD src/libbitcoin-client.la
CXX examples/examples_libbitcoin_client-cli.o
CXX examples/examples_libbitcoin_client-connection.o
CXX examples/examples_libbitcoin_client-read_line.o
CXX examples/examples_libbitcoin_client-main.o
CXXLD examples/libbitcoin_client
/bin/ld: examples/examples_libbitcoin_client-cli.o: undefined reference to symbol '_ZNSs4_Rep10_M_destroyERKSaIcE@@GLIBCXX_3.4'
/usr/lib/libstdc++.so.6: error adding symbols: DSO missing from command line
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:864: recipe for target 'examples/libbitcoin_client' failed
make: *** [examples/libbitcoin_client] Error
Compiles successfully with clang without examples:
./autogen.sh
CC=clang CXX=clang ./configure \
--prefix=/usr \
--sbindir=/usr/bin \
--libexecdir=/usr/lib/libbitcoin-client \
--sysconfdir=/etc \
--sharedstatedir=/usr/share/libbitcoin-client \
--localstatedir=/var/lib/libbitcoin-client \
--with-gnu-ld \
--without-tests \
--without-examples
CC=clang CXX=clang make
This project could use a full README (like libbitcoin, libbitcoin-server, and libbitcoin-explorer). Should be fairly easy to create based on the README for libbitcoin-server README file.
Incidentally, is the INSTALL file some fixed text that autotools recommends? It looks to have nothing specific to the project.
root@t410:/home/n/Desktop/libbitcoin-client# ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
...
...
checking whether C++ compiler accepts -Wno-missing-braces... yes
checking whether C++ compiler accepts -Wno-deprecated-declarations... yes
checking whether the linker accepts -fstack-protector... yes
checking whether the linker accepts -fstack-protector-all... yes
checking whether C++ compiler accepts -fvisibility-hidden... no
checking whether C++ compiler accepts -fvisibility-inlines-hidden... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libbitcoin-client.pc
config.status: executing depfiles commands
config.status: executing libtool commands
root@t410:/home/n/Desktop/libbitcoin-client# make check
CXX src/src_libbitcoin_client_la-socket_stream.lo
CXX src/obelisk/src_libbitcoin_client_la-obelisk_codec.lo
CXX src/obelisk/src_libbitcoin_client_la-obelisk_router.lo
CXXLD src/libbitcoin-client.la
CXX examples/console/examples_console_console-cli.o
CXX examples/console/examples_console_console-connection.o
CXX examples/console/examples_console_console-main.o
CXX examples/console/examples_console_console-read_line.o
CXXLD examples/console/console
CXX examples/get_height/examples_get_height_get_height-get_height.o
CXXLD examples/get_height/get_height
make test/libbitcoin_client_test
make[1]: Entering directory/home/n/Desktop/libbitcoin-client' CXX test/test_libbitcoin_client_test-main.o CXX test/test_libbitcoin_client_test-obelisk_codec.o CXXLD test/libbitcoin_client_test make[1]: Leaving directory
/home/n/Desktop/libbitcoin-client'
make check-TESTS
make[1]: Entering directory/home/n/Desktop/libbitcoin-client' make[2]: Entering directory
/home/n/Desktop/libbitcoin-client'
FAIL: libbitcoin_client_test_runner.sh
make[3]: Entering directory
/home/n/Desktop/libbitcoin-client' make[3]: Nothing to be done for
all'.make[3]: Leaving directory `/home/n/Desktop/libbitcoin-client'
Testsuite summary for libbitcoin-client 2.2.0
TOTAL: 1
PASS: 0
SKIP: 0
XFAIL: 0
FAIL: 1
XPASS: 0ERROR: 0
See ./test-suite.log
Please report to [email protected]
make[2]: *** [test-suite.log] Error 1
make[2]: Leaving directory/home/n/Desktop/libbitcoin-client' make[1]: *** [check-TESTS] Error 2 make[1]: Leaving directory
/home/n/Desktop/libbitcoin-client'
make: *** [check-am] Error 2
in the logs: test-suite.log
libbitcoin-client 2.2.0: ./test-suite.log
TOTAL: 1
PASS: 0
SKIP: 0
XFAIL: 0
FAIL: 1
XPASS: 0ERROR: 0
.. contents:: :depth: 2
FAIL: libbitcoin_client_test_runner.sh
/home/n/Desktop/libbitcoin-client/test/.libs/lt-libbitcoin_client_test: error while l$
Hello! Apologies if this isn't the right place to ask this, but I'm looking for libbitcoin source that predates the 2.0 release. Specifically, I'm interested the full git history for the library covering late 2013 (or libraries - I'm not sure if it was a single monolith at this time or the existing collections of libraries). Is this available anywhere? I'm trying to understand a very old project that depended on libbitcoin, and having that source would greatly help.
I have tried to get the balance of a P2SH address by using blockchain_fetch_history3(), but the returned value is not what I expected. It will return the value of all of the transactions related to this address no matter these transactions are spent or not.
Similar problems happened when I was trying to get UXTO of P2SH address. It will return all of the transactions even though those transactions have been spent.
These APIs work fine when address is normal P2KH address.
Can somebody help me out? The following are the definitions of my functions.
void fetch_UXTO( chain::points_value& retPoints,const wallet::payment_address &payaddress, uint64_t satoshis )
{
auto on_error = []( const code ec ){
std::cerr << "[Fetch_UXTO] Error Code: " << ec.message() << std::endl;
};
auto on_reply = [&]( const chain::points_value& Points ){
if( Points.points.size() != 0 ){
std::cout << "\nTotal value: " << satoshi_to_btc(Points.value()) << " BTC." << std::endl;
}
retPoints = Points;
};
//Connecting to p2p network.
client::obelisk_client client(8,3);
if( connect( client ) ){
client.blockchain_fetch_unspent_outputs( on_error, on_reply, payaddress , satoshis,
wallet::select_outputs::algorithm::greedy );
client.wait();
}
}
void fetch_balance( uint64_t &balance, const wallet::payment_address &payaddress ){
auto on_done = [&](const client::history::list& rows){
uint64_t unspent_balance = 0;
for(const client::history row: rows){
// spend unconfirmed (or no spend attempted)
if ( row.spend.hash() == null_hash ){
unspent_balance += row.value;
}
}
//encode_base10(unspent_balance, 8);
balance = unspent_balance;
};
auto on_error = [](const code ec){
std::cerr << "[Fetch_balance] Error Code: " << ec.message() << std::endl;
};
//Connecting to p2p network.
client::obelisk_client client(8,3);
if( connect( client ) ){
client.blockchain_fetch_history3( on_error, on_done, payaddress );
client.wait();
}
}
I try to install libbitcoin-client but get an error when I do ./configure:
configure: error: Package requirements (libczmq++ >= 1.1.0) were not met:
No package 'libczmq++' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables czmq___CFLAGS
and czmq___LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
I already downloaded and installed libzmq to try and fix this problem but it did not help.
What should I do? I want to use this library!
Server has a much cleaner design, fully utilizing the updated libbitcoin-protocol zmq implementation.
Otherwise the caller must always follow-up with requests for all transactions, which is very wasteful.
Interim hack, embeds address version:
uint8_t address_version = payment_address::pubkey_version;
Target solution is to send whole tx on response and derive the address from the tx. This is necessary from a privacy standpoint in any case. Otherwise the caller must always make a follow-on call for each fetch-stealth
request. This strongly encourages non-private implementations.
This can happen when the server uses a history cut-off and a client query gets an output that has a missing input. The value of the spend cannot be calculated and should therefore default to max. This is currently set to max uint32 vs max uint64. This is a minor issue since the missing output is detectable by its null hash. But setting the value above max money was the intended default.
This should be fixed soon in cppzmq. Then just need to update our copy of zmq.hpp.
After installing libbitcoin core witch works well, i tried today to iinstall libbitcoin-client. I followed all steps described here : http://aaronjaramillo.org/libbitcoin-v3-installing-libbitcoin-client
Hereb is the code I am trying to compile:
`#include <bitcoin/bitcoin.hpp>
#include <bitcoin/client.hpp>
#include <string.h>
#include
#include
using bc;
int main() {
wallet::payment_address addy("1QLQJVCQqzgS9HZ7saovBAspaBMUwT6qPK");
getBalance(addy);
return 0;
}
uint64_t balancer(const chain::history::list& rows) {
uint64_t unspent_balance = 0;
for (const chain::history row : rows) {
// spend unconfirmed (or no spend attempted)
if (row.spend.hash() == null_hash)
unspent_balance += row.value;
}
return unspent_balance;
}
void getBalance(wallet::payment_address address) {
client::connection_type connection = {};
connection.retries = 3;
connection.timeout_seconds = 8;
connection.server = config::endpoint("tcp://mainnet.libbitcoin.net:9091");
client::obelisk_client client(connection);
static const auto on_done = [](const chain::history::list & rows) {
uint64_t balance = balancer(rows);
std::cout << encode_base10(balance, 8) << std::endl;
};
static const auto on_error2 = [](const code ec) {
std::cout << "Error Code: " << ec.message() << std::endl;
};
if (!client.connect(connection)) {
std::cout << "Fail" << std::endl;
} else {
std::cout << "Connection Succeeded" << std::endl;
}
client.blockchain_fetch_history3(on_error2, on_done, address);
client.wait();
}
`
this code does not compile and i get this error:
Package libbitcoin-client was not found in the pkg-config search path.
Perhaps you should add the directory containing libbitcoin-client.pc' to the PKG_CONFIG_PATH environment variable
fatal error: bitcoin/client.hpp: no file of this type
#include <bitcoin/client.hpp>
`
can someone help ?
thank you
https://travis-ci.org/libbitcoin/libbitcoin-client/jobs/475565471
============================================================================
Testsuite summary for libbitcoin-client 4.0.0
============================================================================
# TOTAL: 1
# PASS: 0
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log
Please report to [email protected]
============================================================================
make[2]: *** [test-suite.log] Error 1
make[2]: Leaving directory `/home/travis/build/libbitcoin/libbitcoin-client'
make[1]: *** [check-TESTS] Error 2
make[1]: Leaving directory `/home/travis/build/libbitcoin/libbitcoin-client'
make: *** [check-am] Error 2
Running 10 test cases...
Platform: linux
Compiler: Clang version 5.0.0 (tags/RELEASE_500/final)
STL : GNU libstdc++ version 20150426
Boost : 1.62.0
test/obelisk_client.cpp(78): fatal error: in "client_tests/client__fetch_transaction__test": critical check received_hash == expected_hash has failed [ != 660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d]
test/obelisk_client.cpp(97): fatal error: in "client_tests/client__fetch_transaction2__test": critical check received_hash == expected_hash has failed [ != 660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d]
test/obelisk_client.cpp(134): fatal error: in "client_tests/client__fetch_last_height__test": critical check received_height > 0 == true has failed [false != true]
test/obelisk_client.cpp(168): fatal error: in "client_tests/client__fetch_last_height__multi_handler_test": critical check received_height1 > 0 == true has failed [false != true]
test/obelisk_client.cpp(188): fatal error: in "client_tests/client__fetch_block_header__height_test": critical check received_hash == expected_hash has failed [ != 9a22db7fd25e719abf9e8ccf869fbbc1e22fa71822a37efae054c17b00000000]
test/obelisk_client.cpp(213): fatal error: in "client_tests/client__fetch_block_header__hash_test": critical check received_hash == expected_hash has failed [ != 9a22db7fd25e719abf9e8ccf869fbbc1e22fa71822a37efae054c17b00000000]
test/obelisk_client.cpp(239): fatal error: in "client_tests/client__fetch_transaction__index_test": critical check received_block == expected_block has failed [0 != 100]
test/obelisk_client.cpp(274): fatal error: in "client_tests/client__stealth_public__test": critical check received_hash == expected_hash has failed [ != 660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d]
test/obelisk_client.cpp(293): fatal error: in "client_tests/client__pool_fetch_transaction__test": critical check received_hash == expected_hash has failed [ != 660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d]
test/obelisk_client.cpp(312): fatal error: in "client_tests/client__pool_fetch_transaction2__test": critical check received_hash == expected_hash has failed [ != 660802c98f18fd34fd16d61c63cf447568370124ac5f3be626c2e1c3c9f0052d]
Hi,
First thanks for your useful tool.
I am developing an application which need all Bitcoin addresses with positive balance in near real-time
I appreciate if you help or point me to a document on how to do that suing libbitcoin, libbitcoin-server and libbitcoin-client?
I use lib bitcoin-client to getUtxo, but it show me below error.
[libc++abi.dylib: terminating with uncaught exception of type std::overflow_error: addition]
compile from GitHub from these command.
./configure --prefix=/Volumes/SSD/libbitcoin-client
make
OS:
uname -a
Darwin kinyas-MacBook-Pro.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
compiler:
clang --version
Apple LLVM version 9.1.0 (clang-902.0.39.1)
Target: x86_64-apple-darwin17.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
points_value getUTXOs(payment_address Addy, uint64_t amount)
{
client::connection_type connection = {};
connection.retries = 10;
connection.timeout_seconds = 30;
//connection.server = config::endpoint("tcp://testnet1.libbitcoin.net:19091");
connection.server = config::endpoint("tcp://testnet3.libbitcoin.net:19091");
client::obelisk_client client(connection);
points_value val1;
static const auto on_done = [&val1](const points_value& vals) {
std::cout << "Success: " << vals.value() << std::endl;
val1 = vals;
};
static const auto on_error = [](const code& ec) {
std::cout << "Error Code: " << ec.message() << std::endl;
};
if(!client.connect(connection))
{
std::cout << "Connection Fail!" << std::endl;
} else {
std::cout << "Connection Succeeded!" << std::endl;
}
//abort here
client.blockchain_fetch_unspent_outputs(on_error, on_done, Addy, amount, select_outputs::algorithm::greedy);
client.wait();
return val1;
}
#error
Connection Succeeded
libc++abi.dylib: terminating with uncaught exception of type std::overflow_error: addition overflow
Abort trap: 6
1>Running 15 test cases...
1>Platform: Win32
1>Compiler: Microsoft Visual C++ version 14.1
1>STL : Dinkumware standard library version 650
1>Boost : 1.64.0
1>../../../../test/obelisk_client.cpp(168): fatal error : in "network/client__fetch_transaction__test": critical check ec == error::success has failed [bitcoin:3 != 0]
1>../../../../test/obelisk_client.cpp(188): fatal error : in "network/client__fetch_transaction2__test": critical check ec == error::success has failed [bitcoin:3 != 0]
1>../../../../test/obelisk_client.cpp(341): fatal error : in "network/client__fetch_transaction__index_test": critical check received_block == expected_block has failed [9999 != 800001]
Is it intended behaviour for the compiler to fail if including multiple libbitcoin header files? When I run the code below, the compilation fails from the includes, which seems odd. All the examples included in the individual components of libbitcoin, e.g. libbitcoin-client and libbitcoin-server, run fine since they only include a single "#include <bitcoin/something>" however when including more than one it fails.
Can someone let me know what I have done incorrectly?
#include <bitcoin/bitcoin.hpp>
#include <bitcoin/client.hpp>
using namespace bc;
int main(){
return 1;
}
Compiled via: g++ -std=c++11 -o connect simpleConnect.cpp $(pkg-config --cflags libbitcoin --libs libbitcoin libbitcoin-client)
Compilation errors:
In file included from /usr/local/include/bitcoin/system/formats/base_16.hpp:24:0,
from /usr/local/include/bitcoin/system/config/checkpoint.hpp:27,
from /usr/local/include/bitcoin/system/chain/chain_state.hpp:26,
from /usr/local/include/bitcoin/system/chain/block.hpp:29,
from /usr/local/include/bitcoin/system/config/block.hpp:25,
from /usr/local/include/bitcoin/system/settings.hpp:22,
from /usr/local/include/bitcoin/system.hpp:23,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/math/hash.hpp:172:8: error: redefinition of ‘struct std::hash<std::array<unsigned char, Size> >’
struct hash<bc::system::byte_array<Size>>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:0,
from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27,
from /usr/local/include/bitcoin/bitcoin/constants.hpp:25,
from /usr/local/include/bitcoin/bitcoin.hpp:19,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:167:8: note: previous definition of ‘struct std::hash<std::array<unsigned char, Size> >’
struct hash<bc::byte_array<Size>>
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/system/formats/base_16.hpp:24:0,
from /usr/local/include/bitcoin/system/config/checkpoint.hpp:27,
from /usr/local/include/bitcoin/system/chain/chain_state.hpp:26,
from /usr/local/include/bitcoin/system/chain/block.hpp:29,
from /usr/local/include/bitcoin/system/config/block.hpp:25,
from /usr/local/include/bitcoin/system/settings.hpp:22,
from /usr/local/include/bitcoin/system.hpp:23,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/math/hash.hpp:184:8: error: redefinition of ‘struct boost::hash<std::array<unsigned char, Size> >’
struct hash<bc::system::byte_array<Size>>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/bitcoin/formats/base_16.hpp:24:0,
from /usr/local/include/bitcoin/bitcoin/config/checkpoint.hpp:27,
from /usr/local/include/bitcoin/bitcoin/constants.hpp:25,
from /usr/local/include/bitcoin/bitcoin.hpp:19,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/math/hash.hpp:179:8: note: previous definition of ‘struct boost::hash<std::array<unsigned char, Size> >’
struct hash<bc::byte_array<Size>>
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/system/utility/collection.hpp:120:0,
from /usr/local/include/bitcoin/system.hpp:151,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/impl/utility/collection.ipp:123:15: error: redefinition of ‘template<class Type> std::ostream& std::operator<<(std::ostream&, const std::vector<T>&)’
std::ostream& operator<<(std::ostream& output, const std::vector<Type>& list)
^~~~~~~~
In file included from /usr/local/include/bitcoin/bitcoin/utility/collection.hpp:118:0,
from /usr/local/include/bitcoin/bitcoin.hpp:141,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/impl/utility/collection.ipp:115:15: note: ‘template<class Type> std::ostream& std::operator<<(std::ostream&, const std::vector<T>&)’ previously declared here
std::ostream& operator<<(std::ostream& output, const std::vector<Type>& list)
^~~~~~~~
In file included from /usr/local/include/bitcoin/system.hpp:189:0,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/utility/track.hpp:33:7: error: redefinition of ‘class track<Shared>’
class track
^~~~~
In file included from /usr/local/include/bitcoin/bitcoin.hpp:178:0,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/utility/track.hpp:33:7: note: previous definition of ‘class track<Shared>’
class track
^~~~~
In file included from /usr/local/include/bitcoin/system/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/system.hpp:189,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/impl/utility/track.ipp:36:45: error: redefinition of ‘std::atomic<long unsigned int> track<Shared>::instances’
std::atomic<size_t> track<Shared>::instances(0);
^
In file included from /usr/local/include/bitcoin/bitcoin/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/bitcoin.hpp:178,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/impl/utility/track.ipp:36:21: note: ‘std::atomic<long unsigned int> track<Shared>::instances’ previously declared here
std::atomic<size_t> track<Shared>::instances(0);
^~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/system/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/system.hpp:189,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/impl/utility/track.ipp:39:1: error: redefinition of ‘track<Shared>::track(const string&)’
track<Shared>::track(const std::string& DEBUG_ONLY(class_name))
^~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/bitcoin/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/bitcoin.hpp:178,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/impl/utility/track.ipp:39:1: note: ‘track<Shared>::track(const string&)’ previously declared here
track<Shared>::track(const std::string& DEBUG_ONLY(class_name))
^~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/system/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/system.hpp:189,
from /usr/local/include/bitcoin/client.hpp:17,
from simpleConnect.cpp:2:
/usr/local/include/bitcoin/system/impl/utility/track.ipp:50:1: error: redefinition of ‘track<Shared>::~track()’
track<Shared>::~track()
^~~~~~~~~~~~~
In file included from /usr/local/include/bitcoin/bitcoin/utility/track.hpp:46:0,
from /usr/local/include/bitcoin/bitcoin.hpp:178,
from simpleConnect.cpp:1:
/usr/local/include/bitcoin/bitcoin/impl/utility/track.ipp:50:1: note: ‘virtual track<Shared>::~track()’ previously declared here
track<Shared>::~track()
#Installation
$ brew install libbitcoin
$ brew install libbitcoin-client
$ brew install zeromq
$ brew install boost
#Run command
/usr/bin/clang++ -std=c++11 btc.cpp -L/usr/local/opt/libbitcoin/lib -lbitcoin -L/usr/local/opt/libbitcoin-client/lib -lbitcoin-client -L/usr/local/opt/boost/lib -lboost_system -L/usr/local/opt/zmq/lib/ -lzmq -o btc -v
#File Contents
#include <cstddef>
#include <bitcoin/bitcoin.hpp>
#include <bitcoin/client.hpp>
#include <string.h>
#include <iostream>
using namespace bc;
uint64_t balancer(const chain::history::list &rows)
{
uint64_t unspent_balance = 0;
for (const auto &row : rows)
{
// spend unconfirmed (or no spend attempted)
if (row.spend.hash() == null_hash)
unspent_balance += row.value;
}
return unspent_balance;
}
void getBalance(wallet::payment_address address)
{
client::connection_type connection = {};
connection.retries = 3;
connection.timeout_seconds = 8;
connection.server = config::endpoint("tcp://testnet3.libbitcoin.net:19091");
client::obelisk_client client(connection);
static const auto on_done = [](const chain::history::list &rows) {
uint64_t balance = balancer(rows);
std::cout << encode_base10(balance, 8) << std::endl;
};
static const auto on_error2 = [](const code ec) {
std::cout << "Error Code: " << ec.message() << std::endl;
};
if (!client.connect(connection))
{
std::cout << "Fail" << std::endl;
}
else
{
std::cout << "Connection Succeeded" << std::endl;
}
client.blockchain_fetch_history3(on_error2, on_done, address);
client.wait();
}
int main()
{
wallet::payment_address addy("mnrnjVFimDFrNkszzMtecr4yrMKmEuMRbv");
getBalance(addy);
}
#Error Generated
Apple clang version 12.0.5 (clang-1205.0.22.9)
Target: x86_64-apple-darwin20.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name btc.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -munwind-tables -target-sdk-version=11.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -debugger-tuning=lldb -target-linker-version 650.9 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/regarm/Dev/go/github.com/regarm/cheapskate -ferror-limit 19 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -mllvm -disable-aligned-alloc-awareness=1 -o /var/folders/6w/g4kb03991xxdr07p37p4_w4r0000gn/T/btc-7a58b8.o -x c++ btc.cpp
clang -cc1 version 12.0.5 (clang-1205.0.22.9) default target x86_64-apple-darwin20.3.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.3 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o btc -L/usr/local/opt/libbitcoin/lib -L/usr/local/opt/libbitcoin-client/lib -L/usr/local/opt/boost/lib -L/usr/local/opt/zmq/lib/ -L/usr/local/lib /var/folders/6w/g4kb03991xxdr07p37p4_w4r0000gn/T/btc-7a58b8.o -lbitcoin -lbitcoin-client -lboost_system -lzmq -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"libbitcoin::protocol::zmq::socket::~socket()", referenced from:
libbitcoin::client::obelisk_client::~obelisk_client() in btc-7a58b8.o
"libbitcoin::protocol::zmq::context::~context()", referenced from:
libbitcoin::client::obelisk_client::~obelisk_client() in btc-7a58b8.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help would be appreciated.
return
value is presumed to be void by all callers.on_error
handler should be invoked in the case of send failure.// Create a message with identity and send it via the message stream.
// This is invoked by derived class message senders, such as the proxy.
bool dealer::send_request(const std::string& command,
const data_chunk& payload, error_handler on_error, decoder on_reply)
{
const auto now = asio::steady_clock::now();
const auto id = ++last_request_index_;
auto& request = pending_[id];
request.message = obelisk_message{ command, id, payload };
request.on_error = on_error;
request.on_reply = on_reply;
request.resends = 0;
request.deadline = now + asio::milliseconds(timeout_milliseconds_);
return send(request.message);
}
The failure will be picked up in refresh()
as a timeout but if there are no retries should be caught immediately.
examples/console/client.cpp:85:21: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
auto handler = [this](const code& ec, size_t height)
^
examples/console/client.cpp:110:21: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
auto handler = [this](const code& ec, const history::list& history)
^
examples/console/client.cpp:136:21: warning: lambda capture 'this' is not used [-Wunused-lambda-capture]
auto handler = [this](const code& ec, const header& header)
^
CXX examples/console/console-read_line.o
3 warnings generated.
CXX src/libbitcoin_client_la-obelisk_client.lo
CXX examples/get_height/get_height-main.o
src/obelisk_client.cpp:38:19: warning: unused variable 'domain' [-Wunused-const-variable]
static const auto domain = "query";
^
1 warning generated.
Hello,
I am trying to build libbitcoin client from master (#1839b1d4f2e67729dd11feef5350e428a78cbe46) and I get the following error.
Looking at the history of libbitcoin-system it looks like these headers were removed about a year ago. What am I missing?
In case it is relevant, I am running the install script like so sudo ./install.sh --with-icu --build-icu --build-boost --build-zmq
I have tried specifying a prefix directory so I can not run as sudo and (as expected) got the same result.
This pull request succeeded:
https://travis-ci.org/libbitcoin/libbitcoin-client/builds/405035442
The subsequent merge failed:
https://travis-ci.org/libbitcoin/libbitcoin-client/builds/405128232
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.