DevTool SPS proposal: steem trx finder

in #steem5 years ago (edited)

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

Sort:  

30.36$ has been spent to promote this content using Steemium.
Learn more here!

You got a 29.15% upvote from @promobot courtesy of @steemium!

To listen to the audio version of this article click on the play image.

Brought to you by @tts. If you find it useful please consider upvoting this reply.

If you can explain what does it mean, I shall flood you with STEEM brother

Posted using Partiko Android

I really need to find my old post, that is a great thing because I can make a list of old post which I want to read again and again.

What You ask for is to build full witness node with get_transaction call enabled.

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.032
BTC 63041.44
ETH 2985.81
USDT 1.00
SBD 3.61