Giter Club home page Giter Club logo

libbitcoin-network's Introduction

Continuous Integration Build

Coverage Status

Libbitcoin

The Bitcoin Development Library

Documentation is available on the wiki.

License Overview

All files in this repository fall under the license specified in COPYING. The project is licensed as AGPL with a lesser clause. It may be used within a proprietary project, but the core library and any changes to it must be published online. Source code for this library must always remain free for everybody to access.

About Libbitcoin

The libbitcoin toolkit is a set of cross platform C++ libraries for building bitcoin applications. The toolkit consists of several libraries, most of which depend on the base libbitcoin-system library. Each library's repository can be cloned and built using common automake 1.14+ instructions. There are no packages yet in distribution however each library includes an installation script (described below) which is regularly verified in the automated build.

Installation

The master branch is a staging area for the next major release and should be used only by libbitcoin developers. The current release branch is version3. Detailed installation instructions are provided below.

Autotools (advanced users)

On Linux and macOS libbitcoin is built using Autotools as follows.

$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
$ sudo ldconfig

A minimal libbitcoin build requires boost and libsecp256k1. The libbitcoin/secp256k1 repository is forked from bitcoin-core/secp256k1 in order to control for changes and to incorporate the necessary Visual Studio build. The original repository can be used directly but recent changes to the public interface may cause build breaks. The --enable-module-recovery switch is required.

Debian/Ubuntu

Libbitcoin requires a C++11 compiler, currently minimum GCC 4.8.0 or Clang based on LLVM 3.5.

Install the build system (Automake minimum 1.14) and git:

$ sudo apt-get install build-essential autoconf automake libtool pkg-config git

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
$ chmod +x install.sh

Finally install libbitcoin with recommended build options:

$ ./install.sh --prefix=/home/me/myprefix --build-boost --disable-shared

Libbitcoin is now installed in /home/me/myprefix/.

MacOS

The macOS installation differs from Linux in the installation of the compiler and packaged dependencies. Libbitcoin supports both Homebrew and MacPorts package managers. Both require Apple's Xcode command line tools. Neither requires Xcode as the tools may be installed independently.

Libbitcoin compiles with Clang on macOS and requires C++11 support. Installation has been verified using Clang based on LLVM 3.5. This version or newer should be installed as part of the Xcode command line tools.

To see your Clang/LLVM version:

$ clang++ --version

You may encounter a prompt to install the Xcode command line developer tools, in which case accept the prompt.

Apple LLVM version 6.0 (clang-600.0.54) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.0.0
Thread model: posix

If required update your version of the command line tools as follows:

$ xcode-select --install

Using Homebrew

First install Homebrew.

Next install the build system (Automake minimum 1.14) and wget:

$ brew install autoconf automake libtool pkgconfig wget

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
$ chmod +x install.sh

Finally install libbitcoin with recommended build options:

$ ./install.sh --prefix=/home/me/myprefix --build-boost --disable-shared

Libbitcoin is now installed in /home/me/myprefix/.

Using MacPorts

First install MacPorts.

Next install the build system (Automake minimum 1.14) and wget:

$ sudo port install autoconf automake libtool pkgconfig wget

Next download the install script and enable execution:

$ wget https://raw.githubusercontent.com/libbitcoin/libbitcoin/version3/install.sh
$ chmod +x install.sh

Finally install libbitcoin with recommended build options:

$ ./install.sh --prefix=/home/me/myprefix --build-boost --disable-shared

Libbitcoin is now installed in /home/me/myprefix/.

Build Notes for Linux / macOS

The install script itself is commented so that the manual build steps for each dependency can be inferred by a developer.

You can run the install script from any directory on your system. By default this will build libbitcoin in a subdirectory named build-libbitcoin and install it to /usr/local/. The install script requires sudo only if you do not have access to the installation location, which you can change using the --prefix option on the installer command line.

The build script clones, builds and installs two unpackaged repositories, namely:

The script builds from the head of their version7 and version3 branches respectively. The master branch is a staging area for changes. The version branches are considered release quality.

Build Options

Any set of ./configure options can be passed via the build script, for example:

$ ./install.sh CFLAGS="-Og -g" --prefix=/home/me/myprefix

Compiling with ICU (International Components for Unicode)

Since the addition of BIP-39 and later BIP-38 and Electrum mnemnoic support, libbitcoin conditionally incorporates ICU. To use passphrase normalization for these features libbitcoin must be compiled with the --with-icu option. Currently libbitcoin-explorer is the only other library that accesses this feature, so if you do not intend to use passphrase normalization this dependency can be avoided.

