GithubHelp home page GithubHelp logo

cryptonomic / conseiljs Goto Github PK

View Code? Open in Web Editor NEW
110.0 110.0 39.0 9.02 MB

Client-side library for building decentralized applications.

License: Apache License 2.0

TypeScript 92.18% JavaScript 0.13% Nearley 7.69%
blockchains decentralized-applications javascript tezos typescript

conseiljs's People

Contributors

anonymoussprocket avatar ba205 avatar coder0377 avatar developer0623 avatar gdsoumya avatar itamarreif avatar jurajselep avatar keefertaylor avatar modev0323 avatar neocybereth avatar nigro64 avatar prathamrawat avatar romarq avatar teckhuac avatar umurb avatar vishakh avatar yourcodesucks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

conseiljs's Issues

Remove dist folder from Develop branch

Once Tezori can successfully pull from ConseilJS using the GitHub oauth url in package.json and compile the imported typescript on their end, there is no need for the compiled javascript folder, dist, to be in ConseilJS anymore.

Counter_in_the_past error for transactions for develop branch

For TezosHardwareOperations.spec.ts in the develop branch, when a transaction is attempted from ledger into a dummy account on alphanet, the id of the injected transaction operation reads "proto.002-PsYLVpVv.contract.counter_in_the_past". This should be amended so counters are incremented correctly.

Password characters should be enforced when wallets are created

Currently, createWallet() in TezosWallet only checks for password length but not the characters. It is, for example, possible to enter eight spaces as the password. This should be fixed by ensuring all supplied passwords only contain upper case & lower case letters, numbers or a fixed set of symbols.

Error Messages: Improve Operation error handling

We need more detailed error messages, especially during the importing fundraiser account scene.

Currently, we can't display anything other than 'Provided string does not look like hex data'

Use zxcvbn to enforce password strength requirements

The zxcvbn library should be used to enforce password strengths. Each supplied password should be tested and any passwords with a score of less than three should be rejected. https://github.com/dropbox/zxcvbn#usage explains the usage of the library.

  • Add new function to CryptoUtils for testing password strength.
  • Invoke the new function from encryptMessage() in 'CryptoUtils`
  • Remove the eight character check from createWallet() in TezosWallet

Calculate fee defaults

Rather than using static values as #69 does, calculate fee defaults.

Update the individual Reveal as well.

Change managerPubKey to manager_pubkey for origination operations

Due to a recent merge in the Tezos zeronet codebase, there should be a ConseilJS deployment which constructs origination payloads compliant with zeronet.

This change should be made on a issue-specific branch which should then be merged into a zeronet branch, upon which a specific NPM package deployment can be made.

Improve code coverage

Review the Coveralls results, and expand coverage in the following:

  • /reporting/ConseilDataClient.ts
  • /reporting/ConseilMetadataClient.ts
  • /chain/tezos/TezosNodeWriter.ts

These should be unit tests, they will require nock'ed responses.

Migrate away from fsPromises library

As conseiljs is used in an Electron wallet app and Electron doesn't seem to work with fsPromises', all file operations should be reverted to using fs`.

Parse Michelson Scripts into JSON

We want users to be able to deploy smart contracts on the tezos node with conseiljs using actual Michelson scripts. To do this, we have to send a json-ified version of the Michelson code to comply with the Tezos RPC.

Refactor branches and packages to reflect multiple environments

All code in the master branch should be compatible with the Tezos mainnet and should be published as the ConseilJS NPM package.
All code in the staging branch should be compatible with the Tezos zeronet and should be published as the ConseilJS-staging NPM package.
All code in the develop branch should be compatible with the Tezos alphanet and should be published as the ConseilJS-dev NPM package.*

The above information should be included in the root README file.

*As Cryptonomic is not yet running alphanet nodes, we must use zeronet for now.

Enhance origination operation

We want to allow ConseilJS users to originate smart contracts. Here is some informational material which will help us develop this feature.

  1. Recently TezosTeam launched TST token on Tezos. Investigating their transaction and smart contracts will help.

They originated 2 contracts:
Origination Operation 1 -> Smart Contract 1
Origination Operation 2 -> Smart Contract 2

When investigated on chain, these are the fields to the operations:

screen shot 2018-12-19 at 5 03 50 pm

Script field includes the contract code written in Michelson parsed in JSON. (Serialization/Deserialization process of the Michelson code will be taken care of by the Conseil team.)
I've sent the whole json of the origination operations to you on Riot.

You may consider following this tutorial to write a simple smart contract to test.

Get ConseilJS working as an NPM module

The NPM package settings for ConseilJS should be verified for correctness.

Any project importing conseiljs should have access to everything in TezosOperations, TezosConseilQuery, TezosNodeQuery and TezosWallet.

Set fees in a principled manner

The Conseil backend now allows the calculation of high, medium and low fees based on some parameters. ConseilJS should wrap this functionality and make it available to downstream clients.

Remove redundencies in TezosOperations module

sendTransactionOperation(), sendDelegationOperation() and sendOriginationOperation() are not following the DRY principle and should be refactored so the operation payloads are not duplicated several times.

Estimating burn for operations

At the moment, only origination operation is burning gas and the gas burnt for this operation is constant, 0.257 tz.

But this might change in the future. We need to have a function to estimate the burn.

Validate mnemonic length for unlocking Tezos identities

getKeysFromMnemonicAndPassphrase() in CryptoUtils does not enforce a mnemonic length and this should be changed. The mnemonic should be a fifteen word string, e.g.:

clerk rhythm bonus fabric vital luggage team engine stairs palm degree gossip hour say tenant`

The relevant unit test should also be added.

Enforce wallet password strength

The password supplied for creating wallets must be at least eight characters long.

