Archive of the libbitcoin Slack #general channel.
electrum endpoint today. Updated all tests with version conditions, for initial availability, additions, behavior changes, and obsolescence. Implemented server.features and server.ping methods. Improved electrum test harness and expanded coverage.
Also verified bs<-bs and bs<-core full chain and multi-channel sync on windows and linux and on manual and inbound channels (most sync we test has been multiple outbound channels over the Internet). Performance looks excellent. Getting close to being able to provide clean benchmarks for blocks out, with the expectation that we should be able to provide the full chain out as fast as we can sync it in.server, transactions, and headers are almost done and fully tested. The tx and package submission methods are fully implemented except for the actual submission (broadcast to the network). Just two methods left in server. Then it's mempool, fees, and addresses. All methods are stubbed in and invoke properly. The hard work in fees has already been done, mempool is simple, and addresses are a set of nearly-identical queries against the address index - which are similar to those in the native endpoint. I'd say 1-2 weeks to complete, with the notable gaps around mempool/submit.database.turbo is configured (no parameter option)
The four legacy methods (using p2pkh and p2sh addresses as keys) are identical to the newer scripthash-based methods after address conversion (the sha256 hash of the output script is derivable from p2pkh/p2sh addresses). So the four older methods and newer methods each perform their own version validations and then just pass into common code for the bulk of the implementation.6. Next, with mempool transactions in the specified order, append a similar string.
4. For mempool transactions, we define height to be-1if the transaction has at least one unconfirmed input, and0if all inputs are confirmed. 5. Order mempool transactions by(-height, tx_hash), that is,0height txs come before-1height txs, and secondarily the txid (endianness same as human-readable hex string used for display) is used to arrive at a canonical ordering.
PubKey NYC I've been back on the electrum interface for the last couple days. I had some discussion with Electrum folks and decided to drop in the major additions for their WIP on network protocol v1.7. Also spent a couple days working of some test and organizational backlog.
That's complete now, as is the database queries and endpoint implementation for the address queries (balance, history, mempool, listunspent). These are addressable via p2pkh/p2sh addresses (only) in early versions, via output script hash in current versions, and via output script in the next version. We just map all three on to output script hash.
The new outpoint method is mostly complete, and this adds a subscriber. There are also subscribers for the three address methods above. Most of the work for those is done. That and connection of the fee estimator to its method, and the electrum interface will be complete.900,000 in 4.67 hrs, and to 945,188 in 5.22 hrs on maxi. Previous record to 900k was 4.80 hrs.I think I'll work off the remaining server tests (address and outpoint) before...
blockchain.address.get_balance blockchain.address.get_history blockchain.address.get_mempool blockchain.address.listunspent blockchain.scripthash.get_balance blockchain.scripthash.get_history blockchain.scripthash.get_mempool blockchain.scripthash.listunspent blockchain.scriptpubkey.get_balance blockchain.scriptpubkey.get_history blockchain.scriptpubkey.get_mempool blockchain.scriptpubkey.listunspent blockchain.outpoint.get_status
/// Map standard XCPU defines for intrinsics usage.
/// vc++: There are no native flags for SHA and SSE41.
#if defined(HAVE_XCPU)
// -msha
// vc++: SHANI not independently configurable (requires custom option).
#if defined(__SHA__)
#define HAVE_SHANI
#define HAVE_SHA
#endif
// -mavx512bw
// vc++: Advanced Vector Extensions 512 (X86/X64) (/arch:AVX512)
#if defined(__AVX512BW__)
#define HAVE_AVX512
#define HAVE_512
#endif
// -mavx2
// vc++: Advanced Vector Extensions 2 (X86/X64) (/arch:AVX2)
#if defined(__AVX2__)
#define HAVE_AVX2
#define HAVE_256
#endif
// -msse4.1
// vc++: Use Advanced Vector Extensions (X86/X64) (/arch:AVX).
#if defined(__SSE4_1__)
#define HAVE_SSE4
#define HAVE_128
#endif
#endif
/// Map standard ARM defines for intrinsics usage.
/// SVE maximum width is not detectable (requires custom options).
#if defined(HAVE_ARM)
// -march=armv8-a+crypto
// Requires 64 bit build.
#if defined(__ARM_FEATURE_CRYPTO)
#define HAVE_CRYPTO
#define HAVE_SHA
#endif
// -march=armv8-a+sve
// Requires 64 bit build.
#if defined(__ARM_FEATURE_SVE)
#define HAVE_SVE
#endif
// -march=armv8-a (64 bit)
// -march=armv7-a -mfpu=neon -mfloat-abi=hard (32 bit)
#if defined(__ARM_NEON)
#define HAVE_NEON
#define HAVE_128
#endif
#endifCMakePresets.json with "architecture": { "value": "arm64ec", "strategy": "external" } and set environment variables CXXFLAGS and CFLAGS to /arm64EC. /machine:arm64x flag to combine the Arm64 and x64 artifacts into a single binary that can run on Arm64 devices. auto_link.hpp. It constructs the lib path in parts, including this:
#if defined( _M_IX86 )
# define BOOST_LIB_ARCH_AND_MODEL_OPT "-x32"
#elif defined( _M_X64 )
# define BOOST_LIB_ARCH_AND_MODEL_OPT "-x64"
#elif defined( _M_ARM )
# define BOOST_LIB_ARCH_AND_MODEL_OPT "-a32"
#elif defined( _M_ARM64 )
# define BOOST_LIB_ARCH_AND_MODEL_OPT "-a64"
#endif
...
#if defined(BOOST_LIB_NAME) \
&& defined(BOOST_LIB_PREFIX) \
&& defined(BOOST_LIB_TOOLSET) \
&& defined(BOOST_LIB_THREAD_OPT) \
&& defined(BOOST_LIB_RT_OPT) \
&& defined(BOOST_LIB_ARCH_AND_MODEL_OPT) \
&& defined(BOOST_LIB_VERSION)_M_ARM64 is defined (it is) boost switches to -a64. The issue is simply that these libs are not in the NuGet package. But good to know that boost does expect and therefore build them. I could probably copy the x64 into the expected path and link with ARM64EC.secp256k1) we produce the paths in the targets file (as intended), using a similar naming convention. // BUGBUG: macOS:
// Error codes have changed and the resulting race failure test is not matching expected code.
if (!result)
{
BOOST_CHECK_EQUAL(ec1, error::resolve_failed);
BOOST_CHECK_EQUAL(ec1, error::operation_canceled);
}[network:1 != ] [network:1 != &]
network::error::unknown, which means it's a code coming the the OS that doesn't map to anything known.full address index (all outputs by script hash) in 1.14 hrs on maxi.946,213 (current) is 1,059,591,596,235 bytes (986GB).libbitcoin-server: 4.0.0 libbitcoin-node: 4.0.0 libbitcoin-network: 4.0.0 libbitcoin-database: 4.0.0 libbitcoin-system: 4.0.0
notify(node::chase::organized, {}); and handling it is just: const auto message = receive(); where the message is the json-rpc notification from the server.stopping_ is an atomic bool that gets set via socket (or process) termination on the main channel strand, passed into the expensive query for cancellation. sub.cursor is now a height-based cursor, and r/w parameter to the query, which updates each read to the top of the chain, so most reads will only accumulate one block of confirmed related txs. The limit parameter is from config, and will terminate the query with an error if the number of address outputs exceeds that value (though it can really handle any volume). turbo_ is also config, allowing the store query to be run on all available threads (across the set of potentially millions of outputs). The hash accumulator sub.accumulator is stored with the cursor and the last status hash sub.status on the subscription (144 bytes + 32 byte scripthash key for each subscription of the channel). The accumulator is copied after the confirmed txs are appended to it, and the unconfirmed are then accumulated and flushed as the next sub.status, which is then sent as the notification if it has changed.
code protocol_electrum::get_scripthash_history(address_subscription& sub,
const hash_digest& hash, size_t limit) NOEXCEPT
{
BC_ASSERT(notification_strand_.running_in_this_thread());
histories history{};
const auto& query = archive();
if (const auto ec = query.get_history(stopping_, sub.cursor, history,
hash, limit, turbo_))
return ec;
if (history.empty())
return error::success;
auto it = history.cbegin();
while (it != history.cend() && it->confirmed())
write_status(sub.accumulator, *it++);
midstate copy = sub.accumulator;
while (it != history.cend())
write_status(copy, *it++);
sub.status = copy.flush();
return error::success;
}estimate_fee and get_fee_histogram, added to server PR.