$ ./install.sh --with-icu --build-icu --build-boost --disable-shared

Building ICU and/or Boost

The installer can download and install these dependencies. ICU is a large package that is not typically preinstalled at a sufficient level. Using these builds ensures compiler and configuration compatibility across all of the build components. It is recommended to use a prefix directory when building these components.

$ ./install.sh --prefix=/home/me/myprefix --with-icu --build-icu --build-boost --disable-shared

Windows

Visual Studio solutions are maintained for all libbitcoin libraries. NuGet packages exist for all dependencies. ICU is integrated into Windows and therefore not required as an additional dependency when using ICU features.

The libbitcoin execution environment supports Windows XP Service Pack 2 and newer.

Supported Compilers

Libbitcoin requires a C++11 compiler, which means Visual Studio 2013 (with a pre-release compiler update) or later. Download and install one of the following free tools as necessary:

NuGet Repository

Dependencies apart from the libbitcoin libraries are available as NuGet packages:

The packages can be viewed using the NuGet package manager from the libbitcoin solution. The package manager will prompt for download of any missing packages.

The libbitcoin solution files are configured with references to these packages. The location of the NuGet repository is controlled by the nuget.config file repositoryPath setting and the NuGetPackageRoot element of each [project].props file.

Build Libbitcoin Projects

After cloning the the repository the libbitcoin build can be performed from within Visual Studio or using the build_all.bat script provided in the builds\msvc\build\ subdirectory. The script automatically downloads all required NuGet packages.

Tip: The build_all.bat script builds all valid configurations for all compilers. The build time can be significantly reduced by disabling all but the desired configuration in build_base.bat and build_all.bat.

The libbitcoin dynamic (DLL) build configurations do not compile, as the exports have not yet been fully implemented. These are currently disabled in the build scripts but you will encounter numerous errors if you build then manually.

Optional: Building External Dependencies

The secp256k1 and libzmq package above are maintained using the same Visual Studio template as all libbitcoin libraries. If so desired these can be built locally, in the same manner as libbitcoin.

This change is properly accomplished by disabling the "NuGet Dependencies" in the Visual Studio properties user interface and then importing secp256k1.import.props, which references secp256k1.import.xml and libzmq.import.props, which references libzmq.import.xml.

See boost documentation for building boost libraries for Visual C++.

libbitcoin-network's People

Contributors

bardiharborow avatar benhc123 avatar bobalot avatar changlan avatar codrush avatar evoskuil avatar genjix avatar jachiang avatar jaromil avatar kdomanski avatar kevinejohn avatar lclc avatar mlmikael avatar narodnik avatar omidaladini avatar pablocastellano avatar phantomcircuit avatar pmienk avatar png85 avatar rafalkrupinski avatar swansontec avatar thecodefactory avatar toxeus avatar veox avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libbitcoin-network's Issues

test suite not generated.

Hi, I download the latest source code and successfully compiled using make && make install. However, there is no binary file generated in the test directory, is it expected or I missed something? Thanks.

Add configuration option to require relay.

When connecting to a peer in order to relay a transaction is is useful to know that the connection allows tx relay. Currently there is no way to configure the session such that its connections require the peer to allow relay. This would not guarantee that the peer would accept the tx but it improves the probability.

RNG is not thread safe.

Police Terror:

I'm using the current master branch to sync with testnet, but I'm
getting this error:

...
14:15:56.657549 WARNING [server] Failed to connect secure notification
worker: operation failed
14:15:56.756083 WARNING [server] Failed to connect secure notification
worker: operation failed
terminate called after throwing an instance of 'std::runtime_error'
what(): random_device::random_device(const std::string&)
14:15:57.415901 INFO [server] Stop signal detected (code: 6).
Aborted (core dumped)

Here's what debug.log is showing:

14:15:57.415478 DEBUG [network] Failure connecting outbound: operation
failed
14:15:57.415501 DEBUG [network] Failure connecting outbound: operation
failed
14:15:57.415570 DEBUG [node] Redundant block
[0000000057bd296621bc2f314e3594c412a0cd9e94f1083554c3184160612450] from
[177.189.250.198:18333]
14:15:57.415605 DEBUG [network] Connecting to [121.40.72.188:18333]
14:15:57.415703 DEBUG [network] Valid block payload from
[177.189.250.198:18333](207 bytes)
14:15:57.415757 DEBUG [network] Connecting to [212.93.226.185:18333]
14:15:57.415816 DEBUG [network] Connecting to [2.55.186.124:18333]
14:15:57.415901 INFO [server] Stop signal detected (code: 6).
14:15:57.415937 DEBUG [node] Redundant block
[000000008a675b534ea86b312f29c9fdcce7b7b07ca1879c144b8e20215ac201] from
[177.189.250.198:18333]
14:15:57.416008 DEBUG [network] Valid block payload from
[177.189.250.198:18333](207 bytes)
g

