All Questions
Tagged with program solana-program
43 questions
1
vote
1
answer
43
views
How to solve the cargo build-sbf error?
I have just started with rust and solana.
Firstly, I created a solana program using the command:
cargo init hello_world --lib
everything ran fine, and then i read from the official docs, to build i ...
2
votes
1
answer
27
views
What does it mean for a Solana program to not be associated with a ProgramData Address?
From the Solana docs on Program Accounts, when a new program is deployed, a Program Account and an associated Program Executable Data Account is created and the Program Account stores the address of ...
0
votes
1
answer
36
views
BTreeMap on Anchor ^0.29.0 stopped working?
Before anchor 0.29.0, BTreeMaps where working correctly in my programs, but now that I'm moving to ^0.29.0 I'm getting the following errors for every BTreeMap when I'm building my program.
no ...
1
vote
0
answers
74
views
How to protect myself against sandwiches (MEV)?
At the last days I'm getting sandwiched like more than 4 times a day while I must use high slippage, and jito isn't good enough solution because it delays my buys at most.
How I can protect myself ...
0
votes
0
answers
19
views
Funding Unfunded Account using Smart Contract
I am searching a way to fund a account using smart conttact, that work fine if the receiver is already done some transactions. This is failing if there is no transactions done on the account.
How can ...
1
vote
1
answer
79
views
Invoking Solana Programs
I was checking different ways to initialize a solana program. I am quiet new to field and expecting some support here.
I am running some VMs on a auto scaling group. I want to invoke a program when ...
0
votes
1
answer
50
views
How can I develop to purchase NFT in Solana and anchor
Help me please~~~
Could you send me a sample code or project?
2
votes
1
answer
86
views
How is program size calculated
I would love to know how a Solana program's size is calculated.
Do PDA's size that are owned by the program add up when this calculation is done? What about arguments?
0
votes
1
answer
131
views
Tx Reverting Even If Internal CPI Fails
Creating a CPI call, since it returns a Result. If the internal call throws an error, err should have an err() field as per the definition. The whole transaction should not revert, but it is reverting....
1
vote
1
answer
15
views
Does <AccountInfo> have the accont key?
Looking at getMultipleAccountInfo it returns a
AccountInfo<T>: {
data: T;
executable: boolean;
lamports: number;
owner: PublicKey;
rentEpoch?: number;
}
Am I correct in ...
1
vote
1
answer
58
views
Websocket version of getProgramAccounts
Is there a WebSocket version of getProgramAccounts that allows me to fetch PDAs with supplied seeds?
2
votes
1
answer
37
views
Relational PDA design through seeds
I have somewhat what seems to be a fairly simple question.
Lets assume we are building a Todo list where everything is public. And lets say a user will be able to create a new Task and that task will ...
0
votes
0
answers
10
views
want to what's wrong in my contract as i can't able to call my deposit function
use anchor_lang::prelude::*;
use anchor_spl::token::{self, Token, TokenAccount, Transfer as SplTransfer};
// use solana_program::system_instruction;
use solana_program::{account_info::AccountInfo, ...
2
votes
1
answer
313
views
Cannot deploy program onto solana mainnet
First of all, it's super slow when deploy(anchor deploy) my program to mainnet, I got error:
Blockhash expired. 4 retries remaining
Blockhash expired. 3 retries remaining
Blockhash expired. 2 retries ...
1
vote
1
answer
294
views
"package solana-program v1.18.7 cannot be built" error [duplicate]
I have a new Rust project that gives the following error when I compile it.
package `solana-program v1.18.7` cannot be built because it requires rustc 1.72.0 or newer, while the currently active rustc ...
0
votes
1
answer
330
views
How To Name Solana Instructions and Add Program Public Name
On Solscan, when you go to Analytics and scroll to the bottom, I noticed some programs like Raydium, Pyth and Metaplex have public name's set and you see that instead of seeing the program account ...
1
vote
2
answers
47
views
Does a CPI method to a program leave any special footprint on the blockchain?
Firstly, do I understand correctly that CPI call is one of the ways to call a method of program?
If so, only by examining a TX on the blockchain, will it be possible to distinguish a CPI call to a ...
0
votes
0
answers
111
views
Deserialize Solana.Transaction Golang
I have a Golang Solana.Transaction object and want to obtain the raw/pre-compiled instruction details.
How can I deserialize the Transaction.Message.Instruction?
0
votes
1
answer
1k
views
Solana Transactions using Solders object has no attribute 'recent_blockhash'
Below is the Python code I wrote to try to engage the logs of a deployed program.
I don't know why I keep getting the following error:
An error occurred: 'solders.transaction.Transaction' object has ...
1
vote
2
answers
49
views
Is There a Limit To How Many People Can Transfer SOL Into a "Pot" Account?
I'm building a game and want to give players the ability to pool SOL into a PDA account that is distributed to the player that wins. I've read about write-locked accounts, but usually only in the ...
0
votes
1
answer
93
views
Deploying program with sol_remaining_compute_units() gives "invalid account data"
Including something like
msg!("remaining compute: {}", solana_program::compute_units::sol_remaining_compute_units());
will lead to error when deploying
RPC URL: https://api.devnet.solana....
3
votes
2
answers
1k
views
How do I interact with closed-source Solana programs with no public IDL?
How do I interact with a program that has no open source and no Anchor program IDL. I need to get types, accounts and instructions for this program: https://solscan.io/account/...
0
votes
1
answer
28
views
Read Global Settings from Core Program?
In chains like eos there are system contracts that can be read from. In ethereum things like the eth staking contract can also be referenced.
Are there core solana programs that can be read from? I'm ...
3
votes
2
answers
461
views
Program Test Error: Error Processing Instruction 0: Program Failed to Complete
I have a program with 6 instructions, they all pass and this is the last one before I move client-side and server-side. In the prior instruction, I successfully use invoke() to transfer SOL from the ...
1
vote
0
answers
15
views
Is it possible to check the Solana program `macro` correctness before deployment?
When we want to deploy program to Solana, first we need to generate the program keypair and insert the public key in my declare_id! macro in lib.rs.
Because I want to expose an API interface for user ...
0
votes
1
answer
33
views
CustomAccount deserialization issue
I have this piece of code, it skips the first 8 bytes of the account data as that's the descriminator
pub struct CustomProgramAccountStruct {
pub pubkey: Pubkey,
pub authority: Pubkey,
pub ...
2
votes
1
answer
286
views
How are CPI calls charged?
When making CPI calls in my program, I am wondering whether I pay for the transaction cost associated with it.
To my understanding my program execution is paused and it goes to executing the cpi-ed ...
1
vote
3
answers
707
views
Can anyone close non-rent-exempt accounts?
This statement from Alchemy's tutorial has caught my attention (emphasis mine):
To reclaim Solana storage fees, developers and everyday Solana users can close accounts to receive their storage fees ...
2
votes
1
answer
38
views
Can the state of removed Programs be recovered after they failed to pay rent?
From the docs on rent:
Accounts that do not maintain their rent exempt status, or have a balance high enough to pay rent, are removed from the network in a process known as garbage collection.
What ...
3
votes
1
answer
373
views
Getting error while compiling the program
Hey I am facing this error
error[E0658]: let...else statements are unstable
--> /home/asus/.cargo/registry/src/github.com-1ecc6299db9ec823/solana-frozen-abi-macro-1.16.0/src/lib.rs:422:5
|
...
2
votes
1
answer
398
views
Get AccountInfo from ProgramId, or invoke program method using ProgramID
If I've programId (Pubkey) of a program, is it possible to get AccountInfo (or Program) object somehow?
Or conversely, is it possible to somehow invoke a (view) method on program if its programId is ...
0
votes
0
answers
106
views
Is there a Solana program that can facilitate the sale of an NFT to the highest bidder?
There is a use case where an NFT might be available in an auction where multiple bidders compete with SOL to win the NFT when the auction time expires. However, if an application is designed to trust ...
2
votes
1
answer
43
views
On-chain program security related question (non-anchor)
What checks or kind of security should I implement if I'm developing an onchain program without using Anchor-lang?
2
votes
1
answer
295
views
recover SOL from a Program Executable Data Account
I have a program that I want to shut down and recover the SOL from. There are two addresses associated with the program, the program itself and the address of the executable data.
If i do:
solana ...
0
votes
1
answer
92
views
Learning Programs Security in Solana
I'm looking at learning programs' security in solana. Was wondering if there was something equivalent to Ethernaut or Damn Vulnerable DeFi for Solana programs?
Appreciate any help, cheers!
3
votes
1
answer
4k
views
Error Message: A seeds constraint was violated
Here is my code
#[program]
pub mod anchor_code {
use super::*;
pub fn new_wallet(ctx: Context<WalletInfo>) -> Result<()>{
Ok(())
}
}
#[derive(Accounts)]
pub struct ...
1
vote
1
answer
52
views
Enum in PDA does not update, ever
#[derive(AnchorSerialize, AnchorDeserialize, Clone, Copy, PartialEq, Eq, Debug)]
#[repr(u8)]
pub enum Stage {
Initiated, // user has paid
Processing,
Processed,
Finished,
}
#[derive(
...
3
votes
2
answers
123
views
What Rust Crates are allowed in Solana Smart contract?
I'm wondering if it is possible to implement a federated averaging function on solana. But im not sure if I can use the crates that would allow me to do that.
Here are the crates i wanna use.
Numpy
...
1
vote
0
answers
19
views
Question about solana programs
Why is it recommended that solana programs check the validity of any account it reads, but does not modify?
0
votes
2
answers
338
views
My sol stuck in prgram. How can I close program and recover it?
I was deploying program and by mistake I missed the keyword program and just typed
solana deploy <PROGRAM_FILEPATH>
which return the below program Id and there is no upgradeable authority. Now ...
5
votes
1
answer
2k
views
How To Get Balance in a Program
Is it possible to get SOL balance and/or SPL token balances for a given account in an Anchor program?
0
votes
1
answer
68
views
Which is correct token program address
I'm from ETH coming to SOL. But I noticed in this article, the smart contract address (token program address) is this way - https://nimb.ws/sIxWM7
But here the address starts with the word "Token&...
1
vote
1
answer
153
views
Can I trigger a program to run whenever a transaction occurs that isn't related to the program?
Is it possible to write a Solana program that automatically interacts with the Solana chain whenever something happens?
A simple example would be: Whenever a dex such as Orca swaps USDC for SOL at a ...