Giter Club home page Giter Club logo

chainguardian's Introduction

ChainGuardian

Build Status codecov Discord GitHub

Eth2.0 desktop validator client.

Install

Clone the repository with Git:

git clone [email protected]:chainsafe/ChainGuardian.git

And then install the dependencies:

cd ChainGuardian
yarn install

Usage

Both processes have to be started simultaneously in different console tabs:

yarn run start-renderer-dev
yarn run start-main-dev

This will start the application with hot-reload so you can instantly start developing your application.

You can also run do the following to start both in a single process:

yarn run start-dev

UI development

For building components in isolation you can use Storybook.

Just run yarn storybook

Design is based on: https://www.figma.com/file/dt1Z45BJkDGOg63IdNYwbR

Development

It's best to use local network. Local network is configured using docker-compose (currently available lighthouse-testnet.yml). For the first time you need to run setup script (setup.sh) on path ./testnet/lighthouse then type docker-compose -f lighthouse-testnet.yml up in terminal,
you will get:

  • 2 working lighthouse beacon nodes (port: 5052 and 6052)
  • lighthouse validator with 15 dummy account

To start using local network just add beacon node with address http://localhost:5052.
You can use this account to validate using ChainGuardian (or create new via launchpad):

  • private key: 0x51d0b65185db6989ab0b560d6deed19c7ead0e24b9b6372cbecb1f26bdfad000
  • public key: 0xb89bebc699769726a318c8e9971bd3171297c61aea4a6578a7a4f94b547dcba5bac16a89108b6b6a1fe3695d1a874a0b

In case of longer break it is recommended to update genesis time before starting local tesnet with reset_genesis_time.sh script

Packaging

We use Electron builder to build and package the application. By default you can run the following to package for your current platform:

npm run dist

This will create a installer for your platform in the releases folder.

You can make builds for specific platforms (or multiple platforms) by using the options found here. E.g. building for all platforms (Windows, Mac, Linux):

npm run dist -- -mwl

License

GNU General Public License v3.0

Built with:

React Webpack TypeScript Electron Redux Jest

chainguardian's People

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

chainguardian's Issues

Fix lint warnings

Self explanatory.

  • some "any" types could be turned to "uknown", others must be typed properly

Connect logic and redux for onboarding process

  • after import/generate of signing key -> store keys in redux
  • after withdrawal key import/generate -> store pubkey in redux
  • generate dposit tx data using keys in redux
  • wait for deposit tx to be visible (deposit event) or skip
  • after password, store keystore/save account in database/delete keys from redux

Open app as maximized

  • figure out how to open screen in maximized format
  • change help menu to contain only "Github repo" and "Search Issues" items
  • add chainguardian logo as app icon
  • rename window title to ChainGuardian

Implement tooltip component

Currently, the tooltips are implemented via image manipulation, meaning that in order to display the tooltip the whole source image is replaced with the image that contains original image + the tooltip segment, this means that while hovering the image component the image is replaced with a larger image, this causes various UX issues (tooltip overflows the parent, tooltip expands the parent, etc.). The tooltip should be fix-positioned to the wrapped component and should not interfere with the wrapped component's positioning.

Current tooltip implementation can be seen in the CopyButton component.

We could use a react-tooltip package or implement custom component.

Switch to ethers.js

Since we will have to fetch and parse events, we have already pulled most of dependencies of ethers.js so we should remove ethereumjs stuff and replace with ethers.js methods

Add button size prop

options should be Size.NORMAL and Size.SMALL. Only difference is padding on text side (check YES/NO buttons in figma)

Fix UI issues

With some changes on various containers some UI bugs apeared:

  • "I have saved this mnemonic" button is missing top padding
  • Copy button in mnemonic and copy field is aligned top
  • When verifying mnemonic, invalid button blinks "correct" green for a second
  • center text in tool tip
  • text is overlapping with validation checkmark in input fields
  • password input isn't focused on create password screen

We can have this issue opened up and just add stuff here.

Implement validator balance graph component

Validator balance:

  • component interface:
    • defaultInterval - hour, day, week, month, year, all (you need to adjust scale below accordingly, example "hour" value should display balance in last like 8-10 hours - you can decide how many value you wish to display)
    • getData: (interval: IntervalEnum, limit: number) => number[] - you need to document that you expect latest data first, each number corresponds to single interval

Login flow

  • on login check password and display error message if invalid
  • if valid, navigate to dashboard

Service to run docker image

Class must support:

  • check if docker is installed
  • using cmd run given docker image
  • ability to pass custom params
  • open stream with logs
  • kill command

I would skip e2e tests and keep just unit test and script to showcase it's working.

Check if user has deposited ether

We need to support two use cases:

  • user imports validator signing key
    • fetch all deposits (not sure if event.pubkey is indexed)
    • filter ones belongs to user pubkey
    • sum and check if ethere is enough ether deposited
  • user generated signing key
    • listen on deposit event

Task: create methods to support given use cases

Http client load balancer

  • create http clients wrapper with same methods as http client
  • should be able to load balance requests across given http clients
  • override produce block method and combine slashings from all http client reponses

Loading component

  • don't have figma
  • spinning logo and given text in modal should be fine

Create and send deposit transaction

Function to generate deposit function data should be:
generateDeposit(signingKey: Keypair, withrawalPubKey: BLSPubKey): DepositParams
Keypair type can be found in @chainsafe/bls, and BLSPubKey in @chainsafe/eth2.0-types.

interface DepositParams {
   withdrawalCredentials: bytes32;
   signature: bytes96;
   root: Hash
}

You should also expose method to generate eth1 data like so:
generateEth1DepositTx(depositParams: DepositParams): Tx

interface Tx {
   to: string;
   value: string;
   data: string;
}

I suggest using https://github.com/ethereumjs/ethereumjs-abi for encoding tx.data so we don't pull too many eth1 dependencies.

Define "account"

Create Account class
with following methods:

  • getValidatorsAddresses(): string[] - should return addresses from validator keystores in account directory
  • getValidators(password): Keypair[] - returns all validator keypairs or throws if not unlocked
  • isCorrectPassword(password: string): boolean -
  • unlock(password: string): void - should try to decrypt keystores using given password, throw exception if wrong password (save unlocked keypairs into private field)
  • lock(): void - delete all unlocked keypairs from object

with following public properties:

  • name: string
  • directory: string
  • sendStats: boolean

Account should have it's own ssz type definition and database repository implementation.

Note: you will probably have to override repository method for fetching to wrap returned object into AccountClass

Database over IPC

Renderer:

  • implement new DatabaseController (IpcDatabaseController) which passes all data to appropriate ipc channels
  • use replace LevelDatabaseController with IpcDatabaseController

Main:

  • move LevelDatabaseController from renderer
  • Create LevelDatabaseController wrapper which listens on ipc events and passes given data to LevelDatabaseController

Overview of db arch would be:
renderer process -> DatabaseApi -> IpcDatabaseController -> ipc event -> main process -> ipcListener -> LevelDatabaseController

Password dialog

  • expose method which will open native dialog(checkout electron prompts) which is suppose to block main window
  • prompt (dialog) should have submit and cancel button
  • password input should be hidden
  • method should be async and return password or null
  • submit is suppose to check password before returning and display error message if invalid

Add metrics to http client

  • track and store response times of each method of HTTP client
  • add db method to calculate response avg over a given time period

This will be used in graphs. If a response is not received it should be saved as offline in uptime. Should watch for and write down next online status.

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.