Skip to main content

New answers tagged

1 vote

Is it possible to get txn ID in solana program?

To put it simply: no. An on-chain program does not have access to the signature bytes of the executing transaction, unless it's passed in as instruction data. I don't think you're asking this, but ...
Jon C's user avatar
  • 17.8k
1 vote

Error: Function Stack offset of 7256 exceeded max offset of 4096 by 3160 bytes, please minimize large stack variables

What @Jonas H. Says about this case is true , But there are still some stack frame errors, SO Ultimately what i did was Downgraded my anchor version to 0.25.0, which it previously was when it was ...
Abhishek Faliya's user avatar
1 vote

How to manipulate a list of PDA in anchor

The error proc-macro panicked: Invariant violation: composite constraints can only be raw or literals talks about the limitation of the Anchor framework. As of now (I believe with current Anchor ...
chalda's user avatar
  • 1,442
1 vote

Error: Function Stack offset of 7256 exceeded max offset of 4096 by 3160 bytes, please minimize large stack variables

Everything Jonas mentioned above is correct. You'll need to downgrade your Solana CLI version. The last working version I used was 1.18.11. solana-install init 1.18.11 You can leave your original ...
Jimii's user avatar
  • 5,442
0 votes

Error: ELF error: ELF error: Multiple or no text sections, consider removing llc option: -function-sections

@rainbowemoji - that didn't help. Exact same code. Exact same error. [dependencies] solana-program = "2.0.9"
elliecat's user avatar
0 votes

ELF error: Multiple or no text sections, consider removing llc option: -function-sections

@Jimii - where does that attribute go? I have exact same problem and can't find solution anywhere.
elliecat's user avatar
1 vote
Accepted

how to get all Program tokens in ProgramID in Solana network mainnet ecosystem with javascript

Most public endpoints like https://api.mainnet-beta.solana.com or https://solana-api.projectserum.com have the getProgramsAccounts call ratelimited or disabled because its very expensive. You can try ...
Jonas H.'s user avatar
  • 6,352
2 votes
Accepted

Error: Function Stack offset of 7256 exceeded max offset of 4096 by 3160 bytes, please minimize large stack variables

There is an anchor bug in combination with solana version 1.18 which is causing this error: Function ZN105$LT$vprog..InitializeStrategy$u20$as$u20$anchor_lang ..Accounts$LT$vprog.. ...
Jonas H.'s user avatar
  • 6,352
2 votes

Get genesis hash in program

The genesis hash for a cluster is not exposed to programs. If you want to know which chain you're on, you can build some constant into your program, which varies based on the deployment cluster, ie: #[...
Jon C's user avatar
  • 17.8k
1 vote

TypeError: x.pubkey.equals is not a function

The transfer instruction expects public key arguments for the values. const from pubkey = wallet.publicKey; const toPubkey = new PublicKey("8jwDvVpTUyfpLuQRVimBnhafDJqR8458U9rp1SXASFB3"); ...
Jimii's user avatar
  • 5,442
0 votes

Error (-32002): Error processing Instruction 2: Provided owner is not allowed

The create ATA instruction expects the owner to be the "owner account". It doesn't represent the account authority as you've used it above Use either the SPL Tokens program id or SPL Token - ...
Jimii's user avatar
  • 5,442
0 votes

is there any instruction can set the max slot

Since blockhashes last 150 blocks before they're rejected by the cluster, there's a cheeky way to do this by using an older blockhash that is close to expiry, but not quite expired. For example, you ...
Jon C's user avatar
  • 17.8k
0 votes

Error: "Transfer: `from` must not carry data"

The error says: "from must not carry data" This means that during a transfer with the system program, the source account (the one sending the funds) cannot have any data on it. In this case, ...
Jon C's user avatar
  • 17.8k
0 votes
Accepted

How to close SPL token account in Python

The signature appears as 111111.... because it isn't actually signed -- those ones correspond to an array of zeroes. Be sure to sign the transaction before sending it: tx = Transaction....
Jon C's user avatar
  • 17.8k
0 votes

How to deal with same transaction hash of multiple transaction?

I'll typically tack on a self transfer for different lamport amounts if I want to spam transactions. You can also poll for new blockhashes every ~400ms as they're produced by the cluster. Note that ...
Jon C's user avatar
  • 17.8k
2 votes
Accepted

Get current stack offset in solana program

It's a bit tricky, but there's a couple of ways. Let's go through the basics first. Every stack frame in a Solana program takes up 4096 bytes The stack address starts at address 0x200000000 according ...
Jon C's user avatar
  • 17.8k
2 votes
Accepted

Retrieve the upgrade authority of current program

You should be able to do that using the instruction sysvar. Here is an examples: https://solana.com/developers/cookbook/programs/read-multiple-instructions pub fn read_multiple_instruction<'info&...
Jonas H.'s user avatar
  • 6,352
2 votes
Accepted

Fuzz testing with system program

There's no simple way unfortunately. The system program's instruction processor is written with native program hooks like the invoke context: https://github.com/anza-xyz/agave/blob/...
Jon C's user avatar
  • 17.8k
1 vote
Accepted

using event vs subscribing to account changes

If you mean anchor events i'm pretty sure they do the same thing as logging and listening to program logs. They log smth and in the client listen to the logs via ws connection. (https://github.com/...
Jonas H.'s user avatar
  • 6,352
0 votes

How to deploy a token and put it on a DEX

I recently put this together, should help you out a guide. https://github.com/GMAn0n/Solana
Jay's user avatar
  • 1
1 vote

Setting a price to create SPL Tokens

you just have to add a transfer instruction in the transaction. You have an example on this page : https://solana.com/docs/core/transactions
Effe2's user avatar
  • 1,525
0 votes

Secret Key format issue in .env file

Make sure that your .env file is formatted correctly. i.e. the SECRET_KEY should be enclosed within square brackets. SECRET_KEY=[233,210,9,123.....]
Kirtiraj Thakor's user avatar
1 vote

Error: "Transfer: `from` must not carry data"

can we have a signature ? I think you are trying to transfer SOL from a token account ? EDIT: you are not transferring SOL from a token account. However, there is a transaction here that seems to be ...
Effe2's user avatar
  • 1,525
1 vote

Some of SOL being expended from wallet when I swap with Raydium how can i fix that?

In your case, the sol are sent back to you, you can read it in the green circle you made. "and redeem to EBC..."
Effe2's user avatar
  • 1,525
0 votes

Some of SOL being expended from wallet when I swap with Raydium how can i fix that?

Your SOL is being used to create an account. Rent is needed so that your account is alive and can be read/written to by validators. Yes, it's possible to close the account and recover the SOL back if ...
Jimii's user avatar
  • 5,442
0 votes

How to deal with same transaction hash of multiple transaction?

You could e.g., add the ComputeBudget instruction with some slightly different tip (like add 1 lamport) to the same transaction you want to "double send" (https://solana-labs.github.io/...
chalda's user avatar
  • 1,442
0 votes

How do I change the upgrade authority of a program?

Using the CLI: solana program set-upgrade-authority --keypair <KEYPAIR_OF_NEW_UPGRADE_AUTHORITY> <PROGRAM_ADDRESS> --new-upgrade-authority <NEW_UPGRADE_AUTHORITY> If you don't want ...
Farman Shaik's user avatar
2 votes
Accepted

Does the order matter when submitting a increase compute budget instruction

It does not. If you check the compute budget calculation code here you can see it iterates through all instructions to find the ones that set the CU Limit and CU Price.
Jon C Fan's user avatar
  • 5,229
0 votes

Get SPL Token Holders

ok for those of you don't want to use Helius, this is how I got it. const { Connection, PublicKey } = require('@solana/web3.js'); const { TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID, getMint } = require('@...
Lonewarp's user avatar
0 votes

cargo build works but `cargo build-sbf` and `anchor build` fail with unsupported target error

i am actually facing same issue, mine doesn't generate an error, cargo build-bpf does nothing, same with anchor build, it does absolutely nothing , doesn't log any error , doesn't generate .so file, i ...
Johnson's user avatar
0 votes

Solana Program - Rust Borsh serialization issue

const buffer is undefined, fix it.
Edinaldo Junior's user avatar
0 votes

sendAndConfirmTransaction does not exist for typ connection

Instead of calling connection.sendAndConfirmTransaction, you can use the sendAndConfirmTransaction function imported from @solana/web3.js.
Edinaldo Junior's user avatar
0 votes

project-8-token-lottery: Error InvalidSecpSignature when run anchor test

Apparently the signature is wrong. You can checkout how to make a lottery program here: https://medium.com/@edinaldo-jr/beyond-simple-tutorials-building-a-lottery-game-on-solana-blockchain-with-anchor-...
Edinaldo Junior's user avatar
1 vote
Accepted

Can you derive the program owner of a SPL token?

This is not possible. You need to request to determine whether an account is actually on the Solana state. For example, with an ATA it's possible to derive the address using the wallet and token mint, ...
Jimii's user avatar
  • 5,442
0 votes

How to get the taxes from the tax I created on my token?

There are currently two solutions available for token creators to withdraw transfer fees: Use the Solana SDKs to develop custom code that can be run periodically. A detailed guide is available to ...
ppoliani's user avatar
  • 101
0 votes

how can the solana contract verify that this signed message and the address are matched

You can use the ed25519 program to verify additional signatures in your transaction. You can create an instruction simply doing the following: let ix = new_ed25519_instruction(keypair, "...
Jon C's user avatar
  • 17.8k
2 votes

How to create a private cluster on Solana?

These are the basic steps: Set up AWS infrastructure (Provision 2 to 3 EC2 instances) Install Solana software (SSH into each EC2 instance) Configure and Bootstrap the Cluster Monitor and Maintain the ...
Hawa Kallon's user avatar
4 votes

Can not use account after allocate the space

Account Type Change: When you allocate space on an account using SystemProgram.allocate, it changes the account's type from a system account (which can hold SOL and send transactions) to a program ...
Saidu's user avatar
  • 446
1 vote
Accepted

Error: Invalid secret key in environment variable 'SECRET_KEY'!

There were some issues with that version. Update to the latest version and this should be resolved. npm i @solana-developers/helpers@latest
Jimii's user avatar
  • 5,442
1 vote

Received transaction details with status 200

This is the public RPC endpoint, it free for all and for that not advisable to use on a production setting because of the many limitations imposed on it. Maximum number of requests per 10 seconds per ...
Jimii's user avatar
  • 5,442
0 votes

Error creating RWA Metadata: unknown signer: 8YPeMc8CkWyW95SExgKz6o8pKuKfn1H3Bqvu6HWk81dX

unknown signer error might occur when you try to send your transaction with a non-signer address. In your test cases, is the creator address similar to that of your anchor workspace?
Jimii's user avatar
  • 5,442
0 votes

how can the solana contract verify that this signed message and the address are matched

you don't need to check it in a program, you can check it in javascript : const message = new TextEncoder().encode("testMessage") const uint8arraySignature = base58.decode(signature); const ...
Effe2's user avatar
  • 1,525
0 votes

How can I write unit tests with a future timestamp?

i am not sure to understand where is the problem here ? Just get the current timestamp and add X seconds to it ?
Effe2's user avatar
  • 1,525
0 votes

Attempt to debit an account but found no record of a prior credit.How to solve?

As @andnasnd mentioned it's I got rid of this by waiting for the airdrop transaction to be finalized: ... await Promise.all( [user1, user2].map(async (k) => { return await anchor ...
Daniel Pavel's user avatar
0 votes
Accepted

will it fail if the program tried to create an account with the same seeds multiple times , although the bump exists ? using anchor

it will fail with an error "account already in use". Same seed = same address. You can't create an account that already exists. If your seed is constant like this, why not creating the ...
Effe2's user avatar
  • 1,525
0 votes

Suddenly getting error message: Safety checks failed: Failed to get program path

Had all rust analyzer features turned on using the following line in my settings.json { "rust-analyzer.cargo.features": "all", } Removing the line got rid of the errors for me
Jimii's user avatar
  • 5,442
1 vote

I try to transfere my SOl from account but get (os error 2)

It seems that the paths you are providing the command are wrong. Check that your local paper wallet exists in the ~/.config/solana directory. From your question, it seems that you'd like to use ...
Jimii's user avatar
  • 5,442
1 vote
Accepted

Convert TS to JS return " x is not a constructor "

Check the Export in Raydium.ts: If Raydium.ts uses export default: export default class Raydium { } In this case, the correct JavaScript import would be: const Raydium = require('./Raydium')....
Hawa Kallon's user avatar
1 vote

Are There Any Big Brands Using an SPL Token?

While no major non-crypto companies have launched an SPL token specifically, brands like Reddit, Nike, and Tesla have successfully integrated blockchain-based tokens or cryptocurrencies into their ...
Hawa Kallon's user avatar
1 vote

How to verify written solana program buffer account data and uploaded program build file with checksum?

I am not familiar with checksum, but if you want to verify solana programs, check out the verifiable build CLI tool. You can use the anchor CLI for building verifiable programs and documented here ...
Jimii's user avatar
  • 5,442

Top 50 recent answers are included