Firstly, do I understand correctly that CPI call is one of the ways to call a method of program?
If so, only by examining a TX on the blockchain, will it be possible to distinguish a CPI call to a program from a normal one?
A CPI is when a program calls another program during a transaction.
You can see CPI as inner instructions in the solana explorer:
Here an example: https://explorer.solana.com/tx/625sih8CkKT4pknX4JXuZSpH7awjfhDYcFpCDQDuwSTRxc9dD6JH5emk8Fi4TVQmWaeWiHS7xhD22s72LDHoaeQL
You can see its using the Jupiter Accounts Route and then does a CPI to flux beam.
You can see its using the Jupiter Accounts Route and then does a CPI to flux beam.
-- I see a list of accounts and TXs. Where precisely is that observed?
When you fetch a transaction with the getTransaction
endpoint, you'll get all of the top-level instructions in the transaction in transaction.message.instructions
, which are not CPIs. You'll also get the meta.innerInstructions
, which are all of the CPIs.
More information at https://solana.com/docs/rpc/http/gettransaction