This should be done in createWallet() in TezosWallet.

The relevant unit test should also be added.

Improve exception handling for wallet loading

In loadWallet() in TezosWallet, we are returning a promise which performs a set of operations. However, as one of lines could throw an exception. We do not catch any expectations so they die silently. The code should be changed so that any exception will lead to the promise being rejected.

NPM Package not available

Looking to use your client side library but it looks like the NPM package isn't available. Any idea when this will be available again?

Enhance invoke operation

To invoke contracts, a user will select custom fee, gas limit, and storage limits. Besides these three parameters, a user will have the option to provide additional parameters. Although we don't have the designs ready for the Galleon, I can say that it will somewhat look similar to what TezBox has at the moment:

screen shot 2018-12-19 at 4 06 52 pm

As agreed on Riot, this ticket will be implemented after we figure out the smart contract originations.

Add support for Ledger hardware wallet

This ticket requires two headline changes:

  1. The TezosOperations module has been written with the assumption that is called only by file-based wallets with access to a user's keys. Instead, it should support operation functionality without assuming the keys are transparently available.
  2. The operation signing algorithm currently requires explicit keys. There should be an alternative that submits the actual signing to a hardware device.
  3. The TezosWallet module currently only supports mnemonic-based address retrieval for file-based wallets. It should also support the BIP39 / BIP32 retrieval of addresses from hardware wallets.
  • There should be a new enum called HardwareDeviceType with a single member for now called Ledger. Options such as Trezor can added later.
  • There should be a new unlockHardwareIdentity() function should take a device type, a derivation path and an index. If the device type is 'Ledger', Ledger.js is invoked to get the corresponding public key hash.
  • A new getAllActiveDerivedHardwareAddresses() function should take as parameters - a device type, a seed and a derivation path - and return all derived addresses which can be found on the Tezos blockchain.
  • There should be a new signOperationGroupWithHardware() function which takes a forged operation, a device type, a derivation path and an index. If the device type is 'Ledger' then invokes Ledger.js to sign the operation.
  • There should be a new sendOperationWithHardware() function which is similar to sendOperation() but takes a derivation path and index instead of a key store.
  • For each sendXOperation() instance, there should be a corresponding new sendXOperationWithHardwareWallet() which does not take a KeyStore and, instead, takes a derivation path and index.

Reveal operations should not incur fees

Currently, reveals incur fees, and since reveals are now bundled with transactions, delegations, and originations, there can be unexpected doubling of fees. We want reveals to not insure any fees, even when bundled with other operations.

Make Ledger package a peer dependency

Ledger being a dependency in conseilJS is causing troubles with Arronax's webpack.
Make Ledger (also Trezor in the future) package a peer dependency

Make the distinction between a delegated address and a smart contract

A delegated address and a smart contract look almost identical (both start with KT1) but they are two completely different entities. The simplest way to determine if a KT1 address is a smart contract or a delegated address is to run a getAccount and check the script field.

If script is null then this KT1 address is a delegated address
If script is not null then this KT1 address is a smart contract

We need to make this distinction to determine the following two things:

1- Did the user enter a valid address whilst invoking a contract

verificatino

If the user enters an invalid smart contract address, Tezori should warn the user.
Tezori is already making the offline checks (is the address 36 chars long, are there any special characters in the address etc.). Please add the second tier check mentioned above.

Also, can you please change the below offline validation rule, and only allow KT addresses to be entered in this field.

Screen Shot 2019-03-11 at 11 48 06 AM

2- To list the originated contract in the correct section

Currently, any originated contract will be listed as a Delegated Address in Tezori. Currently, any originated contract will be listed as a Delegated Address in Tezori. We need to list the smart contracts and delegated addresses separately as shown belown.

Screen Shot 2019-03-11 at 11 56 03 AM

Add HD wallet support

The TezosWallet module was written with the option of adding HD wallet support. The logic must now be extended to allow HD support to prepare for hardware wallet support.

  • Incorporate BIP32 library for supporting derivation paths and refactor getKeysFromMnemonicAndPassphrase() to explicitly use BIP32.
  • Split getKeysFromMnemonicAndPassphrase() into two functions - getSeedFromMnemonicAndPassphrase() and getKeysFromSeed()
  • 'getKeysFromMnemonicAndPassphrase()' should also take an optional derivation path argument.
  • `getSeedFromMnemonicAndPassphrase()' should take as parameters - a fifteen or twenty-four word mnemonic, an optional passphrase, - and return a seed.
  • 'getKeysFromSeed()' should take as parameters - a seed and a derivation path- and return a key store corresponding to the root account.*
  • A new getDerivedAddress() function should take as parameters - a seed, a derivation path and an index - and return a key store corresponding to a derived account.
  • A new getAllActiveDerivedAddresses() function should take as parameters - a seed and a derivation path - and return all derived addresses which can be found on the Tezos blockchain.

HD wallet usage of the above:

  • Ask user for a mnemonic
  • Call getKeysFromMnemonicAndPassphrase() with above to get the root address and seed.
  • Call getAllActiveDerivedAddresses() with the above seed and a derivation path to get a list of all derived addresses.
  • To create a new derived address, call getKeysFromSeed() with the above seed and the next index.
  • To load an existing wallet, fetch the seed of the root address from disk and then call getAllActiveDerivedAddresses().

The Wallet interface currently supports an arbitrary number of KeyStores. Any client is free to add as many KeyStores, therefore as many seeds, to a wallet file as they want. However, in HD mode, we want a wallet file to contain no more than a single seed. Therefore, we must implement a new HDWallet interface which essentially inherits from Wallet but constrains the number of KeyStores to a maximum of one and the KeyStore object to contain a non-null seed.

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.