Giter Club home page Giter Club logo

keyring's Introduction

Keyring

Warning - This library is new and changing rapidly.

Keyring is a collection of javascript libraries for working with Bitcoin(BSV) transactions and wallets.

Libraries

BSV - The BSV library loads the most commonly needed modules to get you started working with the BSV chain.

Transaction - The Transaction library handles transaction parsing, creation, signing, and more.

Util - The Util package contains helpers shared by the other libraries.

Plugins

The Keyring library has several plugins and more will be added over time. Plugins provide convenient access to extra functionality that you can access directly from your Transaction class instance. Current plugins include:

Validation - Adds a validate method to the Transaction instance to verify if the transaction is valid before sending it to a blockchain node.

CBOR - Adds a convenience method to insert CBOR encoded data into a transaction.

MsgPack - Adds a convenience method to insert msgpack encoded data into a transaction.

TXO - Adds TXO conversion capabilities to the Keyring Transaction class.

All plugins are in the keyring/packages directory; each one ends in -plugin. There is example usage code in each plugin readme file. You simply require the plugin npm package separately and then register it using Transaction.use() before instantiating a new Transaction instance variable.

Contributing

All contributions of code, feedback, and feature requests are welcome. We will be using github issues to track work and will monitor it closely. Right now keyring is bare bones, but we have a nice base to build the dev tools bitcoin needs.

keyring's People

Contributors

hexorx avatar ford152 avatar dependabot[bot] avatar xineman avatar

Stargazers

Bruce Bjorklund avatar core44 avatar  avatar Ryan Wold avatar David Case avatar Solid Sne8ke avatar Mateus Lopes avatar  avatar xhliu avatar MarkT avatar  avatar Rohan Sharan avatar Joshua Williams avatar  avatar  avatar KJ avatar  avatar LJZN avatar Chris Shepherd avatar Owen Kellogg avatar syn·fo·naut avatar fjccoin avatar Biznatch Enterprises avatar Dave Foderick avatar  avatar Oaker avatar Josef Pospíšil avatar Mr. Z avatar  avatar  avatar klar avatar Joonyeong Park avatar Kervin avatar

Watchers

 avatar Dan avatar James Cloos avatar Chris Shepherd avatar Joonyeong Park avatar  avatar Rohan Sharan avatar  avatar

keyring's Issues

Exception when trying to validate an existing transaction

Using the validation plugin to validate an existing transaction that is already on-chain results in an exception.

/..../node_modules/bn.js/lib/bn.js:904
    if (num.negative !== 0 && this.negative === 0) {
            ^
TypeError: Cannot read property 'negative' of undefined
    at BN.add (/..../node_modules/bn.js/lib/bn.js:904:13)

This is because the existing transaction doesn't have the actual amounts included in the inputs, as they are derived on the chain from the outputs. Consider providing a clearer error message or otherwise not allowing an existing transaction to be validated in this way.

private key length is invalid

I am experimenting with using keyring instead of the standard BSV package, but I am getting an error, private key length is invalid when signing a transaction.

The private key being used is derived like with bsv.HDPrivateKey like so
pk.deriveChild(nonce).privateKey

The code runs perfectly fine when using
const Transaction = bsv.Transaction

and I get the error when swapping out the line above with
const Transaction = require('@keyring/transaction');

Full error:

RangeError: private key length is invalid at Object.publicKey (/node_modules/ecc-tools/lib/index.js:183:24) at Input.signableBy (/node_modules/@keyring/transaction/lib/input.js:57:54)

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.