
Welcome to the third issue of the “Play to the Solana” series.In the 1st article, we have learned the operating mechanism, account model and trading structure of Solana blockchain; in the second article, we have learned how to use Rust to write a Solana program for publishing and displaying articles and and displaying the article.Use TypeScript script to test it.
>
As the last period of this series, this article will lead everyone to use Phalcon Explorer to analyze a simple Solana transaction.But before that, let’s take a look at how the Token on Solana was realized.
About tokens
The Token on Solana can be divided into two categories: native token and other Token.
Native token is actually solana token (solo).We mentioned in the previous article that each account in Solana has a LAMPORTS field, and Lamports is actually the smallest unit of Sol Token (1 SOL = 1 billion LAMPORTS), which records the balance of Solana Token.
For other token, Solana uses a program account (token program) and two data accounts (MINTACANT and Token Account) to achieve all the functions required by the token.
Token Program
Token Program structure schematic diagram
Token Program is a program account provided by Solana Program Library (SPL), so the Executable field of the Accountinfo is displayed as true.
As we introduced in the first article, the owners of all program accounts are BPF Loader, and Token Program is no exception.In addition, like System Program, token program is also a fixed address deployed on the Solana chain.
As a program account, it implements several instructions to provide different functions.For example, some instructions are used to create a Mint Account to initialize a new token, or to create a token amount to record the number of token held by a certain address; other instructions provide all functions required to use token, such as, such as token, such as token, such as token, such as token, such as token, such as token, such as token, such as token, such as token, such as token, for exampleIncrease the Mintto instructions with the number of token, or to transfer the token transfer instructions between a pair of addresses.
It should be noted that because token program is responsible for creating Mint Account and Token Account, it is also the owner of these two accounts.
Mint accomet
The structure and relationship of the Mint Account are shown below: Mint Account is a data account, which means that the Executable field of the Accountinfo field is false.
On Solana, each token corresponds to a Mint Account.Mint Account records the total supply of this type of token and has information such as the account address of the token permissions.
Token account
Token Account is used to record the number of individuals holding a specific token.For a certain type of token, every account holding the token has a token account.If a user has 5 token, then TA will have 5 token account.
Token Account, as a data account, the Data part of its accountinfo consists of three fields:
-
Mint: The address of the mint account corresponding to the token account;
-
Owner: The account that has the right to transfer to the token in the token account, that is, the real “Owner” of the token;
-
Amount: The current number of token held by Token Account.
-
Token account structure diagram
It should be emphasized that the Owner field in the accountinfo and the owner in the Data field are completely different.The former is a field owned by every account in Solana. It indicates which address has the permissions that directly modify the current account data; the latter indicates that the token recorded by the Token Account actually belongs to. The field itself itselfIt is part of the accountinfo data field.
Link the above content, and we can get a schematic diagram of the following account relationship.Whether it is System Program or Token Program, they are deployed in the only address on the blockchain and exist in the form of library; a wallet account may also hold multiple token account at the same time, which is the real “Owner” of these token account;The Mint field of the same type of Token Account points to the only Mint Account of the token, and the account records the total supply and other information of the Token.
View the change of the token account in Solscan
We can use Solscan to view the changes in the token account in a transaction:
https://solscscas.io/tx/byrn8qtnaysdvgagck4kmzv1m89b7ufuy1cn96W6FEMP7WGWYMLQJ2HPBEGQN9E7NVGHWPQDFQCDJKPH #TOKENBALANCECHANGANG E
>
The address column lists all the token account involved in the transaction;
Owner columns marked the real “owner” of the token, which is the OWNER in the Token Account Data field;
The token column corresponds to the current token Mint Account. We can click the $ SON of the first line to view it further:
>
It can be seen that the Owner Program in Profile Summary pointed out that the owner of the current Mint Account is token Program. So far, we all correspond to the three types of accounts in Solscan.
However, the display method of Solscan may bring some misunderstandings.For example, in the first line of the first line, the increase in Balance of the first line belongs to the address CHS9WAJYFFUAAZRK2JC7HRJVPHXMG5FC94GTAPBNLJUY, or Raydium Authority v4?This display method undoubtedly increases the cost of understanding.
In addition, readers may also find that Solana Token and other Token in Solscan are displayed separately in the two sections.Although this division method is technically reasonable, it is easier to understand if they can be regarded as Token in the same sector when they can be regarded as token.
Phalcon Explorer not only solved the above problems, but also made a lot of other innovations for Solscan. Next, let’s use Phalcon Explorer to take a look at the same transaction.
It is recommended to open the link and analyze with our steps. This can better understand the transaction details and feel the powerful feature of Phalcon Explorer?
https://app.bocksec.com/explorr/tx/solana/bybyrn8qtnaysdvgagck4kmzv1m89b7uufuy1cn96w6wgwymlqj2mp9E7NVGHWPQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQDFQQDFEQN that the same jkph
Use Phalcon Explorer to view and analyze transactions
>
It can be seen above the Phalcon Explorer that the current transaction is recognized as a JITO MEV transaction, and you can jump to Solscan by clicking the solana logo next to the transaction signature.
The information about this transaction is divided into four sections, namely: BASIC Info, Fund Flow, Balance Changes and Invocation Flow. You can switch to the corresponding part by clicking the icon in the upper right corner.
Basic Info
>
The information of the Basic Info column is relatively simple, which provides some key information about the current transaction.Similar to the signature of the transaction, you can also click the block number and the signature address to jump to Solscan.
Fund Flow
>
The Fund Flow column provides analysts with the capital flow transfer and timing information generated during the transaction execution.We can see:
-
The sponsors and signatures of the transaction 59VLESMV5VCCGTXJHCORIXKNGHDVCQ7DGX98V9HCN2F first transferred a certain amount
-
Then Raydium Authority V4 was transferred to the signature 59VLeSMV5VCCGTXJHCORIXKNGHDVCQ7DGX98V9HCN2F transferred to about 6.747;
-
Finally, the signature also provided Jito with a tip of the transaction of 0.000003 SOL token as a Jito verifier.
The figure below shows the flow of funds in SOLSCAN.Compared with Solscan, each address in Phalcon Explorer flows to the only node to the diagram, so it can be easier to find the capital flow relationship between the address and improve the efficiency when the analysis is improved.
>
If you want to make a deeper analysis of the flow of transactions, you can click the brown identification in the upper right corner to enter the Metasleush.
Balance Changes
>
The Balance Changes column clearly shows us the changes in all token after the current transaction is over.
For example, the signature of the transaction 59VLESMV5VCCCGTXJHCORIXKNGHDVCQ7DGX98V9HCN2F has three token changes, namely the native SOL token, named 61hh8udg7zruvg3bhymulnc8RBFTWI8UKP T T OKEN, and Wrapped Sol token.
Each of each of the Uccount Address that appears in Balance Changes has one or more token account. By clicking the corresponding address, it can copy or jump to Solscan.
We can see that Phalcon Explorer does not distinguish SOL token and other Token, so it can directly reflect the changes in all token in a certain account, and can more intuitively display the relationship between the token account and its Owner.
Invocation flow
>
Invocation Flow records the instruction execution process of the transaction, each of which corresponds to a instructions in the Solana transaction execution.
Here, we focus on the two instructions involving the token transfer of 2 and 4.
Article 2 The instruction calls the SwapBasein of Raydium AMM to sell token.Expand this instruction can be seen that it consists of two CPI (Cross Program Invacation) instructions. The role of these two instructions is to transfer between Raydium Authority V4 and trading signatures;The process of paying tip.
As shown in the figure below, by clicking the Uccounts tag after the instruction, we can view all the accounts involved in the instruction.Compared with Solscan, this display method will be more concise, allowing analysts to focus on more critical information in the transaction.
>
in conclusion
In this article, we first introduced the implementation principle of the Token in Solana, and then used Solscan to check the change of the token account in a transaction.Finally, we used Phalcon Explorer to further analyze the transaction and introduced the details and optimization details of Phalcon Explorer’s function.