decredcommunity / issues

Decred community issue tracker
5 stars 0 forks source link

JavaScript library #115

Open xaur opened 5 years ago

xaur commented 5 years ago

JavaScript library was asked about multiple times.

Most recent discussion was about Edge Wallet, ElectrumX and a missing JS lib. What is needed is "address stuff and signature stuff".

Requirements:

Discussions:

xaur commented 5 years ago

@jzbz feel free to drop any details here, I'll add them to the issue description.

xaur commented 5 years ago

Hey @oregonisaac I think about adding contents of your gist to this issue, but wonder where did you take the first part from (Basic Coding Requirements)?

oregonisaac commented 5 years ago

I looked up articles on best practices and references one Typescript the site Dave referenced plus a number of JS best practice sites (did not make a reference list).

Would be good to verify with a few folks. I think this is what Dave was asking for - https://www.typescriptlang.org

jzbz commented 5 years ago

Yeah that's the TypeScript Dave had asked for. Might also make sense to include this: https://github.com/decred/dcrd/blob/master/docs/code_contribution_guidelines.md

All the parts from section 4 onward (not relating to Go) would still apply.

oregonisaac commented 5 years ago

I’ll modify the gist accordingly.

oregonisaac commented 5 years ago

Updated, I might make sense to fork the Go based contribution requirements for other languages and include links to the language specific standards we want followed (for example I could like to the documentation page for TypeScript and make a JS version of that page). For now I included a summary and a link to the doc with the steps to follow: https://gist.github.com/oregonisaac/e41826e171b53826ff869cab75d8ed0b

jzbz commented 5 years ago

@oregonisaac that's actually a great idea. You might want to touch bases with @s-ben as he was working on dev docs IIRC.

s-ben commented 5 years ago

@oregonisaac @jzbz , I think we should at least add JS guidance to the Source Code Contributions page. Have created an Issue for that on dcrdocs.

I also think the general code contribution guidelines from dcrd are good. They're pretty specific to Go and the dcrd repo though (e.g. their GitHub process). I think it would be useful to have a page that captures our general code contribution guidelines at a higher level, but also directing people to the individual repo READMEs for specific guidelines. Have put this on my to do list.

xaur commented 5 years ago

Pasting comment from @paullinator from the gist:

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 commented 3 years ago

@JoeGruffins wrote some javascript for working with Decred transactions: https://github.com/trezor/trezor-utxo-lib/pull/9

cc @svitekpavel