Giter Site home page Giter Site logo

q9f / rbsecp256k1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from etscrivner/rbsecp256k1

0.0 1.0 0.0 773 KB

Compiled Ruby wrapper around libsecp256k1 for secp256k1 ECDSA.

License: The Unlicense

Ruby 37.71% C 60.86% Makefile 1.02% Dockerfile 0.41%

rbsecp256k1's Introduction

rbsecp256k1

Build Status Gem Version Maintainability

Native extension gem for secp256k1 ECDSA. Wraps libsecp256k1. In rbsecp256k1 3.0.0 and later libsecp256k1 is bundled with the gem.

Why wrap libsecp256k1?

libsecp256k1 is an extremely optimized implementation of public key derivation, signing, and verification with the secp256k1 elliptic curve. It comes with its own set of benchmarks, but from benchmarking done by Peter Wuille it is ~4.9x faster than the OpenSSL implementation of the same curve. It is the only library that provides constant time signing of this curve and has been deployed as part of Bitcoin since v0.10.0

Natively wrapping the library in an extension gem means users don't have to worry about compiling or locating the library, unlike many FFI based gems.

Installation

The simplest installation:

gem install rbsecp256k1

Requirements

If you want to use your system version of libsecp256k1 rather than the bundled version use the --with-system-libraries flag:

gem install rbsecp256k1 -- --with-system-libraries

Linux

Install the dependencies for building libsecp256k1 and this library:

sudo apt-get install build-essential automake pkg-config libtool \
  libffi-dev libssl-dev libgmp-dev python-dev

NOTE: If you have installed libsecp256k1 but the gem cannot find it. Ensure you have run ldconfig so that your library load paths have been updated.

macOS

Dependencies for building libsecp256k1 and this library:

brew install openssl libtool pkg-config gmp libffi

Features

See rbsecp256k1 documentation for examples and complete list of supported functionality.

Development

Cloning

To clone the repository and its submodules you'll need to the following:

git clone [email protected]:etscrivner/rbsecp256k1.git

Setup

Development is largely facilitated by a makefile. After download you should run the following command to set up your local environment:

make setup

Compiling Extension

To compile the extension gem run the following (this is required to run tests):

make build

Running Tests

make test

To test with recovery functionality disabled run:

make test WITH_RECOVERY=0

To test with ECDH functionality disabled run:

make test WITH_ECDH=0

To test with both disabled run:

make test WITH_RECOVERY=0 WITH_ECDH=0

Testing for memory leaks with valgrind:

make memcheck

Building Gem

make gem

Installing Gem Locally

To install the gem locally and verify builds you can run:

make install

Uninstall Gem Locally

You can similarly uninstall the local gem by running the following:

make uninstall

Cleaning Up

To clean up and do a fresh build:

make clean

Running YARD Documentation Server

To run the YARD documentation server:

make docserver

rbsecp256k1's People

Contributors

etscrivner avatar se3000 avatar

Watchers

 avatar

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.