Bitcoin full node and query server

October 2021

Archive of the libbitcoin Slack #general channel.

Friday, October 1, 2021

evoskuil17:04
These are the location of boost sources at compile time. The binary is statically linked, making these irrelevant.

Monday, October 4, 2021

Doug Luce19:32
that binary is still using /Users/Mica/explorer-qrcode-prefix/etc/libbitcoin/bx.cfg for the default config location.
evan19:39
Ok
evoskuil20:08
Not sure how that is, because the path is computed from the current default directory at runtime, but in any case you can change it or compile it yourself.
How did you determine this?

Tuesday, October 5, 2021

Wednesday, October 6, 2021

evoskuil20:33
Updates: I've got a monster PR in libbitcoin-system. It's ready to merge, though SourceForge is down again (bad certs), so builds are failing. Travis is giving us free builds, but have to re-request them every couple weeks or so (pain in the ass). The -system changes break the other repos, so I'm working my way through that now. It'll take a while, because I'm doing other work as I go. Currently reorganizing -network and adding test coverage. Network component tests appear to be failing because of public server or DNS outage, but need to work that out. Amir finally has libbitcoin.org and will transfer it to me eventually. We met in Amsterdam a couple of weeks ago. The Libbitcoin Institute did not get IRS 501c3 status, so that is being wound down, but another entity will be set up in its place with the same name and purpose (minus the tax benefit). Tom and I are still working on fundraising and have some new leads based on Amir stirring the pot yesterday. I'm not planning on running the conference next year, and will put my efforts into the v4 release. Possibly the following year. Book translations are starting to come in, and Max from Wasabi just posted the audiobook.
👍 2👍🏾 1
jungly20:46
Github actions claim to be free for public repos: https://github.blog/2019-08-08-github-actions-now-supports-ci-cd/ Worth considering a move? Happy to put in the work. I was struggling with a PR today, but that was largely because of sourceforge's certs for boost downloads.
evoskuil20:53
I was looking at it, but got sidetracked. If the actions include the actual build hosts, then I'm all for it. I see the builds worked, did you fix the SF issue? FYI, I'm trying to keep Travis time down at the moment. MacOS chews up like 6x the credits of the other platforms. So if you kick off a build, stop all but one gcc build until it's done, and if that's good restart the others once it looks ready to go.
(edited)
jungly20:55
Good advice about checking with a single build first.
That free thing was a marketing gimmick. 2000 minutes per month limit. People blame us PoW people for killing free CI for open source 😉
image.png
evoskuil21:07
Yeah, the free thing was ridiculous. But they are giving us more whenever we run out. They are just making it a hassle.
jungly21:24
re: sourceforge certs, it seemed to have resolved itself after a while. I think their load balancer resolved the host to a different one and my build was lucky to go through.
I had another thought on gihub actions vs travis. With Travis we can save those minutes by using ccache, so we don't have to pay for building boost on each run. With gh actions, caching is even more flexible, for system we can cache the dependencies, but for things like blockchain, network etc, we'd have system, database etc cached as well. We'd speed up the runs, and save minutes. For me, just the faster runs is so much nicer. Github can expire cache based the commit you checked out for a dependency. Requires some crafting, but it can help.
evoskuil21:29
all good
lots of operations stuff to do. I did a bunch but then went back to code for a while. Gotta get VS2019 builds integrated, Windows CI (drop AppVeyor), move off of NuGet, drop Travis, ...
Also generate VS Code builds and non-VS Windows builds.
Got a list somewhere
jungly21:34
list of lists!
I am going to give gh actions a try cause I was messing with them today for braidpool setup, might as well copy paste things while I still remember them. It is nice, when the braidpool ci doesn't have to build boost, libbitcoin-system and can just build my 10 files and run the tests 😄
evoskuil21:36
Yep, that would be AWESOME
Sorry about my slackage on braidpool. Trying to stay focused on libbitcoin.
jungly21:38
We need libbitcoin! There is no two ways around it.
evoskuil21:41
I think you'll appreciate the changes in system. Moved a lot of stuff out, added a lot of test. redesigned low level code (streams, serializers, endians, proptree, etc). Improved a some real perf issues in streams.
🕺🏾 1👍 1
jungly21:43
Many interface changes? That is, do we need to get the rest of the libs in line with system?
evoskuil21:46
Yes, that's what I'm working on.
You should probably use system from my PR.
jungly21:51
😱
image.png
evoskuil21:53
Didn't I already tell you this?
jungly21:53
I stopped keeping an eye over summer, I used to enjoy going through the diffs as emails came through
evoskuil21:54
Cleaning house 😏
jungly21:54
spring clean!
evoskuil21:54
Lots of cruft collected over the years.
😅 1
jungly21:55
ok.. i am seeing doing gh actions for that branch, and then making sure it works with c++20 and boost 1.76... Those unlock coroutines, which will make my, and hopefully other people's lives easier.
4 replies · jungly, evoskuil · last Oct 12, 2021
jungly15:39
@evoskuil - this is coming along nicely. Though, saving on icu and boost build is saving around 30% on the build times. TBH, I was hoping it would have been more. I just have it for linux/gcc/static builds for now.
👍 1
jungly15:53
That leads to the question about travis matrix and gcc versions.
    - if [[ $LINUX && $GCC   && $DYNAMIC ]]; then export CC=gcc-4.8; export CXX=g++-4.8; fi
    - if [[ $LINUX && $GCC   && $STATIC  ]]; then export CC=gcc; export CXX=g++; fi