I've attached the .cfg file I'm using.

Looking at libbitcoin/src/utility/random.cpp, I see that
nonzero_pseudo_random() is throwing. Why isn't that an assert instead?

https://github.com/libbitcoin/libbitcoin/blob/master/src/utility/random.cpp#L46

Here is the backtrace:

9 libbitcoin::pseudo_random () at src/utility/random.cpp:39

10 0x00007ffff5a3d48d in libbitcoin::network::hosts::fetch

(this=this@entry=0x657310,
out=...) at src/collections/hosts.cpp:76

11 0x00007ffff5a27e7a in

libbitcoin::network::p2p::fetch_address(std::function<void
(std::error_code const&, libbitcoin::message::network_address const&)>)
const (this=0x656ad0,
handler=...) at src/p2p.cpp:430

12 0x00007ffff5a5ae5f in

libbitcoin::network::session::fetch_address(std::function<void
(std::error_code const&, libbitcoin::config::authority const&)>) const (
this=this@entry=0x7fff280d6330, handler=...) at
src/sessions/session.cpp:83

13 0x00007ffff5a6064e in

libbitcoin::network::session_batch::new_connect(std::shared_ptrlibbitcoin::network::connector,
std::function<void (std::error_code const&,
std::shared_ptrlibbitcoin::network::channel)>)
(this=this@entry=0x7fff280d6330,
connect=std::shared_ptr (count 115, weak 1) 0x7ffef03f5760, handler=...)
at src/sessions/session_batch.cpp:70

14 0x00007ffff5a60b53 in

libbitcoin::network::session_batch::connect(std::shared_ptrlibbitcoin::network::connector,
std::function<void (std::error_code const&,
std::shared_ptrlibbitcoin::network::channel)>) (this=0x7fff280d6330,
connect=std::shared_ptr (count 115, weak 1) 0x7ffef03f5760, handler=...)
at src/sessions/session_batch.cpp:56

15 0x00007ffff5a6f335 in

libbitcoin::network::session_outbound::new_connection (
this=this@entry=0x7fff280d6330,
connect=std::shared_ptr (count 115, weak 1) 0x7ffef03f5760)
at src/sessions/session_outbound.cpp:87

16 0x00007ffff5a6f7d1 in

libbitcoin::network::session_outbound::handle_connect (
this=0x7fff280d6330, ec=..., channel=...,
connect=std::shared_ptr (count 115, weak 1) 0x7ffef03f5760)
at src/sessions/session_outbound.cpp:97

Manage memory usage from outgoing message queuing.

Incoming blocks block the receiver during processing (of the second block waiting on the first). However outgoing blocks are processed sequentially but buffered on the send call. So all queried blocks will accumulate in the send buffer (dispatch sequencer via dispathc.lock/unlock). This can produce a low memory state for the sender.

image

Invalid pong nonce warnings.

This results under heavy load or short heartbeat times because the pending_ member is not protected by mutex. A simple protection will resolve the issue and result in a proper drop of the channel due to high latency vs. invalid pong nonce).

Create message broadcaster.

This is currently stubbed in with channels registered for stop subscription. Initially fulfill as address broadcaster.

Optimize for outgoing message checksum.

Incoming message checksum can simply be disabled, which is the default configuration, but outgoing cannot, so:

Use the existing tx hash to obtain for the message checksum. This is the only message object that would have a precomputed bitcoin hash, but is is also the most common larger object.

Cache checksums on message objects and parameterize in send so that they are not recreated for each send of the same instance.

If checksum validation is enabled, cache the block value onto the message object for storage without the need for re-computation.

Very high connection count hits lock limits on address pool.

With 500+ connections and a large address pool capacity we encounter an exception on the upgrade lock within the hosts class. This lock is too granular and serves only to support thread safe merge of addresses from multiple channels. This can be resolved by reducing the lock granularity when handling the merge of a address list.

Resolve overlapped pong nonce warnings.

