What is the solana transaction actually?

I wonder what action can be determined as a transaction.
Let’s say we have an application that has two actions:

  1. CREATE: Passed the JSON with data, creates an account with the hash of that data
  2. VALIDATE: Passed the JSON with data, it will validate that there is an account with such hash

can those two actions be determined as transactions for which we need to pay?

This would be a transaction. Anything that needs to write to accounts on Solana will need to be done in a transaction.

You would have a smart contract deployed to the network that you would send a custom “create” instruction payload to. The instruction data would contain a flag indicating that it is a create instruction, and it would contain the JSON data. The smart contract would then compute the hash of the data and write it to the account on the blockchain.

In this case, you would have to pay for a transaction fee, which is really small, usually a tenth of a cent and sometimes less, and a storage fee, for storing the bytes of the hash in the account.

This would not need to be a transaction. Through the Solana RPC API you are able to query the chain and get account data, so you could use that API to see if there is an account with the given data without needing to make a transaction or pay any transaction fees.

1 Like