Git Product home page Git Product logo

alephium-frontend's Introduction

Alephium

codecov Discord

This repository contains the reference implementation of Alephium, a sharded blockchain that makes programmable money scalable and secure. For more information, please visit the wiki.

Overview

The protocol's innovations extend battle-tested ideas from Bitcoin and Ethereum:

  • BlockFlow algorithm based on UTXO model enables sharding and scalability for today (code + algorithm paper)
    • The first sharding algorithm that supports single-step cross-shard transactions, offering the same user experience as single chain
    • Simple and elegant PoW based sharding, does not rely on beacon chain
  • Stateful UTXO model combines the advantages of both eUTXO model and account model (see code, wiki to come)
    • Tokens are first-class citizens and UTXO-based, which are owned by users directly instead of contracts
    • Offer the same expressiveness as account model. DApps can be easily built on top of it with better security
    • Support multiple participants in a single smart contract transaction. Multiple calls can be packed into a single transaction too.
  • Novel VM design resolves many critical challenges of dApp platforms (see code, wiki to come)
    • Less IO intensive
    • Flash loan is not available by design
    • Eliminate many attack vectors of EVM, including unlimited authorization, double dip issue, reentrancy attack, etc
    • UTXO style fine-grained execution model reduces risk-free arbitrage
  • PoLW algorithm reduces the energy consumption of PoW in the long term (research paper)
    • Adaptive rewards based on hashrate and timestamp are designed and implemented
    • Internal mining cost through burning will be activated when hashrate and energy consumption is significantly high

Installation

Prerequisites

The following dependencies must be installed in order to run the JAR deliverable:

  • java (11+)

Running

You can obtain our latest single JAR distribution from the GitHub releases and start the application using the following command:

java -jar alephium-<VERSION>.jar

Build From Source

Requirements

In order to build the project from source the following dependencies must be installed on your system:

  • java (11+)
  • SBT

Single JAR

Use the following command to build a single runnable JAR :

make assembly

The resulting assembly file will appear in /app/target/scala-2.13/ directory.

Universal Zip distribution

Use the following command to build a zip distribution including launch scripts:

make package

The resulting package file will appear in the app/target/scala-2.13/universal directory.

Docker Image

Use the following command to build a docker image:

make docker

Configuration

You can define user specific settings in the file $ALEPHIUM_HOME/user.conf, where by default $ALEPHIUM_HOME points to ~/.alephium.

Testing

There are two kinds of tests:

  1. Unit tests and property based tests, which can be run with the make test command.
  2. Integration tests, which can be run with the make itest command.

Contribution

Have a look at our contribution guide described in CONTRIBUTING.md

Acknowledgements

YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. YourKit is the creator of YourKit Java Profiler, YourKit .NET Profiler, and YourKit YouMonitor.

alephium-frontend's People

Contributors

0xjac avatar aloiscochard avatar crowdin-bot avatar deathmumi avatar dependabot[bot] avatar h0ngcha0 avatar iix avatar iwalkingcat avatar jimmyhoffa avatar killerwhile avatar lbqds avatar leealephium avatar lessismore10 avatar lf94 avatar montaill avatar mvaivre avatar nit27 avatar nop33 avatar polarker avatar redokazda avatar ross-weir avatar tdroxler avatar vdaodao avatar waldi28 avatar ykris45 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

alephium-frontend's Issues

[EPIC] Simplify transaction gas settings

Is your feature request related to a problem? Please describe.
Currently, in our wallet, if a user wants to tweak the gas setting they are asked to enter the gas amount X and the gas price Y. Then gas fee = X * Y. (The reason for that is that the API requests these 2 values)
image

However, as a user it is quite confusing to know what value to input in these fields.

Describe the solution you'd like
On ETH (specifically metamask), users are asked to set the gas price and are shown the corresponding gas fee (or vice versa). The gas amount is estimated. After confirming with @polarker, this is something we can also do for Alephium in order to improve the user experience.

Additional context
Adding Metamask screenshots
image (1)
image (2)


  • Simplify transaction gas settings on desktop wallet
  • Introduce simple gas settings on mobile wallet

