10gic / vanitygen-plusplus

A vanity address generator for BTC, ETH, LTC, TRX and 100+ more crypto currencies.
GNU Affero General Public License v3.0
248 stars 90 forks source link

Nix-build uses an older version of openssl #53

Closed SatoshiGuacamole closed 1 year ago

SatoshiGuacamole commented 1 year ago

I've installed the openssl v3 package on my NIX operating system.

When I initiate the nix-build command an older version (v1) of openssl is pulled and the previously installed version of openssl is not being used.

Because of this problem it is currently not possible to generate BTC addresses in the p2wpkh or p2tr formats on NIX environments.

pmarreck commented 1 year ago

@SatoshiGuacamole It's always best to run in a "pure" environment (so that only the build inputs specifically specified in the default.nix or shell.nix are available to the build, and NOT anything else installed into your OS itself). Try running nix-shell --pure first before running nix-build, and it should automatically use the openssl version specified in the default.nix, which is a v3. cc @10gic

10gic commented 1 year ago

@pmarreck Thanks for the additional information in pull request https://github.com/10gic/vanitygen-plusplus/pull/48

@SatoshiGuacamole Now, I can use openssl v3. Here is my steps:

$ ldd result/bin/vanitygen++        # Check the linked openssl version
    ......
    libcrypto.so.1.1 => /nix/store/f7jpwsi3yiy98pjv6m06m5j2hxds84cm-openssl-1.1.1j/lib/libcrypto.so.1.1 (0x00007fb3bd6ab000)
    ......

There are three channels, 22.05: openssl 1.1.1s / 22.11: openssl 3.0.7 / unstable: openssl 3.0.7, make sure I'm not using channel 22.05.

$ nix-channel --list                # Listing current channels
nixpkgs https://nixos.org/channels/nixpkgs-unstable
$ nix-channel --update              # Updating all channels
$ nix-build                         # Build it
$ ldd result/bin/vanitygen++        # Check the linked openssl version (now, it use 3.0.7)
    ......
    libcrypto.so.3 => /nix/store/zpwhl35d2dkj0p4bli5wp6sw1vfsyab5-openssl-3.0.7/lib/libcrypto.so.3 (0x00007f78186c3000)

I think the most critical step is to run nix-channel --update.

pmarreck commented 1 year ago

ah, nice! yes, I should have done this as a flake; then that wouldn't have been a problem. My channels are always updated because I run on NixOS and am always updating the system as if it was a rolling release, lol. Maybe I will submit a PR for the flakes version of this soon. ;)