This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

How to derive steem transaction id in Javascript

Words
22
Reading
1 min
Listen
Play
9y

Preparation

Install steem and sha256 npm package
npm install --save steem sha256

Reference

Please refer to below post for creating steem transaction object:
https://steemit.com/steem/@xeroc/steem-transaction-signing-in-a-nutshell

Derive Steem Transaction Id

const sha256 = require('sha256');
const steem = require('steem');

// I will assume that you have already made your transaction object
// const tx;

// signatures are not part of transaction id
tx.signatures = [];

steem.api.getTransactionHex(tx, (err, txHex) => {
  console.log('transaction id:', sha256(new Buffer(txHex.slice(0, -2), 'hex')).slice(0, 40));
});

How to derive steem transaction id in Javascript | Ecency