Why gcc-4.8? Should we 'bump' it to something like 10, if not 11? Tests pass with both. I am curious why it was explicitly set to 4.8.
evoskuil16:34
It was low to guarantee support for existing distributions, about 7 years ago. It can certainly be bumped up, but shouldn’t go to latest.
👍🏾 1
jungly14:48
Sent a PR with guithub actions for all combinations we had on travis. The only one I got stuck is shared libs on macos - so left that for next PR. OSX introduced a security feature that breaks the use of DYLD_LIBRARY_PATH . I got things to work on a local Mac using install_name_tool , but need some help and some more time on how to move that to our build setup. PR: https://github.com/libbitcoin/libbitcoin-system/pull/1236 Github actions report: https://github.com/pool2win/libbitcoin-system/actions/runs/1332074390
👍 1

Saturday, October 9, 2021

evoskuil01:31
Revamping libbitcoin-network. The object model remains close to what's there now, but with some material changes to threading. I put together this simplified model to help me visualize relationships. The main simplification is that derived session and protocol classes are not shown.
2 replies · jungly, evoskuil · last Oct 13, 2021
jungly17:51
This is super helpful. Thanks for sharing it here. Plan to put it on the wiki?
evoskuil00:45
Yeah, when it's final.
evoskuil01:35
The extensible (yellow) classes are modified by deriving from p2p, overriding the virtual attach methods to attach custom derived sessions, and overriding session attach methods to attach custom derived protocols. This is how libbitcoin-node is constructed (adding transaction and header protocols). Of course, the same can be done in libbitcoin-node, and libbitcoin-server inherits from it (though does not change its protocols).
evoskuil02:04
libbitcoin-network is also the threading engine for libbitcoin-node and libbitcoin-server. Node introduces additional thread pools for parallel validation, though these are isolated. Server introduces one thread per endpoint worker (well isolated within libbitcoin-protocol). This rework dramatically simplifies the threading model, so that we are operating on one dedicated thread per socket/channel. While the implementation remains entirely asynchronous, this will eliminate a lot of complexity and resolve certain issues in our use of boost::asio. It will also reduce our DOS attack surface to almost nothing. I expect it will also finally resolve the shutdown hang (deadlock). If it resurfaces, it will certainly be much easier to troubleshoot. We may possibly experience a performance hit, as we will not be queueing up arbitrary amounts of work when our processing speed is out of sync with network speed. However, this is the DOS vector. If there's a material hit I would create a managed work buffer, dropping outbound messages or blocking inbound messages as necessary (which is how we manage ZeroMQ buffering).
(edited)
👍 2
2 replies · jungly, evoskuil · last Oct 13, 2021
jungly18:00
The dos attack surface reduces because the number of connections is limited? so we have an upper bound on number of threads? I thought we had a threadpool in network for handling channels. I might be forgetting my incorrect understanding! :)
evoskuil00:46
See above, I'm moving to one asio thread per channel. Otherwise we end up blocking our way to the same thing, in order to guard the socket and to sequence messages.
(edited)
evoskuil02:13
Note that in the model, 'protocol' (actually one derived class per protocol semantic) receives and originates all p2p messages (apart from explicit broadcasts). Each protocol subscribes to the message type(s) of interest. This is part of the elegance of the design. Each derived protocol class entirely encapsulates the semantic (such as compact blocs, ping/pong, headers, txs, blocks, etc.). These are versioned and are attached independently on each channel (by the session), conforming to the negotiated protocol version of the channel. They are very simple and clearly document each independent protocol.
(edited)
All of the other classes are entirely generic (apart from session attachment of the protocols, possible config settings, and the message 'pump' which has knowledge of all supported message types). So custom protocol work is almost entirely isolated to a custom protocol derived class.
(edited)
evoskuil02:23
Even without protocol customization, a p2p instance provides new channel notification, subscription/notification of messages on a channel and/or all channels, send of messages on a channel and/or broadcast on all channels, as well as channel and p2p stop subscription/notification.

