rate3-network / rate3-monorepo

rate3 monorepo - includes our smart contracts, projects and developer tools
https://rate3.network
Apache License 2.0
19 stars 6 forks source link

JavaScript API for Ethereum and Stellar wallet management #9

Open davisdevs opened 6 years ago

davisdevs commented 6 years ago

Simple Summary

A JS API library that provides a consistent interface to manage Ethereum and Stellar accounts through the use of respective blockchain API. Storage of data is not handled by this library.

Motivation

The creation of demos and PoCs will most likely require blockchain account management as accounts will be used to sign transactions (move tokens, smart contracts operations, etc)

The proposed API will accelerate development as it is a single package for developers to interact with Stellar and Ethereum APIs for multichain wallet management. This reduces the overhead to understand multiple APIs to implement blockchain wallet management, a core basic functionality required in any dApp.

In the future, this can be expanded to other blockchains that Rate3 Protocol is supported on.

Key Specifications

Unless otherwise stated, the follow specifications apply to supported blockchains:

  1. Stellar
  2. Ethereum

Highlighted here are key functionalities that should be supported. Other utility functions are not shown here.

Phase 1: HD Wallet management

Phase 2: Allow for delegated signing

Phase 3: Anchor-Client Bridge (Stellar SEP-0006)

Phase 4 Ethereum-Stellar Bridge (TBD)

Phase 5 Decentralized Trading

Phase 6 Decentralized Identity

References

https://github.com/stellar/stellar-protocol/blob/master/ecosystem https://github.com/stellar/bifrost-js-sdk https://github.com/ethereumjs/ethereumjs-wallet

qianpeisheng commented 5 years ago

Problem: For Stellar, the transaction history will only show the first 10 records. Solution: Add parameters to the request to get more customized transaction history. Ref The cursor does not include itself (in the history returned) [UPDATE 26 OCT] This is not solved yet.

qianpeisheng commented 5 years ago

The largest part not done in my development is the integration of hardware wallet. First, the integration of hardware wallet into Account.js need to redo. The proposed architecture is to create a separate hardwareNative.js class (or a more proper name), that holds the hardware-backed accounts (currently Ledger and Trezor); the setAccount method will set account.nativeAccount to a hardwareNative object, which is created prior to it, with fields denoting the brand of the hardware, and the derivation path. It will also include methods like getAddress(), signTransactions(), which basically calls respective methods in Trezor.js and Ledger.js. And the function calls in Account.js for hardware-backed accounts are similar to those with Stellar and Ethereum native accounts.

qianpeisheng commented 5 years ago

Second, some functions in Account.js and WalletManager.js do not support hardware wallet backed accounts, for example, encryption and decryption (because private keys cannot be retrieved and encrypted). There should be a checkHardware() method to determine if the account is using a hardware native account and handle properly when the method does not support that.

qianpeisheng commented 5 years ago

Third, testing for the entire hardware integration is not done, including Trezor.js and Ledger.js.

qianpeisheng commented 5 years ago

Next, there are some other fixes to do.