GithubHelp home page GithubHelp logo

Comments (9)

apoelstra avatar apoelstra commented on June 17, 2024

There was a recent breaking API change in libsecp256k1 which elements is not yet updated to work with.

For now, in the libsecp256k1 directory, you can try doing git checkout 4c63780 to return to a commit before the API break.

from elements.

c-christie avatar c-christie commented on June 17, 2024

I received the exact same error no matter which commit I was checking out. Here's the error replayed again:

$ make CXXFLAGS="-I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static"
g++ -O2 -Wall -I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static -I. contracthashtool.c stolen.cpp uint256.cpp crypto/ripemd160.cpp crypto/sha2.cpp -o contracthashtool -lsecp256k1
contracthashtool.c: In function ‘int main(int, char**)’:
contracthashtool.c:246:75: error: cannot convert ‘unsigned char*’ to ‘secp256k1_pubkey_t*’ for argument ‘2’ to ‘int secp256k1_ec_pubkey_tweak_add(const secp256k1_context_t*, secp256k1_pubkey_t*, const unsigned char*)’
     if (secp256k1_ec_pubkey_tweak_add(secp256k1_ctx, keys_work[i], 33, res) == 0) {
                                                                           ^
contracthashtool.c:290:67: error: cannot convert ‘unsigned char*’ to ‘secp256k1_pubkey_t*’ for argument ‘2’ to ‘int secp256k1_ec_pubkey_create(const secp256k1_context_t*, secp256k1_pubkey_t*, const unsigned char*)’
   if (secp256k1_ec_pubkey_create(secp256k1_ctx, pub, &len, priv, 1) != 1 || len != 33)
                                                                   ^
make: *** [all] Error 1

Here's my terminal history:

 2959  git checkout 4c63780
 2960  cd ..
 2961  cd contracthashtool
 2962  make CXXFLAGS="-I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static"
 2963  history
 2964  cd ../secp256k1
 2965  ls
 2966  git log
 2967  git checkout 3e6f1e20dc126fa20163f4e0f48cb6ab6f1524f7
 2968  cd ..
 2969  cd contracthashtool
 2970  make CXXFLAGS="-I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static"
 2971  cd ..
 2972  cd secp256k1
 2973  ls
 2974  git log
 2975  git checkout a83bb4806818e9132d99911312fcf70add261e11
 2976  cd ..
 2977  cd contracthashtool
 2978  make CXXFLAGS="-I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static"

Is anyone able to replicate this error?

compilation info:

$ make -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

# vagrant at vagrant-ubuntu-trusty-64 in ~/local/contracthashtool on git:master o [3:39:53]
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)

from elements.

c-christie avatar c-christie commented on June 17, 2024

Upgrading to a newer version of Ubuntu (14.10)...

from elements.

droark avatar droark commented on June 17, 2024

Hello. Just FYI, the directions @apoelstra gave work fine for me under Ubuntu 15.04. I can't comment on earlier versions of Ubuntu.

from elements.

c-christie avatar c-christie commented on June 17, 2024

I tried a new vagrant box with Ubuntu 15.04, I made it successfully to the same step, and I'm now receiving the same error:

vagrant@vagrant-ubuntu-vivid-64:~/local$ cd contracthashtool/
vagrant@vagrant-ubuntu-vivid-64:~/local/contracthashtool$   make CXXFLAGS="-I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static"
g++ -O2 -Wall -I../secp256k1/install/usr/local/include -L../secp256k1/install/usr/local/lib -static -I. contracthashtool.c stolen.cpp uint256.cpp crypto/ripemd160.cpp crypto/sha2.cpp -o contracthashtool -lsecp256k1
contracthashtool.c: In function ‘int main(int, char**)’:
contracthashtool.c:246:75: error: cannot convert ‘unsigned char*’ to ‘secp256k1_pubkey_t*’ for argument ‘2’ to ‘int secp256k1_ec_pubkey_tweak_add(const secp256k1_context_t*, secp256k1_pubkey_t*, const unsigned char*)’
     if (secp256k1_ec_pubkey_tweak_add(secp256k1_ctx, keys_work[i], 33, res) == 0) {
                                                                           ^
contracthashtool.c:290:67: error: cannot convert ‘unsigned char*’ to ‘secp256k1_pubkey_t*’ for argument ‘2’ to ‘int secp256k1_ec_pubkey_create(const secp256k1_context_t*, secp256k1_pubkey_t*, const unsigned char*)’
   if (secp256k1_ec_pubkey_create(secp256k1_ctx, pub, &len, priv, 1) != 1 || len != 33)
                                                                   ^
Makefile:2: recipe for target 'all' failed
make: *** [all] Error 1
vagrant@vagrant-ubuntu-vivid-64:~/local/contracthashtool$

@TheBlueMatt Is the error I'm experiencing possibly something to do with an invalid key?
https://github.com/Blockstream/contracthashtool/blob/master/contracthashtool.c#L290

from elements.

sipa avatar sipa commented on June 17, 2024

No, you're using a too new version of libsecp256k1.

See Blockstream/contracthashtool#6.

from elements.

sipa avatar sipa commented on June 17, 2024

Re-reading your previous post about this: just checking out an older version won't make a difference. You also need to compile it and possibly install it before contracthashtool will find/use it.

from elements.

c-christie avatar c-christie commented on June 17, 2024

Oh, I can't believe I didn't compile! It's working now. Thanks @sipa for helping to resolve this!
For anyone who may run into this later: I needed to do what @apoelstra suggested, but don't forget to recompile :)

from elements.

TheBlueMatt avatar TheBlueMatt commented on June 17, 2024

Blockstream/contracthashtool#6 was merged, so this should no longer be an issue, and the instructions as posted should work again.

from elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.