Bitcoin full node and query server

August 2019

Archive of the libbitcoin Slack #general channel.

Friday, August 2, 2019

A
Artem09:31
Any possibillity to use libbitcoin to produce ethereum keys? As describe above https://www.freecodecamp.org/news/how-to-create-an-ethereum-wallet-address-from-a-private-key-ae72b0eee27b/ its similar, just need to add keccak256 and 0x
Developer News
In the first article [https://www.freecodecamp.org/news/how-to-generate-your-very-own-bitcoin-private-key-7ad0f4936e6c/] of this series, we generated a bitcoin private key: 60cf347dbc59d31c1358c8e5cf5e45b822ab85b79cb32a9f3d98184779a9efc2. Here, we’ll use that key to get the public address and then the Ethereum wallet address of that private key. Creating the Bitcoin wallet address from the private key is a bit complicated. Here, the process will be much simpler. We need to apply one hash fu

Sunday, August 4, 2019

N
narodnik02:55
I have a whole bunch of cryptographic primitives I'm developing. I'm just unsure whether adding them is outside the scope of the library. Also there's nothing stopping you using the functionality needed for Ethereum related code.
evoskuil03:42
Primitives are cool. I'd prefer to not include any explicitly Ethereum features however, since that's the line we've explicitly drawn for the library (Bitcoins only, where the distinction is based on https://github.com/libbitcoin/libbitcoin-system/wiki/Cryptodynamic-Principles). Not a judgement, just a question of controlling scope creep.
N
narodnik03:54
The problem is that much cryptography, especially cutting edge stuff is highly dependent on application and not generalizable enough yet.
evoskuil04:04
Then probably should not include. Sounds like libetherium.
N
narodnik15:23
my crypto is not ethereum related, it's for bitcoin but not core bitcoin.
N
narodnik20:30
@evoskuil looks like mmap api and other things coming to c++20 http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1031r2.pdf

Monday, August 5, 2019

E
Edward Boggis-Rolfe11:17
Hi I am brand new to this site, can someone tell me how compatible libbitcoin is with other bitcoin flavours such as bitcoin sv?
neillm12:23
@Edward Boggis-Rolfe Forks can be implemented and toggled via configuration (see https://github.com/libbitcoin/libbitcoin-server/blob/master/data/bs.cfg#L189). I'm not aware of anyone adding SV fork support
evoskuil12:24
Wallet features of -system and -explorer are probably fairly complete.
(edited)
👍 1
E
Edward Boggis-Rolfe12:25
Thanks, I did see some breaking changes in bitcoin abc's secp256k implementation which broke some of the unit tests, which were reverted in sv's, I am interested in running tests against various test nets, but as encryption generates gobbledigook it is better to know the differences at source!
evoskuil12:27
I don't follow the comments on secp256k1, can you elaborate?
E
Edward Boggis-Rolfe12:27
I am a keen implementor of code that use cpp package systems, currently I am using this which works well: https://docs.hunter.sh I have done an initial version of secp256k implementations and would like to set my attention to the libbitcoin implementation.
ok one sec, let me find the break..
ABC are shoving "ECDSA+Recovery " into an optional pararameter of the call to noncefp
I do not know enough about its implications
I guess it is a nonce on the nonce
evoskuil12:32
I don't foresee us making any changes to this or other crypto primitives.
E
Edward Boggis-Rolfe12:33
Interestingly ABC's implementation includes a schnorr implementation
evoskuil12:34
We've added primitives, such as scrypt, but changing a published library is another issue altogether.
E
Edward Boggis-Rolfe12:34
I think it would be good if there was only one version of secp256k that everyone could agree on!
I rattled off a package for this library that implements a hunterised version: https://github.com/edwardbr/secp256k1
evoskuil12:35
Yes, it would be wise of those who want to add to it to layer on additions, not to fork the library.
E
Edward Boggis-Rolfe12:35
I am interested in doing the same to libbitcoin-system if it makes sense
I am keen on a master cmake file pulling in all its dependancies without needing to manually download and link things
(edited)
evoskuil12:37
We've had people create packages before, but nobody has made the effort to produce the generating code necessary for them to be properly maintained. So they've all been dropped due to lack of support.
(edited)
E
Edward Boggis-Rolfe12:38
as the secp256k library should be static then so will this. I need to make it compile on windows and various mobile os's as well
evoskuil12:38
We have a generated installer that pulls down and builds all libraries, for each repo.
(edited)
E
Edward Boggis-Rolfe12:41
Cool used it, nice, however I am keen on using something that is not specific to your set of tools but is generic to all c++ code base, so with the minimum of effort you could link in libbitcoin into doom for instance with only 5 mins of configuration. Another solution that has traction is conan.
evoskuil12:42
Packaging would be great, but in order for it to last it must be generated and added to CI.
(edited)
E
Edward Boggis-Rolfe12:42
This is still work in progress I should have it working on linux by the end of the day: https://github.com/edwardbr/libbitcoin-system
do a compare against your repo to see what I have done, once it works on mac, windows and android it might be useful for people who want c++ packaging
Once it gets past my initial integration tests I will be chucking it on my on CD system
neillm12:50
@Edward Boggis-Rolfe Just FYI, most of our build artifacts are generated by this repo: https://github.com/libbitcoin/libbitcoin-build
E
Edward Boggis-Rolfe12:53
I will have a look. One feature with hunter is that the dependencies are defined at the top level project, so if your app has two different libraries that have dependencies against two different versions of boost, the developer can override both to one that works for both.
neillm12:55
I don't use cmake. The installer @evoskuil mentioned is the generated install.sh in each of our repos. This has been sufficient for dependencies, as we don't do multiple boost version deps or anything odd like that
E
Edward Boggis-Rolfe12:56
cmake is horrible, however more recent versions have much improved, regrettably it is becoming the standard for want of anything better 😞
evoskuil13:30
We generate cmake build artifacts for each repo.
E
Edward Boggis-Rolfe13:36
Thanks for your feedback, as my project is well advanced I will continue with what I am using, it is easier when targetting different os's concurrently especially windows, no automake, configure etc. I may even target a few of your other repos as well when it makes sense.
If you would like a demo, I would be happy to show you
evoskuil13:38
Windows supports autotools, we just don’t yet have a non-VS build for it.
(edited)
E
Edward Boggis-Rolfe13:38
using cmake you do not need to
It is a meta make system
E
Edward Boggis-Rolfe15:52
Your api is a pleasure to use! Got the hunter package working including tests, though currently without the icu, png and qrencode components
👍 1
E
Edward Boggis-Rolfe17:29
I see that max_null_data_size is hard coded to 80, the USP of bitcoin SV is to have almost unlimited OP_RETURN sizes, would it be possible to have this as an optional variable so that it is possible to use larger values? Not urgent as I am planning to be hashing all my stuff initially
evoskuil17:30
I think there is a comment somewhere to expose this in config as policy.
E
Edward Boggis-Rolfe17:37
would it be possible to have an optional dialect config avaliable to the script class constructor? Also perhaps to the create_stealth_script function.
(edited)
alternatively a template class
evoskuil17:41
Can you explain why?
E
Edward Boggis-Rolfe17:42
Ideally I would be able to connect to more than one block chain implementation at a time in the same binary
evoskuil17:42
More than 256 op codes?
E
Edward Boggis-Rolfe17:43
I think bsv have un disabled a couple, however I am referring to the 80 character limit to the OP_RETURN which can be very large in BSV to carry images documents etc
evoskuil17:46
That would be carried via config, which is a cross-cutting concern. Hard to say without a closer look where it would be injected to enforce policy, but the script interpreter is policy unaware.
E
Edward Boggis-Rolfe17:48
I see this size check, which is valuable, however if I am connecting to bitcoin and bitcoin sv in the same binary it needs to be set to 80 in the first and 100k (or whatever) in the second. In that situation this field cannot be a constant
Untitled Plain Text · 231 B
bool script::is_pay_null_data_pattern(const operation::list& ops)
{
    return ops.size() == 2
        && ops[0].code() == opcode::return_
        && ops[1].is_minimal_push()
        && ops[1].data().size() <= max_null_data_size;
}
Sorry I have to leave to a c++ meetup..
evoskuil17:53
That’s not invoked by the script processor.
E
Edward Boggis-Rolfe21:12
forgive me I am only on day 2 at looking at your library. I will look into it more
(edited)
evoskuil21:13
no worries. i'd be more concerned about deviations from consensus behavior of the Bitcoin op codes.
N
narodnik21:14
@Edward Boggis-Rolfe you said cmake is becoming a standard, but I've seen lots of new projects are using meson now. What do you think of it?
And do you prefer hunter over conan or vcpkg?

Tuesday, August 6, 2019

E
Edward Boggis-Rolfe08:10
cmake has by far the biggest following. I am using hunter because I know it and it works for me. However if you write cmake avoiding bad practice etc your code can be incorporated into most cmake package managers with very little effort. I am not a cmake expert by any sense of the word, however for every C++ library that I am using I am making a compliant cmake file so that it keeps my main project clean, and the packages reusable for other projects that I want to use in the future. So the secp256k library that I have done should work in conan with little or no effort.
The only thing that I am not sure about is the dependency management between packages in a project, I am sure that how conan does it will need a different approach to mine when I worked on your libbitcoin-system package
A
Artem11:14
can anyone help i use example https://github.com/libbitcoin/libbitcoin-system/wiki/Altcoin-Version-Mappings#11-ethereum-eth-bip-3944-technology-examples where i can find kec256 implementation using in libbitcoin exploler? is it work good? some online keccak256 give different result
N
narodnik11:50
@Edward Boggis-Rolfe thanks for the info. waiting for c++ to settle on anything so we can have some working standard build system + package manager.
the video looks great
E
Edward Boggis-Rolfe13:38
I agree, however things are beginning to solidify by critical mass, also C++ 20 will introduce modules will help.
A
Artem13:50
@neillm but how they do % echo “radar blur cabbage chef fix engine embark joy scheme fiction master release” | bx mnemonic-to-seed -p “” | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 60 | bx hd-private -d -i 0 | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-ec | bx ec-to-public -u | sed ‘s/^..//’ | ./kec | sed ‘s/^.\{24\}//’
(edited)
neillm13:51
@Artem That's a sequence of shell commands. You should be able to run that on the command line.
It doesn't include the hash function you're asking about though ...
A
Artem13:53
Oh bad( i dont understand step from publick key to address algorithm radar blur cabbage chef fix engine embark joy scheme fiction master release ed37b3442b3d550d0fbb6f01f20aac041c245d4911e13452cac7b1676a070eda66771b71c0083b34cc57ca9c327c459a0ec3600dbaf7f238ff27626c8430a806 xprv9s21ZrQH143K2weTjKTSMXUM1qmfYo2iDQGPrzsbirKyf9Qn325C8DtapD8dwUL2PU8ciZ9hYVSL4Q9VkygWBosS8FMuX65QqxZQmBDYSEq xprv9vTgjZ7XMB6PSvXz5HeF2xw7GgqpjmTgy76jrNkUkZFfWzKAD1GMyxoMhJCKgCH3WKw3yhXSBuP4Gxmwp5V4ZQVv1wSV7ARQPacbLkwNdBp xprv9w29xFAdfTWFMXugTrP7x1X8c75gYKZFUEhGFqhbGxAwpJnWSo1QZUWPgr2XRKsdsdFPiKKaixbj1gZ2r63NS4EKUkjfii41gWKC5VU8gsh xprv9zWvV2FbEX7VzS96sZG1dZ7MY2j4iFDB62kfuwU95q22omhL7EpQGutw9GyRa9tic3uRnCVZXMLApeDrKb9qJrrUKZzG5dDX29BZwLaTmGZ xprvA1Qqm9XD31nDSB9iYUf4YN6Ycg2Yxey9ecZeDt4rsqUfTqjSoxsW65Ds49xftNDuxDaGUwk9ZtL3sUYeRCEHLjuU95shHpmLwbwM1nVxbXf xprvA2xEQ2iTe9QB22rvf5cbfpUxEBmMdvc7stEFxLhiMXmdLrwLbqugPCHRZiRfEq2puC5vTgwyFneV38hppF8oTf9aoaUv7M8u2XvnACTe6r4 b96e9ccb774cc33213cbcb2c69d3cdae17b0fe4888a1ccd343cbd1a17fd98b18 0405b7d0996e99c4a49e6c3b83288f4740d53662839eab1d97d14660696944b8bbe24fabdd03888410ace3fa4c5a809e398f036f7b99d04f82a012dca95701d103 05b7d0996e99c4a49e6c3b83288f4740d53662839eab1d97d14660696944b8bbe24fabdd03888410ace3fa4c5a809e398f036f7b99d04f82a012dca95701d103 0AB3387A148B3C4B18C333FCAC39B311DCEB2A4B2F5D8461C1CDAF756F4F7AE9 AC39B311DCEB2A4B2F5D8461C1CDAF756F4F7AE9
neillm13:53
@Artem: @skaht may be able to help
A
Artem13:54
we got xpub : 0405b7d0996e99c4a49e6c3b83288f4740d53662839eab1d97d14660696944b8bbe24fabdd03888410ace3fa4c5a809e398f036f7b99d04f82a012dca95701d103 erasing 2 symbols 05b7d0996e99c4a49e6c3b83288f4740d53662839eab1d97d14660696944b8bbe24fabdd03888410ace3fa4c5a809e398f036f7b99d04f82a012dca95701d103 Address: 0AB3387A148B3C4B18C333FCAC39B311DCEB2A4B2F5D8461C1CDAF756F4F7AE9
i dont understand steps between xpub and address
neillm13:56
Hrm, looks like @skaht added the ./kec command in there, which is an unknown. He'd have to chime in, I'm not as familiar with his alt mappings
A
Artem13:56
./kec is keccak256 algorithm
neillm13:56
Sure, but it's not a part of libbitcoin
A
Artem13:56
but there is something more
yeah
its eth shit
and some more steps skipped
inside it i guess
neillm13:58
You mean the command line he documented doesn't reproduce the result shown?
A
Artem13:58
yeah sure
its not just keccak256 hash
also i dont understand there is this util from ./kec
(edited)
neillm14:00
Ok, hopefully @skaht can shed some light
Katrina Swales20:32
Hello
neillm20:32
Hello
Katrina Swales20:37
I am trying to compile libbitcoin-system using a copy of secp256k1 that was installed to a custom prefix, but it seems that libbitcoin-system's configure can't find it. I am using travis and tryign to get them both to compile to a cached directory so I don't have to compile theese every time)
neillm20:39
Is it possible to use install.sh from libbitcoin-system into a custom prefix and instead use that dir as the cached one?
That way, all deps would already be available
Katrina Swales20:41
That makes much more sense, and less stupid then I was doing it,. thankyou
neillm21:02
No problem, good luck

Wednesday, August 7, 2019

N
narodnik01:50
@Katrina Swales it works for me. You have to set the environment variable PKG_CONFIG_PATH so the configure step can find the path to the custom installed secp256k1
👍 1
I set these 2 variables in ~/.bashrc export PKG_CONFIG_PATH=/home/user/usr/lib/pkgconfig export LD_LIBRARY_PATH=/home/user/usr/lib
also you need the switch --enable-module-recovery (or similar, check ./configure --help output of secp256k1) so like ./configure --prefix=/path/to/prefix_secp --enable-module-recovery
👍 1
E
Edward Boggis-Rolfe10:03
Hi if I have a txid is there an easy way in libbitcoin of getting the merkle proof for it?
neillm11:41
@Edward Boggis-Rolfe Not directly, but in v4/master, you can use fetch-header and fetch-block-hashes and determine this in a manner similar to this: https://learnmeabitcoin.com/glossary/merkle-root
N
narodnik11:54
@Edward Boggis-Rolfe yes generate_merkle_root function
neillm11:54
^ Heh, sorry, was assuming over the network.
N
narodnik11:54
$ grep -r generate_merkle_root include/
include/bitcoin/system/chain/block.hpp:    hash_digest generate_merkle_root(bool witness=false) const;
E
Edward Boggis-Rolfe11:56
Cool! thanks! Still learning a lot!
Katrina Swales14:19
And I am getting weird error from install.sh
neillm14:30
@Katrina Swales Can you paste/post it?
Katrina Swales14:30
make[1]: Leaving directory '/home/travis/build/nekosune/data/tmp/build-libbitcoin-system/secp256k1'
********************** Local nekosune/data **********************
/home/travis/build/nekosune/data/tmp/install.sh: line 148: ./autogen.sh: No such file or directory
The command "sudo ${TRAVIS_BUILD_DIR}/tmp/install.sh --prefix=${TRAVIS_BUILD_DIR}/usr/ --build-boost" failed and exited with 1 during .
neillm14:33
Looks like some kind of path confusion. Either the repos weren't checked out properly, or somehow it's running from a dir it's not expecting to be running from
Also, sudo should not be used. Is that required for something on your end?
Katrina Swales14:34
I was following the https://github.com/libbitcoin/libbitcoin-system#debianubuntu version, it sdeemed to imply the install script is what would download everything else
found the problem
Katrina Swales14:35
I did
neillm14:35
Of course, if you don't need/want those deps, don't use them
Katrina Swales14:35
yah
I foudn the problem though
neillm14:35
Ah, ok. I just meant in terms of the install.sh line
(edited)
Katrina Swales14:35
install.sh has special casing for running on travis
they seem to assume if it is running on travis, it is their end trying to build it
neillm14:36
Hrm, ok, so you could unset the $TRAVIS var?
Katrina Swales14:37
I don't know if travis would let me
or if it wouldnt break further stuff later
neillm14:37
Maybe TRAVIS= install.sh -- ..
Or maybe just change the build_from_travis call for libbitcoin-system to build_from_github then run it like you have it?
Katrina Swales14:38
probably will have to, which is annoying
neillm14:39
Agreed. The travis env var is probably the better way to go in this case
Katrina Swales14:39
will play about with it, Worried about future scripts that dont think they own travis , but need to know if running on travis
neillm14:40
Sure, I don't mean to unset it globally -- just for the call to install.sh
Katrina Swales14:40
or I could be midsunderstanding bash again -_-
neillm14:40
So even TRAVIS=false install.sh --... should work
Katrina Swales14:40
doing it on same line only unsets for that line, doesnt it
neillm14:41
Yes, and in this case, for the install.sh where we want it unset, no?
Katrina Swales14:41
yeah
Trying now
👍 1
Sorry if I seemed grumpy about the install script btw
neillm14:43
No problem, it takes some getting used to
Katrina Swales14:50
TRAVIS command not found .,..
bashj is annoying
E
Edward Boggis-Rolfe15:00
Hi if I have ICU do I need boost-locale? I have excluded boost-locale in my cmake as it tends to wreck havoc in packaging systems as it changes the behaviour of various boost libraries and they are not aware of it. libbitcoin-system compiles fine without it.
neillm15:01
@Katrina Swales That's odd, env vars like that should work, at least at the command line. I may be missing something about Travis environments, but I thought they worked similarly
@Edward Boggis-Rolfe Yes. Or rather, we build boost-locale with ICU support if requested
E
Edward Boggis-Rolfe15:03
hmm I will need to check the mnemonics to see if I have broken anything
neillm15:03
@Edward Boggis-Rolfe If you're just using english, it may appear that everything is ok, but proper normalization requires the ICU support
E
Edward Boggis-Rolfe15:04
I have ICU compiled into libbitcoin-system but not boost-locale, compiles fine, concerned that I may have broken something without knowing it
hunter_config(libbitcoin-system URL https://github.com/edwardbr/libbitcoin-system/archive/master.tar.gz SHA1 d1de11c54e1b387ee74809cfa00e4b35331a002b CMAKE_ARGS ANDROID_STL=${ANDROID_STL} ANDROID_ABI=${ANDROID_ABI} ANDROID_PLATFORM=${ANDROID_PLATFORM} CMAKE_ANDROID_ARCH=${CMAKE_ANDROID_ARCH} with-icu=YES )
using the icu flag
neillm15:06
Try to run the unit tests, if they fail, it's probably not built properly. libbitcoin-system should be statically linked with boost-locale, which should be statically linked with ICU when requested
Other linkages are supported of course, but are sometimes trickier to determine if something is going wrong
Katrina Swales15:22
it worked! now I just have to make my travis script recognize if there is a cached dir and only run install if there isnt 😄
neillm15:22
@Katrina Swales That's great! What was the final env var issue?
Katrina Swales15:23
honestly, I don't know, for now I am just using an edited install.sh. I have spent too much time on this when I need to move on to working on the program I am working on, I can spend time doing it propoerly once I have sometrhing working
neillm15:23
Gotcha, ok. Well glad you have something going for now
Katrina Swales15:26
I think checking if cachedir/include directory exists should give a good clue if the cache exists and was used
neillm15:35
@Edward Boggis-Rolfe If you happen to get explorer built with your libbitcoin-system lib, you could run through some of these examples to make sure it's built properly: https://github.com/libbitcoin/libbitcoin-explorer/wiki/bx-mnemonic-to-seed#example-10
E
Edward Boggis-Rolfe15:37
I may have to thanks
E
Edward Boggis-Rolfe19:56
compiling with clang8 I am getting a few warnings e.g. warning: destructor called on non-final libbitcoin::explorer::commands::address_decode' that has virtual functions but non-virtual destructor
(edited)
N
narodnik20:17
@evoskuil the ec_scalar uint64_t constructor was removed... what is the recommended way to convert primitive unsigned integers to EC scalar values now? what is the problem with the constructor. would it be better if it was
template <typename UnsignedInteger> explicit ec_scalar(UnsignedInteger value) { ... }
or a free function called
value_to_scalar()
(but the constructor is better)
evoskuil20:39
If we want implicit convertibility it should be understood what is the canonical mapping. This implies a downcast operator, so not sure what the assumption would be on loss.
N
narodnik21:41
There is a canonical encoding which is standard (the openssl one for how values are embedded into ec_secret)
you can see this by for example setting the bit one and repeatedly adding to itself. if you set the lowest bit (at byte 0) then it will overflow and become x = n - 1, x + 1 mod n -> 0 mod n
or maybe I misunderstood your question? I would make it an explicit constructor.
evoskuil21:48
How is it assigned to 64 bit?
Is it essentially a uint265_t?
Is not using a 64 bit seed very unsafe?
N
narodnik21:59
it's not a seed, it's encoding a value
for example for pedersen commitments
c = vG + bH
v is the value you're hiding, and b is a blinding factor
that makes a coin
sometimes you want to represent numbers in ec secrets and do arithmetic operations on them
👍 1
evoskuil22:11
Is it disallowed to extract a 64 bit from the scalar?
N
narodnik22:25
not really but the scalar can exceed the size so that should be handled
evoskuil22:27
Yeah, typically a compiler warning without explicit (static) cast.
N
narodnik22:30
I don't know any case where casting a scalar to a uint would be needed and I can't imagine any.
evoskuil22:42
Ok, then I think the constructor is fine, but should also be paired with an assignment operator, and the canonical conversion and lack of downcast commented.

Thursday, August 8, 2019

evoskuil00:07
(a 64 bit assignment-to operator, with no corresponding assignment-from operator)
N
narodnik00:20
understood
is libbitcoin a c++11, 14, or 17 project?
evoskuil00:23
11
N
narodnik00:23
ok
I'm very excited for coroutines in c++2a, most of the networking code in libbitcoin could have been written far far better with coroutines support.
that will be a revolution for network programming
I will submit this as an example
evoskuil00:42
👍
Will you be at Web3?
N
narodnik00:44
not this year
E
Edward Boggis-Rolfe14:23
A fyi I entered into a world of pain getting hunter to compile boost_locale with ICU, I would recommend looking at conan or vcpkg. vcpkg have dedicated boost packages for boost+icu. The reason being seems that boost and ICU do not play well together in package managers and really boost+icu needs to be considered a completely different library from vanilla boost.
neillm14:25
Unfortunate, but sounds about right. You may notice the install.sh scripts go through some hoops to get that building properly. It's non-trivial for sure.
E
Edward Boggis-Rolfe14:39
It is a pity that ICU was not incorporated from the beginning into boost, and had proper 'don't spend what you don't use' design to not get in the way of this conditional compilation, however utf8 was invented after boost. The main problem is an ascii std::string is the same type as a uft8 std::string.
neillm14:39
ICU isn't required for boost locale though, it's just one backend
libbitcoin-system requires the ICU backend from boost locale though ...
Requires in the sense that it's optional, but if you want functionality that requires it, it's required (for mnemonic related normalization only)
E
Edward Boggis-Rolfe14:42
Could you just bin the need for boost locale? I would be happier!
neillm14:42
?
E
Edward Boggis-Rolfe14:44
Reduce the complexity of all these dependencies
neillm14:45
Just leave out the --with-icu and --build-icu
E
Edward Boggis-Rolfe14:45
yup I still need international mnenomics
Incidentally I would recommend having the png and QREncode as separate modules so to flatten the dependency tree in any configuration not needing them when including libbitcoin-system leaving libbitcoin-system just a sexy abstraction layer for secp256k
neillm14:47
I'm not sure what you're asking. If you use install.sh, the deps are taken care of for you. if you don't want to use that, I don't know how else to help there.
libbitcoin-system doesn't require png or qrencode either, just leave those out
E
Edward Boggis-Rolfe14:48
I understand, I am just very keen to use packages rather than custom install scripts
neillm14:48
And that sounds like what you're doing. But it also sounds like you're not enjoying that 😉
E
Edward Boggis-Rolfe14:49
I am a masochist!
neillm14:49
Noted
E
Edward Boggis-Rolfe17:46
Hi looking at your examples you use a deprecated pseudo_random_fill what is the recommended new way of generating randomness?
non deterministic
neillm17:47
Deprecated?
Ah, so the deprecated part is instead encouraging the psuedo_random::fill method
E
Edward Boggis-Rolfe17:53
OK thanks!
👍 1

Friday, August 9, 2019

neillm12:16
@Edward Boggis-Rolfe Which examples btw? Would like to note what needs to be updated before v4 release
neillm12:18
👍 Thanks
E
Edward Boggis-Rolfe12:38
incidentally I am looking at x509 type CSR's for secp256k1 public keys, where a public web domain can sign a users public key. BIP 66 mentions DER format compatability issues with openssl. Does that mean I cannot use openssl generated digital signatures as part of the chain of trust to internally signed libbitcoin signatures? I am still getting my head around this, is there any good info?
neillm16:00
@Edward Boggis-Rolfe I don't know anything about that kind of use case. Can you just generate the pem format privatekey from the bitcoin private key then use the standard openssl x509 keypair generation/signing commands from there?
E
Edward Boggis-Rolfe16:02
Possibly, undergoing learning curve! Do you suggest that I avoid DER and just go for PEM?
neillm16:04
They are just different encodings, I don't have a recommendation, as I don't know the use case. I just said pem because I've worked with that more
E
Edward Boggis-Rolfe16:14
Np something for me to look at thanks!
evoskuil16:15
The DER encoding in OpenSSL changed at some point, or was inconsistent. So libsecp256k1 implemented a parser, or it was published as a distinct source file. Libbitcoin incorporates the normalized parser/encoder.
It’s required because Satoshi used it for op sig verify.
👍 2
Slackbot16:16
👻
E
Edward Boggis-Rolfe17:04
Hi I need to hash a blob of text, tempted to use sha256_hash and casting a const char* to a const unsigned char* for its parameters, smells a bit, is this what you would recommend or is there something purpose built?
evoskuil17:08
It’s a byte hash, not a character hash, so convert to bytes any way you like :).
👍 1
Just note that if the characters are unicode, there are a number of encodings. presumably you'd use utf-8.
neillm17:16
@Edward Boggis-Rolfe Could just do sha256_hash(to_chunk("This is a blob of text"))
👍 1
E
Edward Boggis-Rolfe17:23
I knew that there was something sexy such as to_chunk, still learning!
evoskuil17:23
As long as you aren't looking for a normalized encoding anything is fine.
E
Edward Boggis-Rolfe17:24
all encoding will be consistent with in the app, so yes, thanks!
neillm17:27
If you find that's not the case, you could normalize the text blob first, e.g. https://github.com/libbitcoin/libbitcoin-system/blob/master/include/bitcoin/system/unicode/unicode.hpp#L151
Seemed like you were requiring ICU anyway
E
Edward Boggis-Rolfe17:43
I will have a look thanks.
Incidentally as an optimisation for your next version could we have std::string_view instead of std::string wherever your api takes input parameters? e.g. decode_base64, it is one less copy and less memory to protect from hackers etc.
neillm17:49
That looks post C++11, so not likely. Eventually perhaps 🙂
E
Edward Boggis-Rolfe17:53
Damn I was only getting started!! 🙂
evoskuil18:19
If someone has access to the process memory then there’s no security in secrets manipulated by the code.

Saturday, August 10, 2019

E
Edward Boggis-Rolfe10:47
This was more of a performance question rather than a memory protection question. Incidentally libsodium has some stuff that helps address some of these security concerns. https://libsodium.gitbook.io/doc/memory_management

Sunday, August 11, 2019

N
narodnik03:38
@Edward Boggis-Rolfe about pseudo_random_fill, check this line for an example of the new function.
N
narodnik03:45
@evoskuil ec_scalar and ec_secret get used together a lot in many places in code, They are automatically convertible between each other. There's a lot of conversion often between the 2. What can I use to profile the amount of copies made? Can valgrind see how often a new std::array is constructed? What program would you recommend for this? (Linux btw)
N
narodnik04:24
I tried valgrind callgrind tool, and used KCacheGrind to view the output. It profiles all the function calls, but I don't see the constructors for classes...
N
narodnik04:32
ok seems like I need to search std::array<unsigned char, 32ul> since ec_secret is an alias.
evoskuil04:37
Yeah, it’s ec_private that provides the additional abstraction. But with move constructors it should still be minimal.
N
narodnik04:59
yeah probably a single universal reference function in ec_scalar:
template <typename EcNumber> ec_scalar& operator=(EcNumber&& number) { secret_ = std::forward<EcNumber>(number); valid_ = true; }
and an alias to that for the constructor
but I want to test this somehow to be sure. Normally I'd modify the constructors, but this is std::array, I could add a custom allocator, but then I don't get copies/moves .etc
N
narodnik15:12
ah ok thanks, my search wasn't finding it
I think the format should be changed. Right now it just puts all the keys end to end, so if you have 2 different rings with the same keys like {{A, B}, {C}} and {{A}, {B, C}} it creates the same hash. They should be different. There should be some marker to separate subsets for each ring.

Tuesday, August 13, 2019

N
narodnik13:01
Stack Overflow
Is std::array movable? In Bjarne Native 2012 presentation slides (slide 41) it lists std::array as one of the only containers that isn't movable. A quick look on gcc 4.8 libraries source code see...

Wednesday, August 14, 2019

N
narodnik17:35
@evoskuil is there any upgrade path or plan for C++20? The coroutines support can massively simplify the networking protocol code, and also there's things like this: https://gist.github.com/narodnik/19b70ed207206f097d8186a6564dafd0
But there might also be issues. I remember compiling for Android, Qt only worked with g++ which had no C++11 support on Android (although clang is fine). Something to bear in mind.
Also C++17 has nodiscard attribute which would be added to every function returning an error code (compiler gives warning/error if return type is ignored).
neillm17:57
I would think that there is, but it's not yet formalized
N
narodnik20:20
Anybody know what this error is about?
/usr/bin/ld: test/unicode/libbitcoin_system_test-unicode.o: in function `boost::test_tools::assertion_result boost::test_tools::tt_detail::equal_impl_frwd::call_impl<wchar_t const*, wchar_t const*>(wchar_t const* const&, wchar_t const* const&, mpl_::bool_<false>) const':
/usr/include/boost/test/tools/old/impl.hpp:130: undefined reference to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)'
/usr/bin/ld: /usr/include/boost/test/tools/old/impl.hpp:130: undefined reference to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)'
/usr/bin/ld: /usr/include/boost/test/tools/old/impl.hpp:130: undefined reference to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)'
/usr/bin/ld: /usr/include/boost/test/tools/old/impl.hpp:130: undefined reference to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)'
/usr/bin/ld: /usr/include/boost/test/tools/old/impl.hpp:130: undefined reference to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)'
/usr/bin/ld: test/unicode/libbitcoin_system_test-unicode.o:/usr/include/boost/test/tools/old/impl.hpp:130: more undefined references to `boost::test_tools::tt_detail::equal_impl(wchar_t const*, wchar_t const*)' follow
collect2: error: ld returned 1 exit status
distcc[1895] ERROR: compile (null) on localhost failed
make[1]: *** [Makefile:3084: test/libbitcoin-system-test] Error 1
make[1]: Leaving directory '/home/aa/src/libbitcoin-system'
make: *** [Makefile:7060: check-am] Error 2
$ ls /usr/lib/libboost_unit_test_framework.*
/usr/lib/libboost_unit_test_framework.a
/usr/lib/libboost_unit_test_framework.so
/usr/lib/libboost_unit_test_framework.so.1.69.0
evoskuil20:31
Looks like you are missing boost test.
N
narodnik21:00
There is a file called
/usr/lib/libboost_test_exec_monitor.a
And a folder /usr/include/boost/test/ with a bunch of headers.
N
narodnik21:29
The linker step actually shows -lboost_unit_test_framework
N
narodnik21:36
it links if i disable the unicode.cpp test module in Makefile.am
evoskuil21:41
Well, you need boost test, which includes the framework.
N
narodnik21:45
That's not the problem, I can run the tests.
pmienk21:51
you might want to check into 1.69.0 vs 1.62.0 boost differences
looks like you're using an update that may have introduced breaks
N
narodnik21:52
yep that's what it suggests
About pull request: I wasn't sure about this but it should simplify expressions like schnorr signatures s = k + c * x;
meaning c * x is evaluated, then k + <result> without the extra allocation and copy

Thursday, August 15, 2019

N
narodnik20:00
ZMQ critical vulnerability requires upgrade ASAP from versions 4.3.2 and below: https://nvd.nist.gov/vuln/detail/CVE-2019-13132
neillm21:05
@narodnik Ouch, good catch. Will take a look
N
narodnik21:23
🙂
evoskuil23:56
I’ll have to update the NuGet package when I get home, in about a week. But otherwise this should just be an update to -build and readme dependency lists. I’ll also get libsecp256k1 and -consensus updated at the same time.
@narodnik the ec_scalar interface update looks fine. I’ll have a couple comments and questions on implementation. Switching to smart pointer member control is something I’ve been planning to do in general, for a couple of reasons, especially in the chain primitives.
N
narodnik23:59
ok great, the book Effective C++ by Scott Meyers has a very good chapter on move semantics.
👍 3

Friday, August 16, 2019

Saturday, August 17, 2019

neillm02:17
Quick update: mainnet1/2 and testnet 1/2 have been updated with the later zmq release, using build generations from https://github.com/libbitcoin/libbitcoin-build/pull/201 (even though it's proposed and not merged).

Sunday, August 18, 2019

R
RaGa20:57
Hi, late in the game: new to bitcoin, was actually going through source, and in libbitcoin Network repo, it says "libbitcoin Network is a partial implementation of the Bitcoin P2P network protocol", now, what does it mean by partial implementation? my first thought about this repo is, it will act as a network stack for couple of other modules in Bitcoin protocol..
(edited)
pmienk20:58
There are bips we either never implemented or have yet to implement.
Particularly, those related to 'thin' clients.
R
RaGa20:59
in which criteria "libbitcoin Network" falls under?
pmienk21:00
oh, i'm sorry, you're asing about the repo itself.
R
RaGa21:00
absolutely.
should have put "libbitcoin Network" or libbitcoin-Network?
pmienk21:02
The -network repo doesn't implement all of the protocol. -network is a shared library between the two primary binary generating repos of -explorer and -server (also -node)
because it's shared, it doesn't provide protocols specific to -server/-node implementation
R
RaGa21:03
Thank you, so, will it be ok to assume it as a network module for bitcoin protocol?
pmienk21:04
it's a common functionality network library
R
RaGa21:05
common functionality network library? common to all the C++ project that needs NW libs? or it is common to other BC repos?
and also "-server (also -node)" is it a thing that mines?
basic question.
pmienk21:07
it would presumably be useful for anyone trying to build a bitcoin network connecting C++ project and it's used by other libbitcoin projects which require interoperation with the bitcoin network.
-server and -node are my shorthand for libbitcoin-server and libbitcoin-node. Neither provide mining capabilities.
libbitcoin-node provides basic bitcoin node functionality while libbitcoin-server extends libbitcoin-node with a client-server protocol for query by thinner clients
libbitcoin-server's client-server protocol is a libbitcoin rather than bitcoin specific protocol.
R
RaGa21:11
ok, thank you, will catch it up these terms.
pmienk21:12
Happy to help, hope I haven't introduced any additional confusion.
N
narodnik23:44
@evoskuil don't know if this is of interest to you, but I have a piece of code which is doing EC ops on 100k keys. It takes around 15 secs. I added the --enable-endomorphism switch to secp library and the time dropped to 10 secs. I then noticed in Valgrind that 15% of time is spent parsing the public keys from the internal format. I reimplemented the algorithm in pure secp internals (not the public API, but the actual points in jacobian coordinates called secp256k1_scalar and secp256k1_gej) and time dropped to 6.5 secs. That's a pretty drastic improvement.
But I had to patch secp to expose its internals and be able to do this optimization.

Monday, August 19, 2019

evoskuil00:37
I don’t recall why we didn’t set that flag in the install.sh builds, but it should be a straightforward change to libbitcoin-build metadata.
As for parsing, I don’t see how we could do anything if they don’t accept a public interface in native format. At that point we could decide how we would want to encapsulate the format, possibly in ec_private and ec_public. But since so many encodings, including Bitcoin scripts, use our format natively, I’m not sure it would be a net benefit.
N
narodnik15:08
In EC math, normal keys are encoded as (x, y) points (known as affine coordinates), but actual calculations are done in jacobian coordinates (x, y, z). Long term, having ec_scalar and ec_point be in Jacobian coordinates would be better (with conversion functions).
evoskuil16:12
Sounds worthwhile to me. We can also cache both and convert on first use. We do some of this as optimizations in the chain types. Requires thread safety measures, but may be worth it.
Still need to deal with libsecp256k1 tho
N
narodnik16:19
Yep, it's a very well fine tuned library, but I also saw inside you can pre-generate a large table to make multiplication by G faster. I want to find out how to make this table larger (the code just has hard-coded constants) and also enable it for other points... But to do that I'm going to have to read up on EC math a bit more.
Maybe in the future I'll even re-implement the library...
It only supports secp256k1 but there's no reason it can't be generalized to other curves.
(while preserving its speed properties)
N
narodnik16:31
For example I make a point K, and then have a loop multiplying K by 100k scalars. Being able to precompute part of a multiplication by K would be an advantage (just like it does for G)
well I actually had to enable the precomputation but the context in this case is not thread safe until it's finished initialization (I think)
evoskuil16:51
Well you can block on init, as we do with static inits (including libsec context) at startup. I’m just talking about when you have a class member cache that is populated by read - need to block other reads until the cache is populated, so it’s concurrent read safe.
I think there’s a pattern for that in block and transaction (at least).
Many of our objects are fixed at construct, so concurrent write is not an issue, but we assume read safety on everything.
N
narodnik19:20
Yep ok. I just want to avoid large implicit static inits everywhere because they can start to build up and increase startup latency on applications. I like my apps to load fast and be responsive.
evoskuil19:37
We have very few, and actually I think they are initialized on first use. I think libsecp is the only significant one.
(edited)
pmienk22:31
boost logging initialization isn't threadsafe as well
(edited)

Wednesday, August 21, 2019

Is v4 bitcoin-server indexing stealth addresses?

Sunday, August 25, 2019

evan23:37
Can anyone tell me what I need to do to execute this command correctly, what do I need to do to obtain the filter?
Image from iOS
5 replies · neillm, evan, evoskuil · last Sep 03, 2019
neillm23:54
Not sure what you're trying to do exactly, but I was able to run this:
$ bx fetch-stealth 10101010 | grep -c match
31068
evan00:20
I am trying to fetch my stealth history but I don’t know what I need to do to go from my stealth address to the correct filter for the command
evan05:24
Oh....I see that now. I was just to dense to notice before....thank you Eric
evoskuil05:34
No worries!