1

As Solana developer, web3.js and CPIs are bread and butter. A recent update on web3.js caught my attention. "Transaction" is deprecated and "VersionedTransactions" with "MessageV0" is the norm. It seems, he developments will make it harder for developers to create transactions. Three questions pop out my mind:

  1. Does it mean we won't create instructions with programId, keys, data anymore soon?
  2. How will "VersionedTransactions" with "MessageV0" affect CPIs?
  3. How does "Sealevel" look like in the new context since there won't be "AccountMeta[]" anymore?

Background information

Address Lookup Tables are reference tables that list and index writeable and readable accounts. It empowers transactions with more capabilities and enable new use cases on Solana by significantly reducing the transaction size through offloading accounts as references on the chain.

With "VersionedTransactions", transactions don't follow the usual simple format with "TransactionInstruction" (programId, keys, data):

  1. instructions[] (programId : PublicKey, keys: AccountMeta[], data: Buffer)
  2. signatures (mandatory)

Instead "VersionedTransactions" have a more complex format with indexes pointing to lists of accounts:

  1. message (header, addressTableLookups, compiledInstructions, staticAccountKeys, recentBlockhash)
  2. signatures (optional)

Good thing, at the moment "MessageV0" can be still compiled through "new TransactionMessage" with the method "compileToV0Message" by providing the following familiar inputs:

  1. instructions[] (programId : PublicKey, keys: AccountMeta[], data: Buffer)
  2. payerKey
  3. recentBlockhash

1 Answer 1

1

This is a few questions rolled into one, but I'll try to address them all. First off, "legacy" does not mean "deprecated", so legacy transactions will always be supported. The web3.js VersionedTransaction can in fact be a legacy Transaction, so you can transition to using that.

  1. Does it mean we won't create instructions with programId, keys, data anymore soon?

You'll still create instructions as before. It's how they get converted into Messages and Transactions that's different. The legacy Message.compile still works https://github.com/solana-labs/solana/blob/8daed75df9a0b5c942ec1cc745a48356db7f46ad/web3.js/src/message/legacy.ts#L109

  1. How will "VersionedTransactions" with "MessageV0" affect CPIs?

Not at all! Programs still behave the same, and the transaction format has no impact on how programs create instructions. The only difference might be that they can provide many more accounts during CPI thanks to address lookup tables.

  1. How does "Sealevel" look like in the new context since there won't be "AccountMeta[]" anymore?

Also no difference! AccountMetas still exist and are used by programs. The runtime just fetches more accounts if there's an address lookup table.

You can read more about Versioned Transactions at https://solanacookbook.com/guides/versioned-transactions.html#versioned-transactions

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.