1

Here's a transaction that requests 1million compute units https://explorer.solana.com/tx/kmkRyvKjWtDuHMbPEGkouXe4Nm3ysdGgiGbr5bzsdnQrXfs7FqnpDWaRBf4KBU91hghPJjTC2Tyv5mcNeTV8nbb?cluster=devnet

Here's a transaction without requesting compute units https://explorer.solana.com/tx/4tbnLrFq7cgBRB3Yr2Jv5iNV2VXwN33NHR9y6G8VurbjnApw5oCdpYHkiJv1KWHFyHcvbbnYXQE2hgevVdAPJCHx?cluster=devnet

Transaction is a simple SOL transfer of 0.1 SOL

const modifyComputeUnits = ComputeBudgetProgram.setComputeUnitLimit({
    units: 1_000_000,
  });

  // Define the amount to transfer
  const transferAmount = 0.1; // 0.1 SOL

  // Create a transfer instruction for transferring SOL from wallet_1 to wallet_2
  const transferInstruction = SystemProgram.transfer({
    fromPubkey: wallet_1.publicKey,
    toPubkey: wallet_2.publicKey,
    lamports: transferAmount * LAMPORTS_PER_SOL, // Convert transferAmount to lamports
  });

  // Add the transfer instruction to a new transaction
  const transaction = new Transaction().add(
    modifyComputeUnits,
    transferInstruction
  );

  // Send the transaction to the network
  const transactionSignature = await sendAndConfirmTransaction(
    connection,
    transaction,
    [wallet_1] // signer
  );

Transaction fee still seems to be 0.00005, but not sure if that's just because the requested compute units aren't being used.

1
  • I also noticed the same thing on devnet. I increased my CU to 400k but the tx fees did not change in any significant way.
    – Jimii
    Commented Aug 29, 2023 at 15:29

1 Answer 1

2

From (https://docs.solana.com/proposals/comprehensive-compute-fees), eventually there will be some multiple of lamports applied per bpf Compute Unit:

"The compute budget portion of the fee will be charged up-front based on the default or requested amount. After processing, the actual number of units consumed will be known, and the payer will be refunded the difference, so the payer only pays for what they used."

However, currently it's a fixed fee per ix, the only modifications to the fee are the number of signatures and the number of signatures in the last block:

(https://github.com/solana-labs/solana/blob/master/sdk/program/src/fee_calculator.rs)

Noting that the number of lamports per signature is almost always the floor/minimum value (5_000) on mainnet/devnet.

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.