Coder Social home page Coder Social logo

bitcoin_foundation's Introduction

Bitcoin Protocol Foundation Library

A collection of Bitcoin crates implementing the foundations of the Bitcoin protocol.

These are alternatives to the bitcoin crate or experiments with vision to be integrated into the bitcoin crate.

bitcoin_foundation's People

Contributors

crisdut avatar dr-orlovsky avatar kixunil avatar zoedberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

bitcoin_foundation's Issues

`unsafe` optimizations

I wonder if it'd be useful to have a feature unsafe-optimizations that turns on unsafe code with the only intention to optimize. Currently the candidate is using [MaybeUninit<u8>; 65] inside SerializedPublicKey. Relies on correct impl in secp256k1 ofc but that one already calls memset on the whole array ๐Ÿ™ˆ

Complete arithmetic implementation for bitcoin_key types

Definition Operation Fails if Trait Return type
neg: Scalar -> Scalar x -> (0 - x) mod n - Neg Self
checked_add: Scalar, Scalar -> Scalar x, y -> (x + z) x + z > n n/a Result<Self, OverflowError>
checked_sub: Scalar, Scalar -> Scalar x, y -> (x + (0 - y) mod n) y > x n/a Result<Self, OverflowError>
checked_mul: Scalar, Scalar -> Scalar x, y -> add(x, x) y times x * y > n n/a Result<Self, OverflowError>
neg: Scalar -> Scalar P -> โˆž + P - Neg Self
checked_add: Point, Point -> Point P, Q -> P + Q Q = -P n/a Result<Self, PointAtInfinity>
checked_sub: Point, Point -> Point P, Q -> P + โˆž + Q Q = P n/a Result<Self, PointAtInfinity>
checked_add_exp: Point, Scalar -> Point P, y -> P + yG yG = -P n/a Result<Self, PointAtInfinity>
checked_sub_exp: Point, Scalar -> Point P, y -> P + โˆž + yG yG = P n/a Result<Self, PointAtInfinity>
mul: Point, Scalar -> Point P, y -> yP -1 Mul<Self> Self

where

  • x, y, z are scalars with the value up to n,
  • n is a order of the secp256k1 generator point G,
  • P, Q, R are points on the elliptic curve secp256k1 generated from G via xG, yG and zG multiplication.
  • โˆž is a point on elliptic curve at infinity, corresponding to G * 0

Footnotes

  1. allows overflow over G order โ†ฉ

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.