Coder Social home page Coder Social logo

mehr53 / fantom-staker-info Goto Github PK

View Code? Open in Web Editor NEW

This project forked from block42-blockchain-company/fantom-staker-info

0.0 0.0 0.0 3.83 MB

A dapp on Fantom Opera to browse information about the network and its validators.

Home Page: https://explorer.fantom.network/staking

License: MIT License

JavaScript 11.71% Python 47.44% CSS 6.24% HTML 7.37% Solidity 27.24%

fantom-staker-info's Introduction

Fantom Staker Info

Why

Fantom delegators have a hard time finding the right validators to delegator their FTM to. The community started some efforts to create more transparency and collect more information about validators but nothing was nice and easy to use. There also were issues keeping the data up-to-date because it was maintained in a centralized manner.

How

By creating a smart contract that interacts with the SFC smart contract. It allows each Fantom validators to add and update information (a URL to a JSON file) about themselves, so delegators have more insights who they are, without the involvement of a third party. A small backend application continously fetches all the validator data (to take load off the clients) and a frontend application displays it to users and delegators in a nice way.

What

The smart contract is already deployed and can be found on the Fantom Opera MainNet at the following address:

0x92ffad75b8a942d149621a39502cdd8ad1dd57b4

FTMScan: https://ftmscan.com/address/0x92ffad75b8a942d149621a39502cdd8ad1dd57b4

How it looks like

image

Most of the information that is shown is fetched automatically, but there are a few parameters than can be set by validators.

Update your validator info

Config File

Create a config file in JSON format that contains the following parameters (you can also leave parameters empty):

{
  "name": "VALIDATOR_NAME", /* Name of the validator */
  "logoUrl": "LOGO_URL", /* Validator logo (PNG|JPEG|SVG) - 100px x 100px is enough */
  "website": "WEBSITE_URL", /* Website icon on the right */
  "contact": "CONTACT_URL" /* Contact icon on the right */
}

/* It could look something like this ๐Ÿ‘‡ */

{
  "name": "block42",
  "logoUrl": "https://files.b42.tech/fantom/block42.png",
  "website": "https://block42.tech",
  "contact": "https://t.me/block42_fantom"
}

Then host it somewhere so it is publicly accessible!

Update your info in the smart contract

  1. Connect to your validator node
  2. Open up a lachesis console session via lachesis attach
  3. Load the StakerInfo contract ABI and instantiate the contract
abi = JSON.parse('[{"inputs":[{"internalType":"address","name":"_stakerContractAddress","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stakerID","type":"uint256"}],"name":"InfoUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"stakerInfos","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_stakerContractAddress","type":"address"}],"name":"updateStakerContractAddress","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"string","name":"_configUrl","type":"string"}],"name":"updateInfo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"_stakerID","type":"uint256"}],"name":"getInfo","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}]')
stakerInfoContract = web3.ftm.contract(abi).at("0x92ffad75b8a942d149621a39502cdd8ad1dd57b4")
  1. Call the updateInfo function of the StakerInfo contract (make sure you have enough FTM on your wallet to cover the transaction fee)
stakerInfoContract.updateInfo("CONFIG_URL", { from: "VALIDATOR_ADDRESS" })
// e.g.: stakerInfoContract.updateInfo("https://files.b42.tech/fantom/config.json", { from: "0xa4ddde0afdaea05a3d5a2ec6b5c7f3fc9945020b" })
  1. Validate if you updated your info correctly
stakerInfoContract.getInfo(STAKER_ID)
// e.g.: stakerInfoContract.getInfo(14)

Support

If you have any issues updating your validator info do not hesitate to join our validator group.

fantom-staker-info's People

Contributors

mikepocket avatar

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.