Code Monkey home page Code Monkey logo

ecsol's Introduction

ecsol

This is an implementation of elliptic curve secp256k in 100% written in solidity.

Benchmark

Calculate a public key from a private key takes about 800,000 gas.

How to use.

The contract mainly has two methods:

function publicKey(uint256 privKey) constant
    returns(uint256 qx, uint256 qy)

and

function deriveKey(uint256 privKey, uint256 pubX, uint256 pubY) constant
    returns(uint256 qx, uint256 qy)

A deployed version of the library can be found here: 0x28dcd428e8125990f9e5fe1b82db0e3ed240711c

var ecsolAbi = '[{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jAdd","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jSub","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jMul","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_jDiv","outputs":[{"name":"x3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"privKey","type":"uint256"}],"name":"publicKey","outputs":[{"name":"qx","type":"uint256"},{"name":"qy","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"a","type":"uint256"}],"name":"_inverse","outputs":[{"name":"invA","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"d","type":"uint256"},{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"}],"name":"_ecMul","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"},{"name":"x2","type":"uint256"},{"name":"y2","type":"uint256"},{"name":"z2","type":"uint256"}],"name":"_ecAdd","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"privKey","type":"uint256"},{"name":"pubX","type":"uint256"},{"name":"pubY","type":"uint256"}],"name":"deriveKey","outputs":[{"name":"qx","type":"uint256"},{"name":"qy","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"x1","type":"uint256"},{"name":"y1","type":"uint256"},{"name":"z1","type":"uint256"}],"name":"_ecDouble","outputs":[{"name":"x3","type":"uint256"},{"name":"y3","type":"uint256"},{"name":"z3","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"type":"constructor"}]

var ecsol = eth.contract(ecsolAbi).at('0x28dcd428e8125990f9e5fe1b82db0e3ed240711c')

ecsol's People

Contributors

fulldecent avatar jbaylina 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.