Skip to main content

New answers tagged

0 votes

Reference to mint is not recognized in Struct creation while trying to create an NFT in Anchor

This tutorial uses an outdated version of mpl_token_metadata. Switch to a Metaplex version >0.4.0 e.g mpl-token-metadata = "4.1.2" Update your Solana version to 1.18.8. You'll face some ...
Jimii's user avatar
  • 3,120
2 votes

Interoperability/Bridging with Solana and other chains

If you're looking for interoperability/bridging options, you can look at the following: Wormhole: https://wormhole.com/ DeBridge: https://debridge.finance/
Joey Meere's user avatar
  • 1,294
0 votes

solana contract rust error anchor build

Try using solana-program with the same version as the CLI: solana --version solana-cli 1.17.34 (src:b04a806c; feat:3746964731, client:SolanaLabs) Update the Cargo.toml: [dependencies] solana-program ...
Kombucha's user avatar
0 votes

Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x2

The error means invalid mint as you can see here: https://github.com/solana-labs/solana-program-library/blob/master/token/program/src/error.rs So im not sure how you created the USDC mint, but maybe ...
Jonas H.'s user avatar
  • 5,727
0 votes

How can I make multisig DAO in anchor?

I would consider getting inspiration about DAO development in the SPL DAO Governance program (under Solana program library, https://github.com/solana-labs/solana-program-library/blob/master/governance/...
chalda's user avatar
  • 1,082
0 votes
Accepted

Using `onAccountChange` in Rust

Figured it out: let listener_client = PubsubClient::new(<WSS URL>).await.unwrap(); // Can add a config instead of None here, but None for simplicity let (stream, shutdown_handle) = ...
Ahri's user avatar
  • 3,920
1 vote

'invalid account data' error when using Immutable Owner extension and Non-transferable extensions together

The provided account length won't be enough, because you also need to include space for the NonTransferableAccount extension. I think it should work if you just change the line creating accountLen to: ...
Jon C's user avatar
  • 15.3k
0 votes

Token swap error 0x26 InvalidSplTokenProgram on raydium rust

I faced a similar issue sometime ago. Issue was that the from and to token accounts i.e. user_sol_account, use_wif_account in your case, were not having token create instructions appended in the ...
Rahul Srivastava's user avatar
3 votes

How to Convert from Account<'info, TokenAccount> to UncheckedAccount<'info>

The two types aren't inherently different under the hood. UncheckedAccount simply skips the validation checks a normal included account would go through in an Anchor instruction. You can attempt to ...
Joey Meere's user avatar
  • 1,294
1 vote

How to Convert from Account<'info, TokenAccount> to UncheckedAccount<'info>

Not sure if I fully understand your question, but you want to convert a typed account to an untyped account? Since both AccountInfo and UncheckedAccount are basically just AccountInfo types, using ....
Jimii's user avatar
  • 3,120
1 vote
Accepted

How to decode account data using Rust?

mpl_token_metadata::accounts::Metadata has a function from_bytes which serializes the bytes into a Metadata struct: let meta: Metadata = Metadata::from_bytes(&account.data).unwrap();
lifeInspection's user avatar
1 vote

Error Number: 2006. Error Message: A seeds constraint was violated

You migh be deriving the lottery address incorrectly, Try this and check whether the tests pass const [lotteryPda, lotteryBump] = PublicKey.findProgramAddressSync( [Buffer.from(lotterySeed), ...
Jimii's user avatar
  • 3,120
1 vote

Cost of creating Spl-Token is higher when I use my own rust code than using generator tools

Usually, the cost for creating the token consists of rent (https://solana.com/docs/core/fees#rent) needed to be deposited to create Solana accounts. On removing accounts from Solana blockchain the ...
chalda's user avatar
  • 1,082
0 votes

Error Deploying Solana Nodes on OVH Machines: QUIC Connection Timed Out

I forgot to mention that I'm working with a private cluster. In a private cluster, I have control over the total supply within the network, so validator stake wasn't the problem. The root cause was ...
dariusjvc's user avatar
0 votes

Error Deploying Solana Nodes on OVH Machines: QUIC Connection Timed Out

At present, the total number of pledges in the network has reached 365m, and 50000sol accounts for about 0.013% of the share. The total number of connections allocated to validators is 2000, so the ...
qingmo's user avatar
  • 1
0 votes
Accepted

Investigating "Access violation in unknown section at address 0xffffffffffffffff of size 32"

The answer here was my program was compiled with an incompatible version of Solana on my system. Looking at the cargo lock file showed 1.14 as a dep, but I had 1.18 installed.
Winston Zhao's user avatar
2 votes
Accepted

How can I initialize an SPL token mint using anchor_client?

I believe, or as I understand, there is no reason to construct the instructions via anchor_client. The Anchor client generates the client abstractions for the Anchor program so that instruction-...
chalda's user avatar
  • 1,082
0 votes

Rust 'target is not supported' error when solana-program version at or above 1.10

The answer from @JohnVersus helped me. The docs have now been moved to: https://solana.com/docs/programs/lang-rust#depending-on-rand.
user17958's user avatar
1 vote

|RUST| link Error:1169 Solana Transaction Contract

The error says that a symbol is defined multiple times between two different libraries: = note: libspl_token-9c38dd82029194be.rlib(spl_token-9c38dd82029194be.spl_token.26961209c36bf507-cgu.0.rcgu.o) ...
Jon C's user avatar
  • 15.3k
3 votes

Why does TypeScript throw a warning for ResolvedAccounts for my PDA in my Anchor tests?

This is because all PDAs resolve automatically in Anchor 0.30. The client does not need to know anything about the resolvable accounts, thus you can safely remove the web3.PublicKey....
acheron's user avatar
  • 2,571
0 votes

L2 blockchain on solana

I would first recommend reading this excellent piece on why Solana Need L2s and Appchains You would get a lot clear idea on usecases and some technical insights. Next, go through Sovereign's Rollup ...
Syed Aabis Akhtar's user avatar
3 votes
Accepted

Escrow program help

You violated borrow checker rules. You borrow the Escrow account as a mutable variable here let escrow: &mut Account<Escrow> = &mut ctx.accounts.escrow; but try to use it as an immutable ...
Jimii's user avatar
  • 3,120
1 vote

"failed: An account required by the instruction is missing" transfer within contract

The error you are encountering means you are trying to you are trying to transfer to an account you haven't specified on your client side. Double-check to make sure that the user_pda and user_account ...
Jimii's user avatar
  • 3,120
1 vote

How to resolve 'Collection Must Be a Unique Master Edition v2' error?

It has been confirmed that if the max_supply value is not set to 0 when creating a collection NFT, the 'Collection Must Be a Unique Master Edition v2' error occurs when attempting verification with ...
StarPJ's user avatar
  • 21
1 vote

How to resolve 'Collection Must Be a Unique Master Edition v2' error?

Check the master_edition address you are passing in. That might be causing it. To also simplify your work, Metaplex provides CPI IX builders so that you do not have to worry about account management. ...
Jimii's user avatar
  • 3,120
1 vote

Raydium swap with rust

Check out the Anchor CPI examples in this repo https://github.com/raydium-io/raydium-cpi-example
Jimii's user avatar
  • 3,120
2 votes
Accepted

"anchor build" wont generate my "../target/types/program_name" file

for anchor 30 to generate your IDL you need to add the build idl feature into your Cargo.toml: idl-build = ["anchor-lang/idl-build"] And double check you don't have a compiler error in your ...
Jonas H.'s user avatar
  • 5,727
1 vote
Accepted

Transaction failed to sanitize accounts offsets correctly

The program_id was not correct!
xyzkal's user avatar
  • 31
2 votes

"anchor build" wont generate my "../target/types/program_name" file

I figured out the issue to this problem. I had to restart my WSL server in VS Code. Then I ran anchor test --skip-local-validator and it worked! The IDL file was generated accordingly. However, my ../...
TheLazySol's user avatar
0 votes

anchor build fails with 'no such command: `build-sbf`', but I can see build-sbf is installed

Adding to what @mikemaccana suggested, you may need to find the path containing your solana cli bin and add it to PATH. I was running on github's codespace, so i only needed to run this which added ...
Daniel Obiorah's user avatar
0 votes

"anchor build" wont generate my "../target/types/program_name" file

Probably the VS Code TS server acting up. Try restarting it. ctrl + shift + p then type restart Typescript server` Hack, rrunning anchor test should build and deploy the program and run the tests
Jimii's user avatar
  • 3,120
0 votes

"anchor build" wont generate my "../target/types/program_name" file

it("Fund PDA with SOL", async () => { const transferInstruction = SystemProgram.transfer({ fromPubkey: wallet.publicKey, toPubkey: PDA, lamports: transferAmount, }); const transaction = ...
AbdulKarim's user avatar
1 vote

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

I would recommend using SolanaProgramTest to test Solana programs. If you're using devnet, you'll have to redeploy under a different address or change the seeds between each initialization of an ...
frank's user avatar
  • 11
2 votes

Anchor Test has Transaction simulation failed: Error processing Instruction 0: custom program error: 0x0

This is an expected behaviour. At least based on the code you provided. The test says If PDA Account already created, then we expect an error. The error you receive is 0x0 'Allocate: account Address { ...
chalda's user avatar
  • 1,082
2 votes

Difference between C and Rust in development Solana

You should use C if you really need that last bit of performance that you can not achieve with rust. But the documentation and examples for C are waaay less built out compared to rust. So I would ...
Jonas H.'s user avatar
  • 5,727
0 votes

How to use spl_token account with solana-program-test crate?

By providing an account with no data as the SPL Token program, your test is actually replacing the SPL Token program with an unusable program. This is an error condition, since the runtime does not ...
Jon C's user avatar
  • 15.3k
2 votes

Program log: AnchorError occurred. Error Code: InstructionFallbackNotFound. Error Number: 101. Error Message: Fallback functions are not supported

The error InstructionFallbackNotFound is usually thrown by Anchor when the on-chain program cannot find the correct function to be called on the on-chain program. For Anchor the entrypoint method is ...
chalda's user avatar
  • 1,082
3 votes
Accepted

Error:Deploying program failed transaction simulation failed: Error processing Instruction 0: account data too small for instruction [3 log messages]

You will need to extend your program size, if you made changes to it. This is possible from the CLI version 1.18 > To fix this run solana program extend PROGRAM_ADDRESS_HERE 20000 -u d -k ~/....
Jimii's user avatar
  • 3,120
0 votes

Error Deploying Solana Nodes on OVH Machines: QUIC Connection Timed Out

If your nodes are unstaked or have low stake, they will not be allocated many QUIC connections by the rest of the cluster, which will mean timeouts when trying to connect to other nodes. You can ...
Jon C's user avatar
  • 15.3k
0 votes

in tweetnacl-rust Is there a way to Verify(detached_verify) signature on contract side in rust?

Unfortunately, you can't call the ed25519 program directly from your smart-contract. You need to include an instruction to the program at the toplevel, ie: let privkey = ed25519_dalek::Keypair:...
Jon C's user avatar
  • 15.3k

Top 50 recent answers are included