Wednesday, October 13, 2021

evoskuil00:46
replied to a thread: view
See above, I'm moving to one asio thread per channel. Otherwise we end up blocking our way to the same thing, in order to guard the socket and to sequence messages.
(edited)

Thursday, October 14, 2021

evoskuil18:19
After getting about half way through this work I found in boost documentation a resolution to the main issue we had with socket write composition. So with a shared threadpool of any size we can still ensure order on each channel. I’ve also been able to eliminate the execution of message handlers under lock, which eliminates the deadlock hazard. And I’m finally implementing the DOS protection strategy that has been envisioned for some time. This borrows from lessons learned working from ZeroMQ.
🎉 2😮 1
Given that attached protocols stop any channel that fails to comply with its expected semantics, the only DOS risk is in unbounded expansion of per-channel work queues.
This can happen when a peer requests large amounts of data but fails to accept it quickly. It can also happen when a peer sends more work than the network can process. Currently this work accumulates on the opaque asio work queue. So memory consumption simply grows without measure.
(edited)
evoskuil18:30
ZeroMQ uses transparent and configurable work queues for both send and receive. This is a necessary strategy, and it’s sort of surprising that asio doesn’t natively expose controls on its queue. But as all problems in computer science can be resolved with another layer of abstraction, I’ve created a buffered_socket::socket, which maintains size/count read and write message queues. This will suspend read when the read buffer is full (blocking the peer) and overflow the send queue (drop writes) when the write buffer is full. The latter may cause an interruption of the expected protocol semantics, resulting in a dropped connection, though this is acceptable and unavoidable given the p2p protocol design. The other alternative is to drop the peer.
👍 2
evoskuil18:39
The message queues are thus buried in the socket (as with ZeroMQ), maintaining the simplicity of protocol implementation. Ideally we would want to suspend performing work that could not be sent to a peer, but this at least puts an upper bound on the resources that a peer can consume. It will also be possible to provide a cost metric per incoming message type, to limit peer requests by actual resource consumption, suspending the reader until queued work drops below the configured limit.
(edited)

Saturday, October 23, 2021

evan23:09
I could not figure out why I was not syncing correctly…..now I am, as it turns out the time on the system has to be correct….I feel stupid.
👍 1
1 reply · neillm · last Oct 25, 2021
neillm02:48
mainnet5 looks A-ok to me, thanks!

Saturday, October 30, 2021

neillm14:05
Slowly catching up to v3 changes. I recall the qrcode/png updates happening not that long ago, but am not sure what's changed there yet. Is code like this dead? https://github.com/libbitcoin/libbitcoin-system/blob/version3/include/bitcoin/system/wallet/qrcode.hpp#L29 (i.e. WITH_QRENCODE and WITH_PNG as it seems there's no supported way to push those through via install.sh). Maybe I'm missing something?
evoskuil14:15
It’s dead in master, not sure if I backported it all. Qrencode is now embedded and I wrote a tiff encode to get rid of png.
✅ 1
There was another build break from a dependency update. Dependencies bad.
👍 1
neillm15:01
Looks like it's dead in v3, but I'm not sure how to use the new API. Any quick pointers?
i.e. encode qr, get data, write out to tiff
evoskuil17:48
Check the test cases.
evoskuil17:55
I think I also hooked it up in bx.

Sunday, October 31, 2021

neillm03:22
Ah, I see -- it looks like master is ok, but version3 is not backported. For this particular case I was looking at version3 primarily, but I'll take a look at master then
👍 1