Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

290
Views
How to convert txRaw to txHash in cosmos-sdk?

i am using api Cosmos SDK "https://api.cosmos.network/blocks/9888530" to get 1 block details

i get it txRaw: "CpMBCpABChwvY29zbW9zLmJhbmsudjFiZXRhMS5Nc2dTZW5kEnAKLWNvc21vczF0NXUwamZnM2xqc2pyaDJtOWU0N2Q0bnkyaGVhN2VlaHhyemRnZBItY29zbW9zMTNseWxmbHVzYTRwYXRtbDBsamt1ZzRsNjR4NXlsNDYwMzMwa2FlGhAKBXVhdG9tEgcyMDAwMDAwEmkKUgpGCh8vY29zbW9zLmNyeXB0by5zZWNwMjU2azEuUHViS2V5EiMKIQLqGodLEwWelzPDXpDLKlhlpGtk7ZDSVVR8B8pSOSf8YhIECgIIfxjw3iISEwoNCgV1YXRvbRIEMjUwMBCImAUaQNksf4cmAZodzcIEOwNNlFkK1zxGmE3Rtc2/f3JfIqG9HrbeVJhWjrIWizhmwGCYjhcbjpFpX8vCgGEwAyquwaM="

How can i convert txRaw to txHash to use api get detail transaction has : https://api.cosmos.network/cosmos/tx/v1beta1/txs/8689064A44E7F2D6131ED15D014938EB772FD4DFD4348A71F525578E2895D612 Thanks for your help!

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

I found the answer hope it helps someone, simple is :

const txHash = sha256(Buffer.from(txRaw,'base64'))

about 4 years ago · Juan Pablo Isaza Report

0

Thanks for you question and answer. But for me only toHex return correct hash:

const { sha256 } = require("@cosmjs/crypto")
const { toHex } = require("@cosmjs/encoding")

const txRaw = "<raw>"

const txHash = toHex(sha256(Buffer.from(txRaw,'base64')))

console.log(txHash)

Maybe it will be useful for someone...

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!