Git Product home page Git Product logo

mining-fees-information-api's Introduction

Mining Fees Information API

Service that provides an API to mining pools so they can query for their rewards. This API is not part of the RskJ node but retrieves information from it.

Requirements

RskJ node

node.js > v8.9.0

mongoDB v3.4.10

npm install

Configuration

Settings like RskJ node url, mongoDB connection string and API port can be configured at src/configs/config.json file.

Run

Start the gatherer app to fill the database everytime a new block is found on RSK node

node gatherer.js

Start the API server by running

node server.js

For both apps, logging level can be adjusted by using the LOG_LEVEL env variable. For example, run API with

LOG_LEVEL=info node server.js

Use

For this example of use, port 8080 is configured and API server is running on localhost.

Fees for block number 1887 and hash 0xa76cd4d5f1ea81f7ead53ada4e78e89cabdab1c87b13f123029507a5a74c7709 can be obtained by the following GET request:

http://localhost:8080/api/feepayment/block/1887/0xa76cd4d5f1ea81f7ead53ada4e78e89cabdab1c87b13f123029507a5a74c7709

Payment fees found, example response is

{
    "message": "Payment fees found for block number 1887",
    "value": [
        {
            "sender_tx": "0x5e04a60ef2646a0122082076c6b81e7bf02f019f8c7971d16a485e2a12f126cc",
            "to_address": "0x000000000000000000000000dabadabadabadabadabadabadabadabadaba0001",
            "amount": "0",
            "created_date": "2017-11-16T23:45:49.829Z",
            "block": {
                "number": 1887,
                "hash": "0xa76cd4d5f1ea81f7ead53ada4e78e89cabdab1c87b13f123029507a5a74c7709"
            }
        },
        {
            "sender_tx": "0x5e04a60ef2646a0122082076c6b81e7bf02f019f8c7971d16a485e2a12f126cc",
            "to_address": "0x00000000000000000000000028fdc38c327f4a3bbdf9501fd3a01ac7228c7af7",
            "amount": "12340",
            "created_date": "2017-11-16T23:45:49.835Z",
            "block": {
                "number": 1887,
                "hash": "0xa76cd4d5f1ea81f7ead53ada4e78e89cabdab1c87b13f123029507a5a74c7709"
            }
        }
    ]
}

Payment fees not found, response will look like

{
    "message": "Payment fees not found for block number 1890",
    "value": []
}

mining-fees-information-api's People

Contributors

martinmedina 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.