Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Block Optimization on the Solana Network ! #452

Unanswered
suigor asked this question in Q&A
Discussion options

Good afternoon

In connection with this event https://solana.com/news/block-optimization-on-the-solana-network it becomes almost impossible to use the library, since it is impossible to send a transaction without a priority commission!

it is impossible to use the services; It is recommended to add a priority fee to the transaction.

https://docs.helius.dev/solana-rpc-nodes/alpha-priority-fee-api
https://docs.chainstack.com/docs/solana-how-to-priority-fees-faster-transactions

ComputeBudgetProgram is missing (example of implementation in the Tupe script https://github.com/solana-labs/solana-web3.js/blob/3da6574/packages/library-legacy/src/programs/compute-budget.ts#L227), with with which you can specify in the transaction the size of the priority commission accepted by the node.

implementation that is not in SOLNET on wen web3.js

const AdvanceNonce = SystemProgram.nonceAdvance({
noncePubkey: nonceAccountPubkey,
authorizedPubkey: nonceAccountAuth.publicKey,
});

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

const addPriorityFee = ComputeBudgetProgram.setComputeUnitPrice({
microlamports: 20000,
});

persistent transaction = new transaction()
.add(advanceNonce)
.add(modifyComputeUnits)
.add(addPriorityFee)
.add(
SystemProgram.transfer({
fromPubkey: payer.publicKey,
toPubkey: toAccount,
lamps: 10000000,
}),
);

is it possible to add this implementation to the library?

You must be logged in to vote

Replies: 2 comments

Comment options

something like this is required

public class ComputeBudgetProgram
{
public static readonly PublicKey ProgramId = new PublicKey("ComputeBudget111111111111111111111111111111");

public struct RequestHeapFrameParams
{
 public ulong Bytes;
}
public struct SetComputeUnitLimitParams
{
 public ulong Units;
}
public struct SetComputeUnitPriceParams
{
 public ulong MicroLamports;
}
public static TransactionInstruction RequestHeapFrame(RequestHeapFrameParams params)
{
 var data = new byte[] { };
 return new TransactionInstruction
 {
 Keys = new List<AccountMeta>(),
 ProgramId = ProgramId,
 Data = data
 };
}
public static TransactionInstruction SetComputeUnitLimit(SetComputeUnitLimitParams params)
{
 var data = new byte[] { };
 return new TransactionInstruction
 {
 Keys = new List<AccountMeta>(),
 ProgramId = ProgramId,
 Data = data
 };
}
public static TransactionInstruction SetComputeUnitPrice(SetComputeUnitPriceParams params)
{
 var data = new byte[] { };
 return new TransactionInstruction
 {
 Keys = new List<AccountMeta>(),
 ProgramId = ProgramId,
 Data = data
 };
}
private static byte[] EncodeData<T>(T params)
{
 // Here it is necessary to implement the logic for converting the parameter structure
 // into an array of bytes that will be sent in transactions.
 // This may include using BitConverter for numeric values
 // and adding the required command bytes at the beginning of the array.
}

}

You must be logged in to vote
0 replies
Comment options

Thanks to all participants for the code.

Here is the implementation https://github.com/brunopedrazza/Solnet

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant

AltStyle によって変換されたページ (->オリジナル) /