Skip to content

Instantly share code, notes, and snippets.

@oregonisaac
Last active February 21, 2019 15:03
Show Gist options
  • Save oregonisaac/e41826e171b53826ff869cab75d8ed0b to your computer and use it in GitHub Desktop.
Save oregonisaac/e41826e171b53826ff869cab75d8ed0b to your computer and use it in GitHub Desktop.
Requirements for an open source JS library for Decred

Decred Open-Source JS Library Requirements

Basic Coding Requirements

  • Typescript - See https://www.typescriptlang.org/docs/home.html for details
  • Follow Decred Code Contributions 4 to 6 - See https://github.com/decred/dcrd/blob/master/docs/code_contribution_guidelines.md for details. Summary/Outline:
    • 4.1 Share Early, Share Often (Announce plans, share iterations as developed)
    • 4.2 Ensure Adequate Testing (Testing should reflect that this is financial software)
    • 4.3 Document and Comment (EG. functions should be commented with intended purpose and assumptions)
    • 4.4 Git Commit per Message Model (clean commit history with well-formed commit messages, see example in link)
    • 5.1 Follow Code Review (establish maintainers/owners and ensure peer review, see specifics in link)
    • 5.2 Rework Code (ensure all rework requests from code review are completed)
    • 5.3 Code Acceptance (integrate accepted code with the master to keep a clean commit history rather than merge commits)
    • 6.1 Contribution Checklist - Follow all steps in code contribution checklist (replace the GO step with Typescript above)
    • 6.1 Licensing of Contributions - All contributions must be licensed with the ISC license: https://github.com/decred/dcrd/blob/master/LICENSE

Functionality Requirements

  • Create and sign regular transactions.
  • Create and sign stake transactions.
  • Understand/Generate addresses.
  • Work with p2pkh, p2sh and multisig scripts.
  • Clean, and versioned, API for consumers.
@paullinator
Copy link

I would add that the library should be platform agnostic and work under browsers and nodejs. Ideally, the library should optionally accept some crypto routines as injections to allow the wallet to provide accelerated versions of those routines. ie secp256k1, sha256, pbkdf2, and random(). All of these should accept async function injections as native code accelerated functions have to be async in most implementations.

In addition to just creating and signing transactions, I would add parsing of transactions as well.

Also, since most wallets use pre-existing bitcoin libraries for all transaction parsing and creation, I would make sure that the part of Decred that differs from bitcoin be usable as a simple standalone module. ie. some currencies such as Groestlecoin differ by only the hashing algo used for addresses and transaction creation. That hashing algo is made available as a standalone function vs having to use an entire Groestlecoin library to create a tx.

@xaur
Copy link

xaur commented Feb 18, 2019

part of Decred that differs from bitcoin be usable as a simple standalone module

Given that those pre-existing bitcoin libraries have enough hooks to plug Decred specifics.

@xaur
Copy link

xaur commented Feb 21, 2019

JS library is tracked in decredcommunity/issues#115 where I copied the above comment from Paul.

edit: note that issue is better for discussion as it allows to follow it via subscription, can be labeled, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment