Bitcoin Forum
December 15, 2024, 02:45:04 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: [Solved] ECDS file from Mastering bitcoin p. 69 (addr.cpp) doesn't compile C++  (Read 284 times)
SamYezi (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 84


View Profile
January 03, 2022, 12:25:21 PM
Last edit: January 08, 2022, 01:22:28 PM by SamYezi
Merited by Welsh (8), dkbit98 (5), o_e_l_e_o (4), ABCbits (3), hugeblack (3), BlackHatCoiner (3)
 #1

Hello. I am a CS student and I want to see Elliptic Curve cryptography in practice.
I've read the book Mastering Bitcoin: Programming the Open Blockchain (2017).

The book:

https://isidore.co/calibre#panel=book_details&book_id=6316

But there's a problem. On page 69 There's a code for generating a Public key from a Private key using Secp256k1 Elliptic Curve Digital Signature Algorithm.

The source code could be located in the addr.cpp file in the book's GitHub repository https://github.com/bitcoinbook/bitcoinbook/tree/develop/code

The problem is that the code just doesn't compile.

The code requires Libbitcoin installed in the compiler and Libbitcoin itself requires the boost library. I've tried to install these 2 libraries (by copying files from the "Include" folder of the libraries into the "Include" folder of the compiler). It's probably worked since the IDE started to give different errors during the compilation of the addr.cpp. I've used the latest version of the libraries and even changed

#include <bitcoin/bitcoin.hpp> to #include <bitcoin/system.hpp> in addr.cpp so it better corresponds to Libbitcoin

Although It's not really clear if it is the right way to install the libraries since there's a lot of confusion about the installation process and the guides do not provide much guidance to installation.

I've tried 4 different compilers and IDEs, but with no success.

Just asking. Is there a guide on how to compile the addr.cpp and possibly how to install Libbitcoin and Boost libraries? (The official guides of Libbitcoin and Boost are not that descriptive and a bit vague)

Maybe you guys know how to do it?

PS: The 2 python files from the book (ec-math.py and key-to-address-ecc-example.py) work fine, but as of now I am more proficient in C++, so It would be good to do ECC in C++
NeuroticFish
Legendary
*
Offline Offline

Activity: 3892
Merit: 6624


Looking for campaign manager? Contact icopress!


View Profile
January 03, 2022, 01:37:31 PM
Merited by Welsh (10), pooya87 (4), ABCbits (4), ranochigo (4), o_e_l_e_o (4), hugeblack (3), BlackHatCoiner (2)
 #2

I've spent some time to check this out and I've made it work. I'm a bit rusty with C++ since I do mostly C# for many years and I've obviously did it under Windoze, but here we are:

1. I've used Visual Studio 2017 Community edition, because that's what I already had.
2. I've copied (as zip) libbitcoin from git, unpacked, opened the .sln from vs2017 folder.
3. Removed libbitcoin-system-test project from our sln because it's for no use now.
4. Allowed the NuGet packages get downloaded (here you may have made 2 mistakes: a. using newer versions than required, b. not getting all of those packages)
5. Compiled only the library.
6. Modified the libbitcoin-system-examples project for proper paths
6.1: Properties/C-C++/General/Additional include dirs: added the exact full path to the include folder since I've noticed that it's not taken correctly into account as it was
6.2: Properties/Linker/General/Additional library directories: added the exact full path to the folder the library (libbitcoin-system.lib) was created/built.
7. Modified the main.cpp of libbitcoin-system-examples for our use (yes, I'm lazy), by pasting the content of addr.cpp over it
8. Did some corrections in order to compile it, I'll put the current code without comments:

Code:
#include <bitcoin/system.hpp>
BC_USE_LIBBITCOIN_MAIN
int bc::system::main(int argc, char* argv[])
{
bc::system::ec_secret decoded;
bc::system::decode_base16(decoded,
"038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776");

bc::system::wallet::ec_private secret(
decoded, bc::system::wallet::ec_private::mainnet_p2kh, true);

bc::system::wallet::ec_public public_key(secret);
std::cout << "Public key: " << public_key.encoded() << std::endl;

bc::system::data_chunk public_key_data;
public_key.to_data(public_key_data);
const auto hash = bc::system::bitcoin_short_hash(public_key_data);

bc::system::data_chunk unencoded_address;

unencoded_address.reserve(25);
unencoded_address.push_back(0);
bc::system::extend_data(unencoded_address, hash);
bc::system::append_checksum(unencoded_address);
assert(unencoded_address.size() == 25);
const std::string address = bc::system::encode_base58(unencoded_address);

std::cout << "Address: " << address << std::endl;
return 0;
}

I hope I didn't forget anything, it compiles now. If you want to run it, don't forget to set libbitcoin-system-examples as starting project if you want to run it step by step.
If something is unclear, shoot Wink
Good luck!

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1820
Merit: 7478


Top Crypto Casino


View Profile WWW
January 04, 2022, 08:12:29 AM
Last edit: January 04, 2022, 05:51:13 PM by NotATether
Merited by ABCbits (2)
 #3

On Unix you should be able to install Boost-dev[el] from your package manager (as Boost itself is a PITA to compile and install),  using the standard ./configure, make and make install process, and the includes and libs will be inside /usr/local usually.

Then the example code should be compilable under gcc by passing -lbitcoin -lboost_system (more boost libraries may have to be passed depending on what boost dependencies libbitcoin uses. For example, Boost filesystem has it's own shared library).

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
SamYezi (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 84


View Profile
January 04, 2022, 03:58:23 PM
 #4

I've spent some time to check this out and I've made it work. I'm a bit rusty with C++ since I do mostly C# for many years and I've obviously did it under Windoze, but here we are:

1. I've used Visual Studio 2017 Community edition, because that's what I already had.
2. I've copied (as zip) libbitcoin from git, unpacked, opened the .sln from vs2017 folder.
3. Removed libbitcoin-system-test project from our sln because it's for no use now.
4. Allowed the NuGet packages get downloaded (here you may have made 2 mistakes: a. using newer versions than required, b. not getting all of those packages)
5. Compiled only the library.
6. Modified the libbitcoin-system-examples project for proper paths
6.1: Properties/C-C++/General/Additional include dirs: added the exact full path to the include folder since I've noticed that it's not taken correctly into account as it was
6.2: Properties/Linker/General/Additional library directories: added the exact full path to the folder the library (libbitcoin-system.lib) was created/built.
7. Modified the main.cpp of libbitcoin-system-examples for our use (yes, I'm lazy), by pasting the content of addr.cpp over it
8. Did some corrections in order to compile it, I'll put the current code without comments:

Code:
#include <bitcoin/system.hpp>
BC_USE_LIBBITCOIN_MAIN
int bc::system::main(int argc, char* argv[])
{
bc::system::ec_secret decoded;
bc::system::decode_base16(decoded,
"038109007313a5807b2eccc082c8c3fbb988a973cacf1a7df9ce725c31b14776");

bc::system::wallet::ec_private secret(
decoded, bc::system::wallet::ec_private::mainnet_p2kh, true);

bc::system::wallet::ec_public public_key(secret);
std::cout << "Public key: " << public_key.encoded() << std::endl;

bc::system::data_chunk public_key_data;
public_key.to_data(public_key_data);
const auto hash = bc::system::bitcoin_short_hash(public_key_data);

bc::system::data_chunk unencoded_address;

unencoded_address.reserve(25);
unencoded_address.push_back(0);
bc::system::extend_data(unencoded_address, hash);
bc::system::append_checksum(unencoded_address);
assert(unencoded_address.size() == 25);
const std::string address = bc::system::encode_base58(unencoded_address);

std::cout << "Address: " << address << std::endl;
return 0;
}

I hope I didn't forget anything, it compiles now. If you want to run it, don't forget to set libbitcoin-system-examples as starting project if you want to run it step by step.
If something is unclear, shoot Wink
Good luck!



How did you compile the library? I haven't found (libbitcoin-system.lib) file. If the file appeared due to the result of compilation, then it would be nice to know How you've managed to compile it.
If it was gotten from different operations then the question would be: Is the file (libbitcoin-system.lib) really there? How did you find it?
NeuroticFish
Legendary
*
Offline Offline

Activity: 3892
Merit: 6624


Looking for campaign manager? Contact icopress!


View Profile
January 04, 2022, 04:06:05 PM
Merited by ABCbits (1)
 #5

How did you compile the library? I haven't found (libbitcoin-system.lib) file. If the file appeared due to the result of compilation, then it would be nice to know How you've managed to compile it.
If it was gotten from different operations then the question would be: Is the file (libbitcoin-system.lib) really there? How did you find it?

If you follow correctly the steps I've wrote, at step 5 I've compiled the library.

Visual Studio 2017 (Community version is for free) it will help you with loading from NuGet the correct dependent boost packages. Then building is straightforward.
Then the library will be placed into bin\Win32\Debug\v141\static\ (if built as StaticDebug) or  bin\Win32\Release\v141\static\ (if built as StaticRelease)

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
SamYezi (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 84


View Profile
January 05, 2022, 06:13:31 PM
 #6

How did you compile the library? I haven't found (libbitcoin-system.lib) file. If the file appeared due to the result of compilation, then it would be nice to know How you've managed to compile it.
If it was gotten from different operations then the question would be: Is the file (libbitcoin-system.lib) really there? How did you find it?

If you follow correctly the steps I've wrote, at step 5 I've compiled the library.

Visual Studio 2017 (Community version is for free) it will help you with loading from NuGet the correct dependent boost packages. Then building is straightforward.
Then the library will be placed into bin\Win32\Debug\v141\static\ (if built as StaticDebug) or  bin\Win32\Release\v141\static\ (if built as StaticRelease)

Yeah, I got that you've compiled the library in step 5. But, How exactly did you do this?
Like, I am using the same IDE and packages, and I've gone through the steps (1 to 4th), and I got stuck on step 5.

Did you just compile all the files in include folder and somehow grouped them into one file? Or maybe you've used cMake ?
https://www.youtube.com/watch?v=Rmc4L4sFFBE

Or You just created a new project (a .lib file project), included all the files in the project or just the files in include folder and then compiled it with StaticDebug/StaticRelease x64 configuration?
NeuroticFish
Legendary
*
Offline Offline

Activity: 3892
Merit: 6624


Looking for campaign manager? Contact icopress!


View Profile
January 05, 2022, 06:50:26 PM
Merited by Welsh (3), hugeblack (2), ABCbits (1)
 #7

Yeah, I got that you've compiled the library in step 5. But, How exactly did you do this?
Like, I am using the same IDE and packages, and I've gone through the steps (1 to 4th), and I got stuck on step 5.

Did you just compile all the files in include folder and somehow grouped them into one file? Or maybe you've used cMake ?
https://www.youtube.com/watch?v=Rmc4L4sFFBE

Or You just created a new project (a .lib file project), included all the files in the project or just the files in include folder and then compiled it with StaticDebug/StaticRelease x64 configuration?

As I wrote in step 2, I've opened the sln file. This means that I've used the existing solution, not CMAKE. I didn't create new project, nothing. It was all there, since the sln was made properly.
And I've compiled the lib project from the solution.
Something may not be installed properly in your Visual Studio if you try to compile on 64bit. I worked on 32bit (Win32) and was just fine.

I've made for you a super boring movie: https://we.tl/t-DdJRay5m6w  (it will expire in 7 days)
It has everything after I've opened builds\msvc\vs2017\libbitcoin-system.sln in Visual Studio until the point I obtained the library.
Unfortunately most of the movie is the slow compile, but maybe it helps.

If still doesn't work, please explain much better what problems/errors you get.


███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
SamYezi (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 84


View Profile
January 07, 2022, 10:34:18 AM
 #8

Yeah, I got that you've compiled the library in step 5. But, How exactly did you do this?
Like, I am using the same IDE and packages, and I've gone through the steps (1 to 4th), and I got stuck on step 5.

Did you just compile all the files in include folder and somehow grouped them into one file? Or maybe you've used cMake ?
https://www.youtube.com/watch?v=Rmc4L4sFFBE

Or You just created a new project (a .lib file project), included all the files in the project or just the files in include folder and then compiled it with StaticDebug/StaticRelease x64 configuration?

As I wrote in step 2, I've opened the sln file. This means that I've used the existing solution, not CMAKE. I didn't create new project, nothing. It was all there, since the sln was made properly.
And I've compiled the lib project from the solution.
Something may not be installed properly in your Visual Studio if you try to compile on 64bit. I worked on 32bit (Win32) and was just fine.

I've made for you a super boring movie: https://we.tl/t-DdJRay5m6w  (it will expire in 7 days)
It has everything after I've opened builds\msvc\vs2017\libbitcoin-system.sln in Visual Studio until the point I obtained the library.
Unfortunately, most of the movie is the slow compile, but maybe it helps.

If still doesn't work, please explain much better what problems/errors you get.





On step 8:
Basically done all the steps you've mentioned and got stock on the final one

Picture 1
https://i.ibb.co/41LCP2G/Capture1.jpg
Picture 2
https://i.ibb.co/DL1j8WP/Capture2.jpg

Links to images:

https://i.ibb.co/41LCP2G/Capture1.jpg
https://i.ibb.co/DL1j8WP/Capture2.jpg

It doesn't recognize the boost package I guess, even though it is installed
Picture 3
https://i.ibb.co/1z7m3p5/Capture3.jpg
Link: https://i.ibb.co/1z7m3p5/Capture3.jpg

Should I just Update the packages?

Picture 4
https://i.ibb.co/C25j0xb/Capture4.jpg
Link: https://i.ibb.co/C25j0xb/Capture4.jpg

Sorry, for the late respose
NeuroticFish
Legendary
*
Offline Offline

Activity: 3892
Merit: 6624


Looking for campaign manager? Contact icopress!


View Profile
January 07, 2022, 10:56:42 AM
Merited by Welsh (3), SamYezi (3), ABCbits (2)
 #9

Should I just Update the packages?

No, please don't update to newer boost, I don't want new surprises.

But I don't know directly what is wrong - you didn't do rebuild-all for the whole project, but since you've build the lib you should be fine on that.
Now I don't know... you may have done some extra steps, from setting something extra to moving some folders, or boots was not retrieved correctly, - I don't know right now.
I will try to take a proper look at some point later. Hopefully I'll get to reproduce your error and give better hints.

However, you seem to be on the right track, at least some steps closer to result.

I'll come back to this.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
NotATether
Legendary
*
Offline Offline

Activity: 1820
Merit: 7478


Top Crypto Casino


View Profile WWW
January 07, 2022, 04:17:26 PM
 #10

Should I just Update the packages?

No, please don't update to newer boost, I don't want new surprises.

Well in this case you have to upgrade to a newer Boost version because the first screenshot posted in OP's reply to yours states (https://i.ibb.co/41LCP2G/Capture1.jpg)

Code:
Fatal Error: boost/functional/hash_fwd.hpp: no such file or directory

And Boost.Functional was only added in version 1.72, released in December 2019. It is very recent. (I have no idea what Boost version OP has).

I'm not going to comment about the second screenshot though - sometimes VS does not find the header locations after you manually specify them in some project setting somewhere which causes complaints in the Problems Window. But as long as the MSBuild compiler can find the headers then it should be OK.



Also, it is not possible to install Boost by simply copying its header files. That might work for some header-only projects but Boost has a ton of source files that need to be compiled. I recommend simply installing/updating the NuGet package for Boost instead.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
NeuroticFish
Legendary
*
Offline Offline

Activity: 3892
Merit: 6624


Looking for campaign manager? Contact icopress!


View Profile
January 07, 2022, 04:33:24 PM
Last edit: January 07, 2022, 05:33:46 PM by NeuroticFish
Merited by SamYezi (10), Welsh (8), ABCbits (6)
 #11

Well in this case you have to upgrade to a newer Boost version because the first screenshot posted in OP's reply to yours states (https://i.ibb.co/41LCP2G/Capture1.jpg)

Code:
Fatal Error: boost/functional/hash_fwd.hpp: no such file or directory

And Boost.Functional was only added in version 1.72, released in December 2019. It is very recent. (I have no idea what Boost version OP has).

I'm not going to comment about the second screenshot though - sometimes VS does not find the header locations after you manually specify them in some project setting somewhere which causes complaints in the Problems Window. But as long as the MSBuild compiler can find the headers then it should be OK.



Also, it is not possible to install Boost by simply copying its header files. That might work for some header-only projects but Boost has a ton of source files that need to be compiled. I recommend simply installing/updating the NuGet package for Boost instead.

Actually no. If OP did get the boost libraries from the sln/project, he should have 1.72.0.0 and upgrading to 1.78 is unnecessary.
And I really hope that OP did as he claims he did, hence getting the NuGet packages, so he should have correct and complete boost libraries.
You can look into builds\msvc\vs2017\libbitcoin-system\libbitcoin-system.vcxproj  and builds\msvc\vs2017\libbitcoin-system-examples\libbitcoin-system-examples.vcxproj, and you'll see boost 1.72 is referred.

That error should not happen since the NuGet package should have set the correct paths and the files should be there. That's why I'm so confused why that error comes, especially since OP said he did compile the lib already (Libbitcoin).

---
I fear he may have removed some dependencies or something... I've installed VS onto a fresh VM so I can see what could have gone wrong, but it's slooooow...


Edit: Adding here the updates

OP, I couldn't find a definitely sure thing that went wrong on your side.
I don't know if the example project no longer depends on the lib project, I don't know if the path is not too long.

I've installed Visual Studio onto a pretty much fresh virtual machine, I made one more movie for you.
One thing I'd like to ask you: please don't work on desktop. Make a C:\Temp and work there if you don't have a better place.

The movie is: https://we.tl/t-DuKKxSoA9U
Some parts I've skipped but it's still awfully long since the machine was slow. You may want to increase the speed at playing. You may want to start looking from minute 18:10 or even 20:00.
You may want to start with fresh Libbitcoin, since I don't know what's broken.

███████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████

███████████████████████
.
BC.GAME
▄▄▀▀▀▀▀▀▀▄▄
▄▀▀░▄██▀░▀██▄░▀▀▄
▄▀░▐▀▄░▀░░▀░░▀░▄▀▌░▀▄
▄▀▄█▐░▀▄▀▀▀▀▀▄▀░▌█▄▀▄
▄▀░▀░░█░▄███████▄░█░░▀░▀▄
█░█░▀░█████████████░▀░█░█
█░██░▀█▀▀█▄▄█▀▀█▀░██░█
█░█▀██░█▀▀██▀▀█░██▀█░█
▀▄▀██░░░▀▀▄▌▐▄▀▀░░░██▀▄▀
▀▄▀██░░▄░▀▄█▄▀░▄░░██▀▄▀
▀▄░▀█░▄▄▄░▀░▄▄▄░█▀░▄▀
▀▄▄▀▀███▄███▀▀▄▄▀
██████▄▄▄▄▄▄▄██████
.
..CASINO....SPORTS....RACING..


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
SamYezi (OP)
Newbie
*
Offline Offline

Activity: 28
Merit: 84


View Profile
January 08, 2022, 01:19:08 PM
 #12

Well in this case you have to upgrade to a newer Boost version because the first screenshot posted in OP's reply to yours states (https://i.ibb.co/41LCP2G/Capture1.jpg)

Code:
Fatal Error: boost/functional/hash_fwd.hpp: no such file or directory

And Boost.Functional was only added in version 1.72, released in December 2019. It is very recent. (I have no idea what Boost version OP has).

I'm not going to comment about the second screenshot though - sometimes VS does not find the header locations after you manually specify them in some project setting somewhere which causes complaints in the Problems Window. But as long as the MSBuild compiler can find the headers then it should be OK.



Also, it is not possible to install Boost by simply copying its header files. That might work for some header-only projects but Boost has a ton of source files that need to be compiled. I recommend simply installing/updating the NuGet package for Boost instead.

Actually no. If OP did get the boost libraries from the sln/project, he should have 1.72.0.0 and upgrading to 1.78 is unnecessary.
And I really hope that OP did as he claims he did, hence getting the NuGet packages, so he should have correct and complete boost libraries.
You can look into builds\msvc\vs2017\libbitcoin-system\libbitcoin-system.vcxproj  and builds\msvc\vs2017\libbitcoin-system-examples\libbitcoin-system-examples.vcxproj, and you'll see boost 1.72 is referred.

That error should not happen since the NuGet package should have set the correct paths and the files should be there. That's why I'm so confused why that error comes, especially since OP said he did compile the lib already (Libbitcoin).

---
I fear he may have removed some dependencies or something... I've installed VS onto a fresh VM so I can see what could have gone wrong, but it's slooooow...


Edit: Adding here the updates

OP, I couldn't find a definitely sure thing that went wrong on your side.
I don't know if the example project no longer depends on the lib project, I don't know if the path is not too long.

I've installed Visual Studio onto a pretty much fresh virtual machine, I made one more movie for you.
One thing I'd like to ask you: please don't work on desktop. Make a C:\Temp and work there if you don't have a better place.

The movie is: https://we.tl/t-DuKKxSoA9U
Some parts I've skipped but it's still awfully long since the machine was slow. You may want to increase the speed at playing. You may want to start looking from minute 18:10 or even 20:00.
You may want to start with fresh Libbitcoin, since I don't know what's broken.



I did, all the step , Just like in 2 movies that You've shared. Compiled the library (system) project and (examples) project, and compiled and run the main.cpp
and It worked!

https://i.ibb.co/54W6jrn/Capture11.jpg
https://i.ibb.co/QDLFwN4/Capture22.jpg

Although there are still messages that some file is not found.....
My obvious mistake, in this case, was that I forgot to compile the "Examples" project.

Thank you for your time and help, I appreciate that
but it looks like it would be better to just learn elliptic curves with Python and the book "Programming Bitcoin" by Jimmy Song Grin Grin Grin Cool
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!