DevTool SPS proposal: steem trx finder

block-chain-3513216_1920.jpg
Image source pixabay

Greetings,

Some of you guys know me already, some not, I have been working and collaborating in the STEEM dev ecosystem for more than 2 years.

This nodejs/Javascript tool is half-way done, and was born out of pure necessity. However, there are still plenty of things to be done.

The public npm package is already published.

If you think this is a good tool, please vote me. The development should only take one more week to finish everything.

Why would a developer need the full Transaction object?

Say, for instance, that a developer needs to verify the account signer of a vote. He would go request to the rpc-api endpoint get_account_historyfor the desired account, and loop over until finding the right match.

Guess what? The returned "pseudo-transaction" has no signature. Neither has extensions, ref_block_num or ref_block_prefix.

So basically, no signature, no way to know who is the actual signer. Developers have currently a big trouble linking operations with the full Transaction object.

Purpose

STEEM rpc-api database endpoint get_account_history does provide only a pseudo-transaction object. This is the form of the returned object:

[
  31896,
  {
    trx_id: '268de18b9d381eeaa71419c1454f5f229c785235',
    block: 35683670,
    trx_in_block: 19,
    op_in_trx: 0,
    virtual_op: 0,
    timestamp: '2019-08-19T08:15:21',
    op: [ 'vote', [Object] ]
  }
]

This pseudo-transaction object is missing valuable information such as:

  • Signature
  • extensions
  • expiration
  • ref_block_num
  • ref_block_prefix

If you need the full trx object, this library will help you.

Under the hood

This tool is basically iterating over the blocks looking for the right time interval. We know each block happens every 3 seconds, so the algorithm does some date approximations searching in the blocks archive until finding the right one. Once the right block has been found, the full trx can be returned.

Use

This library has been design with async requests in mind.

If you want to initialise a dsteem client:

var dsteem = require('dsteem')
var client = new dsteem.client(rpc_node_address)

Each method call requires a client instance passed as argument.

There are two methods available:

  • findCommentTrx(client, author, permlink)
  • findVoteTrx(client, pseudo_trx)

Install

$ npm i steemtrxfinder --save

Configuration

TBD

TO-DO

  • Add tests
  • CLI
  • browser support
  • Add more operations support

NPM public package

https://www.npmjs.com/package/steemtrxfinder

Github

https://github.com/AusPrinzip/steemtrxfinder

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now