Giter Site home page Giter Site logo

go-secp256k1's Introduction

secp256k1 bindings for Go

General info

The Go API mirrors the API of the C implementation. Therefore, please consult c-secp256k1/include/secp256k1.h for documentation. Going forward I plan to implement a new API that is more aligned with the APIs from Go's standard lib crypto packages. Then, it makes more sense to add a standalone documentation, and hopefully breaking changes in the C implementation can be abstracted away.

How to get and build

go get -d github.com/toxeus/go-secp256k1
cd $GOPATH/src/github.com/toxeus/go-secp256k1
git submodule update --init # not needed for Go >= 1.6
cd c-secp256k1
./autogen.sh && ./configure && make
cd ..
go install

How to update

cd $GOPATH/src/github.com/toxeus/go-secp256k1
git submodule update
cd c-secp256k1
make distclean && ./autogen.sh && ./configure && make
cd ..
go clean && go install

go-secp256k1's People

Contributors

guilhermelimak avatar murrekatt avatar toxeus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

go-secp256k1's Issues

clang error

Thanks for creating this wrapper!
I'm sure this has to do with my lack of understanding in C but when ever I attempt to build my package I receive the following error:

go build server/cmd/main.go                                                                                                                                                                                                          13:08
# github.com/btccom/secp256k1-go/secp256k1
clang: error: no such file or directory: '$GOPATH/src/github.com/btccom/secp256k1-go/secp256k1/c-secp256k1/.libs/libsecp256k1.a'

I have followed both the install steps and update steps but seeing the same issue.

Are there any other dependencies or steps I should complete?

binary secp256k1 library fail to work

pkg info secp256k1-0.1.20171222
secp256k1-0.1.20171222
Name : secp256k1
Version : 0.1.20171222
Installed on : Tue Sep 18 03:26:40 2018 CST
Origin : math/secp256k1
Architecture : FreeBSD:11:amd64
Prefix : /usr/local
Categories : security math java
Licenses : MIT
Maintainer : [email protected]
WWW : https://github.com/bitcoin-core/secp256k1
Comment : Optimized C library for EC operations on curve secp256k1
Options :
GMP : on
JAVA : on
Shared Libs required:
libgmp.so.10
Shared Libs provided:
libsecp256k1.so.0
Annotations :
FreeBSD_version: 1101001
repo_type : binary
repository : FreeBSD
Flat size : 749KiB
Description :
An optimized C library for EC operations on curve secp256k1.

This library is a work in progress and is being used to research best practices.
Use at your own risk.

Features:

  • secp256k1 ECDSA signing/verification and key generation.
  • Adding/multiplying private/public keys.
  • Serialization/parsing of private keys, public keys, signatures.
  • Constant time, constant memory access signing and pubkey generation.
  • Derandomized DSA (via RFC6979 or with a caller provided function.)
  • Very efficient implementation.

WWW: https://github.com/bitcoin-core/secp256k1


I installed this binary package (both .so and .a) but it won't work with .go code.
The original C code won't compile with my FreeBSD system.
Any idea how to fix this?

go run keys.go 
# github.com/toxeus/go-secp256k1
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:19:47: could not determine kind of name for C.SECP256K1_START_SIGN
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:19:20: could not determine kind of name for C.SECP256K1_START_VERIFY
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:35:13: could not determine kind of name for C.secp256k1_ec_pubkey_create
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:48:13: could not determine kind of name for C.secp256k1_ec_pubkey_verify
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:43:13: could not determine kind of name for C.secp256k1_ec_seckey_verify
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:55:13: could not determine kind of name for C.secp256k1_ecdsa_sign
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:65:13: could not determine kind of name for C.secp256k1_ecdsa_verify
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:19:2: could not determine kind of name for C.secp256k1_start
../go/src/github.com/toxeus/go-secp256k1/secp256k1.go:23:2: could not determine kind of name for C.secp256k1_stop

I could not Build

Hello,
everything works fine for me until the very last command of the build:

dyn905-164:go-secp256k1 samzan$ go install .
# github.com/samzan/go-secp256k1
clang: error: no such file or directory: '../../../github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a'

I looked around and understand the pb might not be specific to this project, yet I thought perhaps someone ran into the same difficulty and found a solution to it?

Cheers
(I m a 1st yr CS student)

clang failed

Hey, thanks for the great package! I'm having an issue and am not that familiar with c. Here's what I get when I run a project that relies on yours. I believe I've installed correctly, but maybe not.

/Users/adamhanna/.gvm/gos/go1.9.2/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
duplicate symbol _secp256k1_ec_seckey_verify in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ecdsa_verify in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_nonce_function_default in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ecdsa_sign in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ec_privkey_tweak_mul in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ec_pubkey_tweak_mul in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ec_pubkey_create in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ec_privkey_tweak_add in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_ec_pubkey_tweak_add in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
duplicate symbol _secp256k1_nonce_function_rfc6979 in:
    /var/folders/58/kcjf330j6lj2vpc15phlcm_80000gn/T/go-link-660121775/000002.o
    /Users/adamhanna/Desktop/goLang/src/github.com/toxeus/go-secp256k1/c-secp256k1/.libs/libsecp256k1.a(libsecp256k1_la-secp256k1.o)
ld: 10 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

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.