Disable biometric auth when the fingerprints or face data have been changed

In order to increase security and do better than most crypto wallets, in case of a change in on-device biometric settings :

  1. Let's deactivate biometric authentication;
  2. Fallback to pin and show a popup asking the user to reactivate the biometric option if needed.

I personally like the wording used by Authy:

image

Research translations management tool

We are very lucky to recently have received an influx of contributors who are willing to translate our project!

This poses some new problems:

  1. Our translators are not familiar with git and GitHub workflows (PRs, reviews, branches, rebase, merge)
  2. Our translation files are stored in JSON format. Our translators are not familiar with JSON and might create a PR with a corrupted structure.
  3. Providing translations requires apart from creating a JSON translation file to also update pieces of code to pick up this new file and enable the translation.

Maybe it's a good time to look into translation management tools.

Some initial research:

  • https://locize.com/ (free for open-source projects - need to verify eligibility, found through the https://react.i18next.com/ docs, provides awesome integration with our tooling, but I don't like that the content is managed in their servers and not on GitHub)
  • https://www.transifex.com/ (free for open-source projects - need to verify eligibility. This tool is used by the open-source project I was working on while at CERN, check out their contribution guide)

My personal requirements would be:

  • Minimise time required by devs to integrate new language
  • Minimise time required by devs to register new translation strings when developing new UIs (currently, every time there's a new string, the dev needs to create a key-value pair in EVERY translation JSON file, which is cumbersome)
  • Provide UX friendly tool for translator who is unfamiliar with git(hub)
  • Allow for review workflows
  • Host translations on GitHub

WDYT?

It's impossible to cancel a FaceID auth

Cancelling a FaceID (or fingerprint ID for that matter) authentication makes the app try again by re-prompting the authentication UI.

Cancelling a biometric auth should probably prompt the pin screen.

Discuss fee estimation (Improve error handling when not enough ALPH is available to cover transaction fees)

The POST /transactions/sweep-address/build endpoint will sweep all ALPH as well as all tokens from one address to another.

It is probable that when the user clicks "Max amount" when sending ALPH, they actually want to sweep. However, if they don't also select "Max amount" for all the tokens of the address, the sweep endpoint will not be called, but the regular one POST /transactions/build. This will result in an error:

Not enough balance for fee, maybe transfer a smaller amount

I propose that when the user clicks "Max amount" when sending ALPH, the UI should ask them "Do you want to also move all tokens from this address"?

image

@mvaivre opinions?

Switch to React 18 API

react-scrollbars-custom is not compatible with React 18. We heavily depend on this library. Thus, even though we have upgraded React to v18, we are still using the React v17 API. Once this lib becomes compatible, we can switch to the React 18 API by simply using the render method of createRoot instead of ReactDom: https://reactjs.org/blog/2022/03/08/react-18-upgrade-guide.html

I've opened an issue on the library (even though a similar one existed already:

I thought of using react-custom-scrollbars-2 but it's written in JS (no types available).

[Idea] Investigate using popup windows for signing TXs (WalletConnect)

Why? => Having the whole app opening when a user wants to sign something isn't really needed. We could be more subtle by showing only some kind of notification popup with only the necessary content :

  1. Unlock a wallet if needed
  2. See what should be signed. What would be the outcome.
  3. Button to execute the action.
  4. Feedback (validated or error)

This would really make the desktop app a versatile tool to interact with dApps.

Fix node deprecation warning due to samuelmeuli/action-electron-builder

We are getting this warning:

sign_and_release (macos-latest)  
Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16:  
samuelmeuli/action-electron-builder@v1. For more information see:   
https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/.

GitHub will deprecate Node.js 12 on September 27th.

https://github.com/alephium/desktop-wallet/actions/runs/4798619034

Improve sending process of NFTs

  • Clarify if we want to support "fractional NFTs" (which is seems kinda counter-intuitive :)).
  • Depending on the answer, let's simplify the flow for sending NFTs, by removing the "amount" part of the process.

Cannot send funds right after receiving them

It only happens in a corner case where someone JUST funded one of their addresses and tries to send an amount from this address that is higher than the amount the address had before the last funding.

