Home > Net >  Should transaction costs be calculated?
Should transaction costs be calculated?

Time:03-22

We are currently building a decentralized wallet for a cryptocurrency payment gateway based on the Solana blockchain. From a background in transactions on the Ethereum network, we know that calculating the gas usage used for the transaction is imperative and important if you don't want to be in for a surprise.

Should we reserve this commission also here in Solana?

Is there anything I need to do before sending the transaction to the network?

We know it's been a long time and Solana's commission = 5000 Lamports for a normal transaction

Is this value fixed forever??

 var tx = new TransactionBuilder().
       AddInstruction(SystemProgram.Transfer(sender, toAddress, LamportsAmount)).
       SetRecentBlockHash(LastBlockHash.Result.Value.Blockhash).
       SetFeePayer(sender).
       Build(sender);

 var firstSig = await rpcClient.SendTransactionAsync(tx);

CodePudding user response:

At first, the heaviest compute cost was assumed to be in signature verification, but over time, we've noticed that some transactions are more expensive to run, especially those that are not easily parallelizable, and the network does get congested during points of high activity, which creates a bad experience.

Because of that, there have been many proposals to deal with the problem. Here are a few of them:

And much more.

All that to say, please use the getFeeForMessage endpoint all the time if you need to check the fee: https://docs.solana.com/developing/clients/jsonrpc-api#getfeeformessage

It's the best practice used in all Solana tools.

  • Related