Currently we can receive an invalid pong nonce for one of three reasons. Either the peer has sent the wrong nonce, traffic has been modified/faulted, or we have sent a second before receiving the first - resetting our own expectation. The former two problems should result in drop of the peer. However we are retaining such peers because the last problem is common. This problem breaks our DOS assumption that we only allow traffic that is expected.

To resolve this we should drop the peer at the point when we are configured to send the next nonce if the previously-expected pong has not yet arrived and cleared it. This results in the configured heartbeat time becoming a maximum channel latency. Given the very high latency we've seen with some peers this would be beneficial (for both ends of the connection). We don't see this warning too often, but when we do it implies that either our own node or the peer is bogged down.

Build error: missing <bitcoin/system.hpp>, maybe meant <boost/system.hpp>?

I cloned master, and did standard build steps:

./autogen.sh
./configure
make 

Got this:

  CXX      src/libbitcoin_network_la-acceptor.lo
  CXX      src/libbitcoin_network_la-channel.lo
  CXX      src/libbitcoin_network_la-hosts.lo
  CXX      src/libbitcoin_network_la-connector.lo
  CXX      src/libbitcoin_network_la-message_subscriber.lo
  CXX      src/libbitcoin_network_la-p2p.lo
  CXX      src/libbitcoin_network_la-proxy.lo
  CXX      src/libbitcoin_network_la-settings.lo
In file included from src/settings.cpp:19:
./include/bitcoin/network/settings.hpp:24:10: fatal error: bitcoin/system.hpp: No such file or directory
   24 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1053: src/libbitcoin_network_la-settings.lo] Error 1
make: *** Waiting for unfinished jobs....
In file included from src/acceptor.cpp:19:
./include/bitcoin/network/acceptor.hpp:26:10: fatal error: bitcoin/system.hpp: No such file or directory
   26 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1004: src/libbitcoin_network_la-acceptor.lo] Error 1
In file included from src/connector.cpp:19:
./include/bitcoin/network/connector.hpp:26:10: fatal error: bitcoin/system.hpp: No such file or directory
   26 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1018: src/libbitcoin_network_la-connector.lo] Error 1
In file included from src/proxy.cpp:19:
./include/bitcoin/network/proxy.hpp:29:10: fatal error: bitcoin/system.hpp: No such file or directory
   29 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1046: src/libbitcoin_network_la-proxy.lo] Error 1
In file included from src/channel.cpp:19:
./include/bitcoin/network/channel.hpp:28:10: fatal error: bitcoin/system.hpp: No such file or directory
   28 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from src/p2p.cpp:19:
./include/bitcoin/network/p2p.hpp:29:10: fatal error: bitcoin/system.hpp: No such file or directory
   29 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from src/message_subscriber.cpp:19:
./include/bitcoin/network/message_subscriber.hpp:28:10: fatal error: bitcoin/system.hpp: No such file or directory
   28 | #include <bitcoin/system.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1011: src/libbitcoin_network_la-channel.lo] Error 1
make: *** [Makefile:1039: src/libbitcoin_network_la-p2p.lo] Error 1
make: *** [Makefile:1032: src/libbitcoin_network_la-message_subscriber.lo] Error 1
In file included from src/hosts.cpp:19:
./include/bitcoin/network/hosts.hpp:27:10: fatal error: bitcoin/system.hpp: No such file or directory
   27 | #include <bitcoin/system.hpp>

I noticed that this library uses boost, but no boost headers included. Am I supposed to copy boost headers to /usr/local/include/bitcoin?

transaction subscribe

hello, share the working code for subscribe transactions to display the bitcoin address

Fail connection in receipt of unsubscribed message.

Given the current design:

  • Protocols should register for all message types that the session will solicit or that may be sent by peers unsolicited.
  • The start handler should block until initial protocols are registered (see related issue).
  • Any post-handshake solicitation should register subscription prior to sending the solicitation and deregister if and when the solicitation is expired.

any message that is received without a registered handler is in violation of the session's intended protocol and should result in channel stop. Otherwise DOS based on sending large unhandled messages is unchecked.

A session could devise other DOS protections, such as channel lifetime or byte limits so this feature should be enabled at proxy construct.

Create console input class.

Add dynamic configuration using std:cin (start with close and log verbosity cycle).
Has threadpool, is a loop over cin (line = std::getline(std::cin) or std::cin >> ch).
Start, stop (restartable), configured events (key words and/or key strokes).
Upon registered event fires notification with event type (stop is well known type).
Handlers are invoked on a strand of the input class threadpool.

Sequencer is slow to clear on channel stop.

