Code Monkey home page Code Monkey logo

sheikah's Introduction

Sheikah

Build Status GPLv3 Licensed GitHub contributors Github last commit Crowdin localization

Sheikah is a Witnet compatible desktop wallet and data requests development environment.

Installation

Dependencies

At this time, you have to install the following dependencies to run sheikah:

  • openssl

From Github Releases

Go to releases section and download the binary suitable for your system.

Sheikah Development

This is a Web/Desktop application built with Electron. When developing Sheikah, we support Node CURRENT and LTS+. It might work with another version but we do not guarantee it will do in the future.

Running Sheikah

# clone the repository
git clone [email protected]:witnet/sheikah.git

# cd into the cloned repository
cd sheikah

# install application dependencies
yarn

# launch development application
yarn electron:serve:wallet

Formatter

  • Verify files are correctly formatted with yarn lint
  • Repair lint errors with (this operation modifies your files!) yarn lint!

Test

We use Jest for testing.

# run unit tests
yarn test

Build

Production

To build the application run: yarn electron:build, the build files are written to dist_electron directory.

Contributing

You can read the contributing guide

Github Actions (continuous integration)

When opening a pull request a job in Github Actions will be fired off to check the changes. To avoid wasting time waiting for Github Actions output we provide the command yarn ci that will perform almost the same checks but it'll run in your computer.

Troubleshooting

  • Use yarn clean to remove the contents of the build directory (dist_electron)
  • Use yarn clean-deps to remove all installed dependencies
  • Use yarn reinstall to remove all installed dependencies and install them again

If the application doesn't boot correctly and no error is reported in the terminal, try running yarn reinstall and try again.

Release

Releases are created using action-electron-builder. A new draft release will be publish naming a commit and a tag as v*..

sheikah's People

Contributors

aesedepece avatar anler avatar burguesia avatar clbartoli avatar csmoe avatar dependabot[bot] avatar gabaldon avatar kengork avatar kronolynx avatar mariocao avatar tmpolaczyk avatar tommytrg 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

Watchers

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

sheikah's Issues

Wrap storage with encryption

Inside LevelDB, we should have both plain stores and encrypted stores.

Encrypted stores shall use symmetric encryption (AES/CBC/PKCS5Padding) in a transparent way.

Encrypted stores are unlocked using a user-defined passphrase.

feat(encoding): implement private and public key exchange format (slip32/bech32 serialization)

The private and public key serialization format is succintly described in wip-adansdpc-hdwallets, reproduced here:

Serialization format

Extended public and private keys are serialized as follows:

Size Description
1 byte Depth: 0x00 for master nodes, 0x01 for level-1 derived keys, etc.
4*depth bytes Serialized path; each entry is encoded as 32-bit unsigned integer, big endian
32 bytes The chain code
33 bytes The public key or private key data

The key data field will be serP(K) for public keys and 0x00 || ser256(k) for private keys.

This structure can be encoded using Bech32 format described in WIP-adansdpc-addresses. We will use 'xpub' human-readable part for extended public keys and 'xprv' for extended private keys.

When importing a serialized extended public key, implementations must verify whether the X coordinate in the public key data corresponds to a point on the curve. If not, the extended public key is invalid.

Make the app aware of dev/test/prod environment

  • The application should be aware of the execution environment (dev/test/prod).
  • This constant should be exposed to both the backend and the front-end.
  • Default environment should be dev for the time being.
  • Electron's developer console should only be visible while on dev environment.

Discussion: front<>back architecture

Abstract

We will be making the most of Electron and React to ensure the app feels as native and responsive as possible. To do so, we need first to define a clear architecture that sets forth what will be happening in every part of our app. Clearly stating the responsabilities of both the Electron renderer and the main process is paramount to achieve a consistent and reliable architecture.

Background

Electron conveniently uses two separate processes to isolate the code that will be run in a node-like context (the main process) from the code that will be run inside a web-like context (the renderer process).

The main process

The main process has superpowers. Your code is run in a node-like context, so you have access to everything in the userspace of the host machine. This means you can have native access to the filesystem, hardware devices, etc. without having to deal with restrictive web APIs.

