Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 50

Should be used for all things relating to the Anchor Framework.

1 vote
Accepted

Getting rust analyser Error in Anchor?

Seems like the required crate isn't installed yet. Try running cargo run or cargo build
C.OG's user avatar
  • 2,907
1 vote
Accepted

How to get data account from an instruction?

On solana, for you to read/write to an account, it needs to be passed as an account to the instruction. So if you want to read the account that belongs to player_two, you'll need to pass it as an acco …
C.OG's user avatar
  • 2,907
2 votes
Accepted

TypeError: programId.toBuffer is not a function when using web3.PublicKey.findProgramAddress()

The PublicKey.findProgramAddress method is expecting the programId to be a public key. Option A: export class BigBazaar { constructor( // code removed for brevity readonly programId: web3.Public …
C.OG's user avatar
  • 2,907
3 votes
Accepted

How to generate a unique id?

Without much context, your best bet may be to use a public key as the id? let id = Keypair::new().pubkey(); Though I can imagine that the Item struct is stored in an account. So that accounts' addre …
C.OG's user avatar
  • 2,907
3 votes
Accepted

Is there any way to implement only owner access control in solana anchor

edit: This seems to be exactly what you're looking for: https://docs.rs/anchor-lang/latest/anchor_lang/accounts/program/struct.Program.html …
C.OG's user avatar
  • 2,907
1 vote

How to get the IDL of a Solana Program?

For "Vanilla" (non-anchor) Solana programs, you can use Native to Anchor to create an Anchor compatible IDL. … Example on how to do this for the Feature Proposal program Clone the repo: git clone https://github.com/acheroncrypto/native-to-anchor.git cd native-to-anchor Copy the feature proposal instructions …
C.OG's user avatar
  • 2,907
2 votes

I am having issues running anchor build command

It seems like you don't have Solana installed locally on your machine. Follow these steps to install: https://docs.solana.com/cli/install-solana-cli-tools#use-solanas-install-tool Run this command in …
C.OG's user avatar
  • 2,907
7 votes

How do I transfer sol from a PDA account to a user account

Only the program that owns the account can debit its lamports. Since this is a program-owned account you're transferring from, the System Program wont be able to do the transfer, because it doesn't ow …
C.OG's user avatar
  • 2,907
3 votes
Accepted

Using Fs to fetch idl error: "Module not found: Can't resolve 'fs'"

The fs module doesn't exist in the browser, it's a built-in node module for reading from the file system. Instead, try to import the file. import idl from "../idl/BigBazaar_IDL_Devnet.json"; export c …
C.OG's user avatar
  • 2,907
1 vote

init anchor project cause problem with rust-analyzer

Seems like the required crate isn't installed yet. Try running cargo run or cargo build
C.OG's user avatar
  • 2,907
3 votes

What are the best practices I can do to secure my Solana smart contracts if I can't afford a...

While these won't comprehensively secure your program, there are a few security checks you can keep in mind; Ownership checks: An ownership check verifies that an account is owned by the expected publ …
C.OG's user avatar
  • 2,907
2 votes

Where can I get programId after deploying the program through solana playground on devnet?

The program id is 8Xnz4ta9XGsq7A7mHTeMd9eg4JQoT7z1TxoiKdp3StVY You can also find the program id on the build tab in solana playground:
C.OG's user avatar
  • 2,907
4 votes

Instruction Error after upgrading solana program

You will need to migrate the account. There's a full guide how to do this on the cookbook
C.OG's user avatar
  • 2,907
3 votes
Accepted

Can someone explain why Anchor's ".signers([ ])" not does work with "sendTransaction" from u...

The sendTransaction method attempts to do -- too much. It should be used for simple/basic examples. sendTransaction will sign and send the transaction, irrespective if it's being signed. On line 4495: …
C.OG's user avatar
  • 2,907
2 votes

Finding instruction identifiers

Most programs support multiple discrete instructions - you decide when writing your program what these instructions are and what data must accompany them Rust enums are often used to represent discret …
C.OG's user avatar
  • 2,907

15 30 50 per page