The dispatcher's sequencer maintains the send queue, however it only clears via a process of unwinding all locks. By incorporating a stop check in do_send this unwinding will be accelerated by avoiding the call to async_write.

Shutdown may fail to terminate all channels.

The following shutdown sequence failed to close all sessions:

23:30:00.194140 INFO [node] Stop signal detected (code: 2).
23:30:00.201173 INFO [node] Please wait while the node is stopping...
23:30:00.243209 DEBUG [network] Failure in handshake with [73.229.104.201:8333] channel stopped
23:30:00.244203 DEBUG [network] Outbound channel stopped [73.229.104.201:8333] channel stopped
23:30:00.244203 DEBUG [network] Outbound channel stopped [2.126.21.192:8333] success
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Outbound channel failed to start [73.229.104.201:8333] channel stopped
23:30:00.244203 DEBUG [network] Stopped block_in protocol for [2.126.21.192:8333].
23:30:00.244203 DEBUG [network] Stopped block_out protocol for [2.126.21.192:8333].
23:30:00.244203 DEBUG [network] Stopped transaction_in protocol for [2.126.21.192:8333].
23:30:00.244203 DEBUG [network] Stopped transaction_out protocol for [2.126.21.192:8333].
23:30:00.244203 DEBUG [network] Outbound channel stopped [217.23.14.74:8333] success
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Stopped block_in protocol for [217.23.14.74:8333].
23:30:00.244203 DEBUG [network] Outbound channel stopped [213.136.71.143:8333] success
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Outbound channel stopped [47.89.179.113:8333] success
23:30:00.244203 DEBUG [network] Stopped block_in protocol for [213.136.71.143:8333].
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Outbound channel stopped [73.133.87.6:8333] success
23:30:00.244203 DEBUG [network] Stopped block_in protocol for [47.89.179.113:8333].
23:30:00.244203 DEBUG [network] Suspended outbound connection.
23:30:00.244203 DEBUG [network] Stopped block_in protocol for [73.133.87.6:8333].
23:30:25.488952 DEBUG [network] Fired protocol_block_in timer on [62.210.6.26:8333] success
23:31:25.489304 DEBUG [network] Fired protocol_block_in timer on [62.210.6.26:8333] success
23:32:25.489596 DEBUG [network] Fired protocol_block_in timer on [62.210.6.26:8333] success
23:33:23.545067 DEBUG [network] Fired protocol_ping timer on [[2601:645:8300:e5f0:e8ef:c2c5:5955:4797]:8333] success
23:33:23.545568 DEBUG [network] Failure sending ping to [[2601:645:8300:e5f0:e8ef:c2c5:5955:4797]:8333] unknown error
23:33:25.489967 DEBUG [network] Fired protocol_block_in timer on [62.210.6.26:8333] success

Add date-time capture and log levels to log closures.

Create log levels with independent macros, parameterize and/or compiled out. LOG_FAULT (unexpected) < LOG_PROGRESS (chain) < LOG_INFO (messages) < LOG_VERBOSE (debug)
Logs are cumulative, redundant, and independently directable to any stream, including rotable files. File names are hard-wired into a configurable directory, like database. Console logs at an independently-specified level. Add performance timers logging to logger.

preset: test failure with no test output.

Running tests...
/usr/local/bin/ctest --force-new-ctest-process 
Test project /home/runner/work/libbitcoin-network/libbitcoin-network/obj/nix-gnu-debug-shared
    Start 1: libbitcoin-network-test
1/1 Test #1: libbitcoin-network-test ..........***Failed    0.26 sec

0% tests passed, 1 tests failed out of 1

Total Test time (real) =   0.33 sec

The following tests FAILED:
	  1 - libbitcoin-network-test (Failed)
Errors while running CTest
Output from these tests are in: /home/runner/work/libbitcoin-network/libbitcoin-network/obj/nix-gnu-debug-shared/Testing/Temporary/LastTest.log
Use "--rerun-failed --output-on-failure" to re-run the failed cases verbosely.
make: *** [Makefile:71: test] Error 8
Run cat /home/runner/work/libbitcoin-network/libbitcoin-network/Testing/Temporary/LastTest.log
cat: /home/runner/work/libbitcoin-network/libbitcoin-network/Testing/Temporary/LastTest.log: No such file or directory

https://github.com/libbitcoin/libbitcoin-network/actions/runs/9195550780/job/25291624293?pr=406

Satoshi clients send reject msg when peer below 70002.

