pencilflip πŸ„ Profile picture
doing stuff @openai

Nov 23, 2021, 8 tweets

Here's a diagram that shows all the different parts of a Solana transaction.

More details below πŸ‘‡

1/ Each Solana transaction contains a message, and the first part of each message is its header.

The header is simple, it just contains the numbers described in the diagram.

2/ The next part of the transaction message is an array of accounts. They are ordered based on whether they require a signature and whether they are writable.

This array also contains the addresses of the programs used by the instructions.

3/ Notably, Solana forces you to explicitly specify which accounts require signatures, and which accounts are writeable.

That's why when you create an instruction on the client-side (TypeScript in this example), it looks like this πŸ‘‡

4/ The message blockhash is pretty self-explanatory. It's included so that validators can reject txs that are too old.

5/ Solana transactions can contain multiple instructions!

This is important, b/c you may want to execute multiple instructions atomically (i.e. all of them succeed, or all of them fail).

The indexes described in the diagram index into the account addresses array we saw above.

6/ Each Solana transaction also contains an array of signatures.

Each item is a digital signature of the message, signed by some private key.

7/ That's it! For more details, check out the official docs.

docs.solana.com/developing/pro…

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling