Kasplex Indexer
Here you can learn about how the Kasplex indexer works and even build your own.
Last updated
Here you can learn about how the Kasplex indexer works and even build your own.
Last updated
The Indexer operates by continuously monitoring the blockchain for new blocks and transactions. For each token transaction, the Indexer updates the corresponding token balances for the involved addresses, maintaining a detailed record of token ownership and distribution. It also stores metadata associated with each token, including its name, symbol, total supply, and any custom properties defined by token deployer.
The Indexer scans all transactions in each block, extracting the scriptPubKey
.
It checks its type, specifically looking for Pay-to-Script-Hash (P2SH)
.
If the script type is P2SH, the UTXO is cached into the database. This caching ensures that future references to this UTXO do not require re-parsing the blockchain.(and to avoid being unable to query due to pruning)
The Indexer then extracts the signature script from the first input (Inputs[0]) of the transaction.
It checks for any KRC-20 related opcodes within the signature script.
Upon detecting a KRC-20 opcode, the Indexer computes the transaction gas fee using the cached UTXO data.
The Indexer parses the KRC-20 relevant data from the transaction and stores this information into the database.
This information includes various state changes triggered by the specific KRC-20 opcodes detected in the transaction.