Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In3 Client integration #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chirag-parmar
Copy link

@chirag-parmar chirag-parmar commented Mar 9, 2020

Pretext:

Slock.it just released the first stable version of its blockchain client, INCUBED (IN3). INCUBED unlike Infura connects to the Ethereum Blockchain via an INcentivized Node Network which incentivises and distributes the trust on remote nodes while still keeping the bandwidth and storage requirements low. Such a client fits the requirements of wallets like portis.

New Functionality:

Normal usage(Current)

import Portis from '@portis/web3';
import Web3 from 'web3';

const portis = new Portis('YOUR_DAPP_ID', 'mainnet');
const web3 = new Web3(portis.provider);

Using IN3

const in3Config = {
  chainId: 'kovan',
  requestCount: 5,
  minDeposit: 0.01
}

const portis = new Portis('dapp-id', in3Config, {useIn3: true});
const web3 = new Web3(portis.provider);

Code Changes:

  1. Addition of extra flag to options parameter of the constructor. This flag is used to switch on/off in3.
interface IOptions {
  scope?: Scope[];
  gasRelay?: boolean;
  registerPageByDefault?: boolean;
  pocketDevId?: string;
  useIn3?: boolean;
}
  1. Function signature change for networkAdapter to include extra boolean parameter to handle in3 networks.

New Signature: networkAdapter(network: string | INetwork, gasRelay?: boolean, useIn3?: boolean)

  1. Function signature change for changeNetwork to include extra boolean parameter to handle in3 networks.

New Signature: changeNetwork(network: string | INetwork, gasRelay?: boolean, useIn3?: boolean)

  1. Functionality Change: In3 is provided as an alternative to pocket and infura(iframe). So developer cannot turn on in3 and pocket/infura at the same time.

NOTE: None of the changes are breaking.

Dependency Changes:

  1. Added In3Subprovider to the portis web3 provider engine library. See pull request 4

Config Changes:

  1. Added source map plugin to webpack config for better debugging.

Possible Improvements: (with the help of Portis Team).

  1. The property of nodeUrl is internally used in the iframe for infura communication. If we can remove this dependency of infura in the iframe and somehow relay the requests from inside of iframe to the in3 client it would make the flow much more smoother and code much more cleaner.
  2. The SDK requires tests.

Links:

Integrate incubed client as a subprovider in portis

See merge request hardware/portis-web-sdk!1
@chirag-parmar
Copy link
Author

Well it's been two months since I posted this pull request. Since I see no interest from your side I'll take the liberty in assuming that you don't see IN3 client as a game changer for your wallet. Let me know if I should close this pull request already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant