dev-handmade
dev-handmade

Reputation: 41

Solana web3 , Solana Transaction instruction

How to decode the transaction instruction of Solana. Is there any method to decode the instruction? I want to know which function is called and what value has been passed to the function of the confirm transaction.

{
  accounts: [
    PublicKey {
      _bn: <BN: 4e3dddc4432d52a4510a65a551fe9609e40fdde17f0f1fed0fa1b662552a924>
    },
    PublicKey {
      _bn: <BN: 8bedee11df6c633066f828b4db846bb04e160c07bbc61b742a91e51d20331586>
    },
    PublicKey {
      _bn: <BN: ced56b1e55038a553b5b1c31fa1ba904ad30af10f22d923dabb3e69322da2b8d>
    },
    PublicKey {
      _bn: <BN: c098b630b69e859bde1df6ce8ad39c2243db4459083125256e4b27e7c62de7f>
    },
    PublicKey {
      _bn: <BN: 16228ec1b77f0c7197cfdea23c3d50b8d92508a642c91b9bea67d4710bfa984d>
    },
    PublicKey {
      _bn: <BN: b86458f62281bc74b8f544da6487dfc657ee7832aa3b435f475fd21922279a69>
    },
    PublicKey {
      _bn: <BN: 527795c14c5338c374c3f48d386d50f488af264897a7c8682430cd7e91a1b978>
    },
    PublicKey {
      _bn: <BN: 13a9bd13051abed54dcabff54958d96934dbe396a473b33647e4fb1a34214bca>
    },
    PublicKey {
      _bn: <BN: bfb90c7dba5c6dfee8d467ff178309c91fb7a2731bac6dfcc47f94832aac868>
    },
    PublicKey {
      _bn: <BN: daad6a822b10d8e5085e92082b5f0945cd98b85eadb2e79d6f905aafcb276afe>
    },
    PublicKey {
      _bn: <BN: 4fc695b84c7f4a4a9db0b1c69570bda1d784397125da32ffa59b7bdbf3046c4e>
    },
    PublicKey {
      _bn: <BN: 467fc328638c0f707a0d8260bf623de038bf0c17fadb1e7c84ac1b25dcb8a0a5>
    },
    PublicKey {
      _bn: <BN: 48f9307a5aa0ef256bc9036e6c05e941c2f324c6b32f52bc256156684b26054e>
    }
  ],
  data: '12VeXEcej',
  programId: PublicKey {
    _bn: <BN: 850f2d6e02a47af824d09ab69dc42d70cb28cbfa249fb7ee57b9d256c12762ef>
  }
}

Upvotes: 0

Views: 1030

Answers (1)

0x nineteen
0x nineteen

Reputation: 64

the 'data' field usually will include a flag which defines what function to call along with the arguments for that function. To parse the data to a readable format, you need to know how the program is implemented/how it parses the data passed to it.

If its an anchor program then the first few bytes refer to the hash of the function name called to it and the rest of the data contains the arguments passed to the function.

Upvotes: -1

Related Questions