Giter Site home page Giter Site logo

bitcoinwarrior1 / dot-validator-selector Goto Github PK

View Code? Open in Web Editor NEW
12.0 5.0 5.0 1.91 MB

Get the best staking validators programmatically

Home Page: https://james-sangalli.github.io/dot-validator-selector/

License: MIT License

JavaScript 99.76% HTML 0.08% CSS 0.16%
polkadot-development staking

dot-validator-selector's Introduction

dot-validator-selector

Get the best staking validators programmatically.

Introduction

Selecting validators for staking your DOT/KSM is an arduous process and one that is uncertain and confusing for most users. The aim of this module is to auto select validators based on the criteria below so that the user doesn't have to. Since most users are not well versed in knowing which validators are best, this module should make a better decision on average without the time commitment necessary to select your own.

Criteria

This program selects validators based on the following criteria:

  • Their identity is verified
  • Their commission is within an acceptable range e.g. no less than 0.5% and no greater than 20%
  • The validator is not oversubscribed, allowing you to earn rewards as a nominator
  • The validator has skin in the game, represented by their own stake e.g. they have deposited 1000 DOT of their own capital
  • Each validator is run by a unique entity
  • The validator has never been slashed
  • The validator is currently elected to validate transactions and earn rewards

Further reading here.

Getting started

Install the modules with npm i & run the tests with npm run test.

You can also download the module via NPM.

Usage

js

// initialise the polkadot api object 
const { ApiPromise, WsProvider} = require("@polkadot/api");
const api = await ApiPromise.create({ provider: new WsProvider("YOUR_PROVIDER") });

// initialise the selector
const selector = new ValidatorSelector(api, MAX_COMMISSION, MIN_STAKING, ERA); // set ERA to 0 or undefined if you want to use the current era

// get n number of validators matching the criteria
selector.getValidators(n);

> [{ "accountId": "1REAJ1k691g5Eqqg9gL7vvZCBG7FCCZ8zgQkZWd4va5ESih", "identity": { "additional": [], "display": { "raw": "0x506f6c6b61646f742e70726f202d205265616c676172" }, "legal": { "none": null }, "web": { "raw": "0x68747470733a2f2f706f6c6b61646f742e70726f" }, "riot": { "raw": "0x407265616c6761723a6d61747269782e6f7267" }, "email": { "raw": "0x68656c6c6f40706f6c6b61646f742e70726f" }, "pgpFingerprint": null, "image": { "none": null }, "twitter": { "raw": "0x4070726f706f6c6b61646f74" } }, "staked": 156300000000, "commission": "1%" }, ...]

// check if a user's validators are meeting the criteria
selector.getUserValidatorsMeetCriteria(userAccountId);

> [{ "accountId": "13mK8AssyPekT5cFuYQ7ijKNXcjHPq8Gnx6TxF5eFCAwoLQ", "match": false }, ...]

via cURL

Get the latest snapshot with the default criteria.

$ curl https://dot-tool-server.herokuapp.com/dot-validator-selector

See a sample

If you want to see this module in action for Polkadot or Kusama, you can try it out here. It will randomly select 16/24 validators meeting the criteria for Polkadot/Kusama.

Tip

Thank you to the treasury for this tip!

dot-validator-selector's People

Contributors

bitcoinwarrior1 avatar paradox-tt avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

dot-validator-selector's Issues

Remove extension.js file and replace it with dependency from node_modules

Was created because of the following error on bundle:

/Users/jamessangalli/Documents/projects/dot-validator-selector/node_modules/@polkadot/extension-dapp/packageInfo.js:12 path: import.meta && import.meta.url ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', ^ ParseError: Unexpected token

Minimum commission threshold

it's probably better for the long run to use validators that have at least some commission as near zero could be a negative outcome in the long term.

Tool is allowing unidentified validators in

Need to find the criteria to be identified as the tool just checks if a display name is available but the polkadot.js web interface does not accept that alone as identity

web interface enhancements

from /u/Paradox_ParaNodes

  • Allow a dropdown list to select the chain (Polkadot or Kusama)
  • Based on the chain allow for selection of the number of nominators. 1-16 if Polkadot is selected 1-24 if Kusama is selected.
  • Resolve the identities of the responses

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.