Describe the bug
In my local devnet (node 1.3.2, expl-bck 1.6.0) I noticed that after I send a tx from address X to another Y and
once the explorer API getAddressesAddressTransactions endpoint (get confirmed txs) as well as the getAddressesAddress (get address details) include this tx, then I have an issue building a new transaction from address Y, unless I wait for a minute or so. It seems that the node is not up to date with the latest tx. It returns an error of “insufficient funds”. Then, after a few seconds/minutes, it stops returning this error.

To Reproduce
Steps to reproduce the behavior:

Untitled.mov

Expected behavior
Be able to send the funds once a confirmed tx is received

Additional context
It appears that we wait for toGroupConfirmations >= 1 to be able to make a transaction from Y. This number is from /transactions/status:

{
  "type": "Confirmed",
  "blockHash": "bdaf9dc514ce7d34b6474b8ca10a3dfb93ba997cb9d5ff1ea724ebe2af48abe5",
  "txIndex": 0,
  "chainConfirmations": 1,
  "fromGroupConfirmations": 2,
  "toGroupConfirmations": 3
}

If Y has funds in the wallet, Y could use the existing UTXOs to build transactions.
If Y is a new address, it will need to wait a bit more. For now, we could probably mark the tx as pending if toGroupConfirmations < 1

Related issue: alephium/explorer-backend#198

Overview of when coins will get unlocked and how many

Is your feature request related to a problem? Please describe.
I am having a hard time to calculate when the next unlocking date will be and how many coins will be unlocked.

Describe the solution you'd like
It would be useful to know when the next unlocking will take place and how many coins will be unlocked (as well as any future unlockings).

Describe alternatives you've considered
The current desktop wallet indicates the amount of available and locked balance.. Going through the transactions list I can find transactions that have locked UTXOs, but it is not very user-friendly when one is looking for an overview.

Additional context
I think this would be useful information to put somewhere in the overview. Maybe a small text under the locked amount that says "next unlock of X coins on DATE" with a link to see more unlock dates, either on a tooltip or a modal, or page.

image

Ledger Nano support

Hardware wallet support is a must-have.
As discussed, let's start by investigating adding support for Ledger Nanos which are extremely popular (easy to get, relatively cheap, dev-friendly etc.).

This issue can be used to document the investigation progress, but let's try not to spam it too much ;)
Once concrete tasks can be formulated, let's link them here to reflect ongoing progress.

Multisig support on desktop wallet

Here is a draft proposal. We could add the support in two phases:

Phase 1:

  • Desktop wallet exports public keys of addresses (so need a button to export public key)
  • Full node builds unsigned multi-sig transactions
  • Signers sign the tx using desktop wallet (so need a new TxModal for signing unsigned transactions)

Phase 2 (Optional as it might complicate the UI):

  • Desktop wallet builds multi-sig transactions directly

Download-percentage is inconsistent during download of upgrade

Describe the bug
@nit27 just found an issue when the desktop app runs ‘auto update’. It showed that the dowloaded calculating percentage somehow went incorrectly.

Expected behavior
percentage display should be consistent

Screenshots

5_6077685457519380667.mp4

Environment

  • Internet connection is fine.
  • MacOS 13.2.1

Additional context

  • issue happened auto update from v1.5.2 to v1.5.3

AppImage wallet doesn't launch when clicking WalletConnect button

When clicking "Connect with desktop wallet" in the DEX, we get the following window that says "open xdg-open" instaed of "Alephium". Also, clicking it doesn't open the wallet.

image

@Lbqds reported that the only way to make it work was:

  1. Create a file called alephium-wallet.desktop
  2. Input the following contents:
[Desktop Entry]
Name=Alephium-Wallet
Exec=/home/lbqds/Desktop/Alephium-2.0.0-rc.40.AppImage
Icon=/home/lbqds/Desktop/icon.png
Type=Application
MimeType=x-scheme-handler/alephium;text/html;

you need to replace the Exec and Icon with your path.
3. Make this file executable: chmod u+x alephium-wallet.desktop
4. Move alephium-wallet.desktop to ~/.local/share/applications

Use `@metamask/browser-passworder` for encryption/decryption

Proposed by @polarker in https://github.com/alephium/js-sdk/pull/133#issuecomment-1328787203, we should replace our current encrypt/decrypt functions of lib/password-crypto.ts with a mature library like @metamask/browser-passworder: https://www.npmjs.com/package/@metamask/browser-passworder.

We need to investigate a few things:

  1. This library is meant to be used by browsers because it relies on the global.crypto browser API. This means it wouldn't work for nodeJS applications. So, if we want our SDK to be usable by nodeJS apps, we need to use a different library, or polyfill that one. But polyfills usually work the other way around, nodeJS -> browser, not browser -> nodeJS. To be investigated. Not relevant anymore, we don't need Node.js support for our monorepo shared packages.
  2. Does Metamask provide a different way of encrypting/decrypting for nodeJS apps? Same as above
  3. Find out what polyfills are needed to make this work in RN (mobile wallet) and how Metamask does it.

Store already confirmed txs and historical data locally

We currently have 2 features that (potentially) require the knowledge of the whole transaction history for all addresses of the wallet in order to work correctly. Those are:

  1. Historical data on price: alephium/desktop-wallet#587
  2. Future unlock schedule: #44

Wouldn't it make sense that the wallet stores locally in an encrypted file(s) all address transaction data that has been recorded on the blockchain and there is no way it gets changed?

Ideas:

  • Only store transactions that have X confirmation (or are older than 24h or sth)
  • On wallet start-up, fetch all new transactions and update store

Benefits:

  • Fewer requests to the explorer backend service
  • Better UX since transaction pagination will not need to reach to a server (we could implement infinite scrolling)
  • Can implement feature 1
  • Can implement feature 2

@mvaivre, @tdroxler, what are your thoughts on this?

Some quick math: An average tx with 2 inputs, 4 outputs, some ALPH and some tokens takes about ~2'500 characters (with a simple compression it can get down to 1'200 characters) so that's about 1KB per tx.

Open questions:

  • How many txs does the larger ever Alephium wallet has?
  • Is the performance of the electon app get affected when the Redux state grows a lot? (this is not inherently a potential problem of this proposal, a user can already click "See more" as many times as they want to load all their history)
  • What other alternative proposals are there for implementing feature 1 and 2?

Allow "order by" in Addresses page

Allow users to order addresses by:

  • Last use (default)
  • Worth (desc)
  • Alphabetical (desc)

Use a Select component. Choice should be persisted between session, ideally per wallet.
Other options like this one will certainly pop up in the future.

More responsive layout (small width)

Having a responsive (maybe simplified) layout could be really useful when the wallet needs to be used alongside dApps (ie. in split mode). We need to define if / what parts of the UI should be simplified / hidden when the width is restricted.

Multi-recipient TX sending

Let the user send to multiple recipients in one TX.

@polarker 's opinion on this topic:

All recipient must be in the same target group. We could prepare multiple transactions for one user action, for better user experience. I will need to improve the SDK first to support this better.

Current concept:

image

TODO :

  • Design
  • Adapt the SDK to "batch" multiple TXs in on user action

Update system does not work if the currently installed version is an RC

Assuming there are 2 releases on GitHub, set as the following:

  • 1.5.0 (marked as latest)
  • 1.5.0-rc.0 (marked as a pre-release)

The 1.5.0-rc0 wallet will check if there are new releases when launched. Unfortunately, the following code returns 1.5.0-rc.0 instead of 1.5.0, so the update system does not work if the currently installed version is an RC.

const version = await electron?.updater.checkForUpdates()

We don't expect users to install RC versions, however, so I wouldn't consider it a big problem. Something to look into it, however.

Improve private key management

The function deriveNewAddressData is returning an AddressKeyPair

export type AddressKeyPair = {
  hash: string
  index: number
  publicKey: string
  privateKey: string
}

Having the private key in here could cause security issues (like storing it in clear text by mistake along with non critical data).

Cheng is suggesting that we could refactor the function so that we have a specialized function for returning the private keys, and another function for returning non-critical data like address, public key, group etc.

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.