Hey everyone! I’m a bit of a Solana rookie so bare with me please :)

On EVM, you can take a Method ID and Contract Address and essentially describe what the transaction does. For example, you could say that any Ethereum transaction for contract address 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2 where the method id = 0xd0e30db0 is a wrap transaction. I’m not super technical so something important to me is that a simple REST API returns both of these pieces of data (the contract address and method id). Conveniently, Etherscan’s APIs return both of these. Additionally, none of the above information needs to be decoded to describe what is happening in a transaction (or, the function of the transaction - wrap).

What is the equivalent of this on Solana? I’m looking for a way to essentially categorize transactions. I believe the program id/address is the equivalent of a contract address on EVM, but what would be equivalent to the method id? I am guessing it has to be derived from the instruction data. The only pattern I am seeing is that the first couple characters of the instruction data for transactions are matching. For example, in the following Orca add liquidity transactions (randomly pulled from Solscan), I noticed the first characters of the Increase Liquidity instruction data are 2e9cf3760dcdfbb2:

  • hJuoxaWqekQrCiyy7ja4M1mVQzeLk1fNyRdwQYehQPPzyN2q66fcFakwpgca4NsqwyZo45i651hoo5h2bza2iZn
  • 25evH5FmDHgoSQqqcNUTyDKTmHFQXNQFJvNj2wpybdcWkykh8Ko6emd27X6y7La6DnMt1NBtB836Uj11FY8vCcE5
  • 4ZywKdTDqX8FZ6nvhchmPQQBVeznz62miMWLDyrV7WBQoFeEfPySAfXtzhhxAxfm5vTWmrDDitzhGqbDFVkKQRmR

Therefore, do the first couple characters of the instruction data uniquely describe the function that is being executed?

I might be thinking about this completely wrong, but any suggestions on how to categorize various types of Solana transactions would be immensely helpful.

Thank you!

  • dlampach@alien.topB
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    If a Solana smart contract creator wants to they can publish an IDL for the contract, which will tell things about the various functions in a smart contract. If you then viewed that contract in an explorer you could view the IDL.

    AFAIK functions are only called by name in Solana (at least using Anchor), and I have never seen a method ID beyond a function name (could be wrong though).

    I have never seen anything than what appears to be utter randomness from Solana transaction signatures. Given that the signatures are generated from from the ED25519 curve, it doesn’t really seem likely that they would ever fit a pattern.

    What you WILL find are vanity addresses for addresses users can generate. These will have the first several characters be human readable and can be used to categorize addresses. But I’ve never seen a vanity transaction signature.