A node-like context also gives you the possibility to run Javascript bindings of natively implemented functions (through N-API), which is specially convenient for implementing performance-intensive code (cryptosystems and the like).

The renderer process

The renderer process is nothing more than web content running in a browser (WebKit). The APIs available in this context are exactly the same that you could expect when running Javascript code in a modern browser (including all ES6 and some ES Next).

Current architecture

Our current high level architecture design relies on the main process to act as a sort of back-end that will be responsible for taking care of persisting data in a local database (see #33), performing all the expensive operations related to crypto and brokering communication with rust-witnet, our full node implementation.

On the other hand, the renderer process acts as front-end or user interface. It is powered by React and relies on Redux to handle app state mutations in a consistent and robust manner.

The front-end back-end can communicate by passing messages to each other thanks to Electron's native IPC modules (ipcMain and ipcRenderer). The IPC connection itself is conveniently wrapped by a dedicated API with a series of modular handlers (see #27).

The dilemma

From this point, we can take to different roads:

Option A

  • Exposing most of the the methods from back-end modules to the front-end.
  • The back-end would have almost no business logic and all the app state would live in the renderer process.
  • The back-end role would be limited to:
    • Managing data persistence.
    • Externalizing expensive cryptographic operations.
    • Bridging a socket connection to rust-witnet.

Option B

  • Implementing all the business logic in the back-end.
  • Limiting the role of the front-end to performing a few entry validations, handling all user interaction events and telling the back-end to trigger consequences.
  • The app state would be maintained on the back-end, but we would need to put some replication/synchronization in place in order to ensure consistency with what the UI will show.

FTU sketch/design

We need to sketch/design the UI/UX for the FTU (first-time-usage).

  • Welcome message
  • Wallet seed type selection (new, import, xpriv, hardware)
  • Wallet seed backup
  • Wallet seed import / confirmation
  • Xpriv/Xpub import
  • Wallet encryption password setting
  • Address generation waiting splashscreen (e.g.: spinner)

IPC API library

The IPC API library is an IPC server that wraps and exposes backend methods to the frontend.

Line 3 on CONTRIBUTING.md has a typo

Describe the bug

Line 3 on CONTRIBUTING.md has a typo.

Change:

:tada: Thank you for being interested in contributing to an Sheikah! :tada:

for:

:tada: Thank you for being interested in contributing to Sheikah! :tada:

Fine-grained architecture definition

We must define the client architecture in more detail and write it down in order for everyone to be in the same page and give/receive feedback on.

As an example: we should define how communication between Sheika's front-end and back-end works (e.g.: websockets, etc.) and what's the policy for maintaining the state synced between both.

Discussion and decission on different parts of the client architecture should be done in separate GitHub issues / stories.

Move all configuration files into /config folder

Is your feature request related to a problem? Please describe.
The project root folder is polluted by a number of configuration files that won't see many changes once our the development stabilizes.

Describe the solution you'd like
Move all the configuration files into a new /config folder.

This includes, at least:

  • jest.config.js
  • tsconfig.json
  • tsfmt.json
  • tslint.json
  • webpack.config.base.js
  • webpack.config.development.js
  • webpack.config.electron.js
  • webpack.config.eslint.js
  • webpack.config.production.js
  • webpack.config.test.js

Describe alternatives you've considered
None. Feel free to counter-propose.

Make up our minds on arrow functions policy

Our linting rules have been enforcing usage of arrow (binded) functions instead of traditional functions. However, some of us are finding that arrow function overloads are counter-intuitive:

// Traditional function overload
function foo(bar: string): void {}
function foo(bar: number): void {}
// Arrow function overload
const  foo: {
  (bar: string): void
  (bar: number): void
} = (bar: any) => {}

Type definitions also look kind of weird:

// Traditional function typing definition
function foo(bar: string): void
// Arrow function typing definition
const foo: (bar: string) => void

The purpose of this issue is to open a discussion on whether we should relax our arrow functions policy and allow usage of traditional functions in those cases where we believe them to be more convenient.

In that case, we should make a commitment to applying a not-enforced-by-the-linter clear policy on when it is acceptable to use arrow vs. traditional functions.

Basic UI toolkit

Before implementing any UI we need to create a set of reusable components, our own UI toolkit.

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.