0

I am new to solana. Can someone suggests ways to:

  1. calculate number of spl-tokens per solana block?
  2. Is there any rpc methods to do so?
  3. How to get solana block height in solana?

1 Answer 1

1

The first question is nearly impossible, since you'll need to query all spl-token mints and sum up their supplies. If you have a snapshot or a ledger tool, then you should be able to do it.

If, however, you just want the supply of a particular spl-token, you can do getTokenSupply from RPC:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc":"2.0", "id":1, "method":"getTokenSupply", "params": ["3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"]}
'

More info at https://docs.solana.com/developing/clients/jsonrpc-api#gettokensupply

To get the block height, you can use getBlockHeight from RPC:

curl https://api.mainnet-beta.solana.com -X POST -H "Content-Type: application/json" -d '
  {"jsonrpc":"2.0","id":1, "method":"getBlockHeight"}
'

More info at https://docs.solana.com/developing/clients/jsonrpc-api#getblockheight

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.