This results in an invalid message deserialization since the reject message is not defined until protocol version 70002. BIP61 states:

The reject message is backwards-compatible; older peers that do not recognize the reject message will ignore it.

This is an incorrect assumption as peers of older versions could (and should) validate the protocol against invalid messages. Otherwise the peer is subject to DOS attack by ignoring all unknown messages (as opposed to dropping the connection).

Channel start race can cause dropped messages.

At startup, following handshake completion, there is a race between the attachment of protocols and handling of messages. Messages are handled asynchronously by placement onto a queue, freeing up the reader. If protocols are not attached the messages are dropped due to lack of registered handlers. This can be problematic given that there are control messages that arrive immediately following the handshake.

The race is typically won by the registration and is therefore more prominent in a debugging environment, especially when breakpoints are set.

install script compilation error: ambiguous call to network::proxy::stop()

I'm attempting to build the latest version3 (commit #336d7c59be5a543a3ce7291ad1743f25032eeede) using the install script, invoked like so PARALLEL=12 ./install.sh --prefix=/home/$(whoami)/libbitcoin --build-boost --build-zmq

I get the following error:

image

Since the libbitcoin-network README does not mention the install script I tried the following

$ ./autogen.sh
$ ./configure
$ make

... and got the same error. Any ideas what my problem is?

On a more general note - is there a slack or a discord that would be more appropriate to post questions like this that are likely mistakes I'm making and not actual problems with the library? Thanks

Need one more fork to make Homebrew formula

Hi all! I've made Homebrew formulae out of most of the libbitcoin repos, but there are still a few more to go, including this one. To get dependent repos to build (e.g. libbitcoin-node), I have to define libbitcoin-network as a "resource", which makes the build process a little bit more complicated. If I can define other Homebrew formulae as dependencies, it's easier.

In order to make a formula, Homebrew requires a repo to be "canonical," which means it needs either 20 watchers, 25 stars, or 20 forks. libbitcoin-network needs just one more fork! If any followers of this repo haven't forked it (or starred it), I would greatly appreciate it if you did! Or if you already have, please pass on the word!

Thanks in advance!

Optimize message serialization.

// TODO: eliminate this method based on integrated heading serialization.
/// Serialize a message object to the Bitcoin wire protocol encoding.
template <typename Message>
data_chunk serialize(uint32_t version, const Message& packet,
    uint32_t magic)
{
    // TODO: parameterize all to_data() calls with header inclusion option.
    // Serialize the payload (required for header size).
    const auto payload = packet.to_data(version);

    // TODO: move this into message serialization.
    // Construct the payload header.
    heading head(magic, Message::command,
        safe_unsigned<uint32_t>(payload.size()), bitcoin_checksum(payload));

    // TODO: the above change eliminates this payload reallocation and copy.
    // Serialize header and copy the payload into a single message buffer.
    auto message = head.to_data();
    extend_data(message, payload);
    return message;
}

Replace inbound.port with inbound.bindings (binding).

unspecified applies to all interfaces. collapse duplicates in config. Update inbound session to manage an acceptor for each binding. Integrate enable_ipv6 in acceptor setup as applicable. expand inbound.self to a set as well, allowing the caller to advertise multiple addresses.

Question about addr handling

Hi! I'm proposing some changes to addr handling in Bitcoin Core, and trying to ensure there will not be negative consequences for other clients on the network. For more information about the changes, please see my mailing list post. The crux is that, if the changes are accepted, bitcoin core would stop sending addr messages to peers who don't "indicate interest" aka initiate an addr-related message (addr, addrv2, getaddr, or sendaddrv2).

I'd like to ensure that libbitcoin clients will initiate an addr related message to outbound peers. I've looked in the code and believe the software plays nice, and am looking for a +1 from someone more familiar with this project.

This is my understanding: in session_outbound.cpp, attach_protocols is called as part of the process of starting up a new outbound connection (link). This function invokes protocol_address_31402::start, which sends a getaddr message (link). And it seems this is also the case for manual connections (link).

I also found that the starting sequence of session_seed.cpp invokes protocol_seed_31402::start (link), which looks like it sends a getaddr and self advertises its own address (link).

Although my understanding is incomplete (does the node self announce to seeds, but not to normal outbound / manual connections?), if my claims above are accurate, there should be no compatibility issues with my proposed changes.

tldr; I'm proposing a change to Bitcoin Core and want to make sure it does not break libbitcoin clients, can someone confirm my understanding of the code?

Thanks in advance!
Amiti

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.