Search code examples
cryptocurrencysolana

How to decode a solana transaction?


I am trying to decode a serialized Solana raw transaction the issue I am facing is I couldn't find any files nor code related to this on the Solana web3 JS library could anyone please advice ?

I was going through this file

https://github.com/solana-labs/solana-web3.js/blob/master/src/transaction.ts

thanks


Solution

  • To decode an unsigned transaction The txBufferFromHex variable should contain

    { 01 + empty 64 byte signature (64 bytes of 00) + unsigned transaction } 
    

    then the from method will out put decoded instruction set

    const tx = Transaction.from(txBufferFromHex);