Questions tagged [program]
The program tag has no usage guidance.
163 questions
0
votes
0
answers
27
views
My ownership transferred to another program. How can i set it back to systemprogram?
Scammer transferred my program to another program. Now my wallet is assigned to his program. So I it can't pay for transaction fees anymore.
How can I set it back to system program to recover ?
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 ...
2
votes
1
answer
95
views
Access Account Discriminator in Anchor
I wish to access the discriminator of an Account Type inside a program.
The only method I found is
let mut init_storage_data = ctx.accounts.storage.try_to_vec().unwrap();, but it's skips the first 8 ...
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....
1
vote
1
answer
298
views
What determines the size of a program
How is the size of a program calculated?
If all accounts have a limit of 10 kibibytes, I assume that also applies to programs as well? How will the extend program size affect this? does it allow me to ...
2
votes
1
answer
178
views
Deserialise getAccountInfo data from Rust rpcclient for a PDA from drift protocol
Basically I have the following code in devnet. I want to call getAccountInfo to get some account information.
I have a PDA: JD71QyQpAJvoyq4p6mfwyaw4rY9qaDLk4CQpHeuPSpEK created by the programId: ...
2
votes
1
answer
65
views
canonical method of calling programs functions in script format
I have a couple deployed programs on Devnet. Is there a standard way of calling functions on a deployed program, assuming I have the IDL?
Obviously I could write a test but a test typically deploys a ...
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/...
1
vote
1
answer
24
views
What standard of NFT to adopt when wanting to mint a set of nft to a collection and then mint NFT one by one to the collection
I want to mint a set of NFT to a collection and then want to mint NFT one by one...what standard and procedure would be best in terms of tx cost would that be most efficient in this scenario?
3
votes
1
answer
803
views
Is it possible to invoke a program using solana cli?
I'm using anchor framework to write and deploy programs in solana blockchain. I run solana-test-validator and then use anchor deploy to deploy my simple hello-world program. It gives me the programs ...
2
votes
1
answer
208
views
How do you avoid frontrunning when initializing a program with a PDA?
Let's say I have a PDA which maintains the global state of my program. This is like a singleton. And the following snippets of code initialize it :
pub fn initialize(ctx: Context<Initialize>) -&...
2
votes
1
answer
496
views
Adoptability of token program 2022
So I'm having to create a nontransferable spl token and token program 2022 does provide features for it. The thing is I want to know that has the program been globally accepted in the solana ecosystem ...
1
vote
1
answer
227
views
Why do I get an error when trying to make an associated token account via anchor?
let create_cpi_accounts = associated_token::Create {
payer: ctx.accounts.user.to_account_info(),
associated_token: ctx.accounts.wallet.to_account_info(),
authority: ...
1
vote
1
answer
572
views
How can I deploy an SPL fungible token through anchor?
I attempt to create a new account with the anchor #[account(init)] macro, then assign ownership of the new account to the token program, and then attempt to send the initialize_mint instruction to the ...
2
votes
1
answer
275
views
Why does my SOL transfer succeed despite the fact that it reduces the balance to 0, below the rent exempt amount?
The solana documentation states that any transaction which will cause an account to go below it's rent exempt balance, should fail (here).
Every time an account's balance is reduced, a check is ...
1
vote
1
answer
150
views
Is it safe to use UncheckedAccount if it is simply the destination address for a SOL transfer?
The anchor documentation recommends not using the UncheckedAccount type unless you are sure that there are no security vulnerabilities.
Explicit wrapper for AccountInfo types to emphasize that no ...
2
votes
2
answers
279
views
Why does solana use the term "authority" instead of "owner"?
In ethereum, usually admin rights are defined by the term "owner". For example, many libraries follow this convention such as OpenZeppelin's Ownable contracts. Why in solana, are admin ...
2
votes
1
answer
62
views
What is the best pattern for accepting funds to a program?
Should I create a separate PDA account that is solely dedicated to handling funds or should I handle funds in the same PDA account that is storing state about my program? Are there any security ...
4
votes
1
answer
259
views
Why don't I need to pass in the signer or system_program account when using anchor ts?
I have the following Accounts struct in my program:
#[derive(Accounts)]
pub struct StartLottery<'info> {
#[account(init, payer = user, space = 8 + 8 + 8 + 8)]
pub lottery_state: Account&...
2
votes
1
answer
49
views
How is the PDA created for this program?
in this code example:
use borsh::{BorshDeserialize, BorshSerialize};
use solana_program::{
account_info::{next_account_info, AccountInfo},
declare_id,
entrypoint::ProgramResult,
msg,
...
0
votes
1
answer
27
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 ...
4
votes
1
answer
222
views
Where can I find information on Solana's eqivalent of opcodes?
In ethereum we have opcodes which provide access to things like state at execution time. Is there documentation on what is available for solana programs?
I'm specifically interested in hooks that ...
2
votes
1
answer
204
views
How to determine transaction fee inside rust program?
I am trying to determine if it is possible to determine the transaction fee from within the program itself?
In solidity we have gasleft() which allows us to take snapshots at the beginning and end of ...
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 ...
0
votes
1
answer
104
views
Convert solana wallet to custom program owned wallet
Is it possible to convert a system program owned account which has sol and other spl tokens in it to a custom program owned account and still retain all the items the account previously had?
1
vote
1
answer
197
views
Is there any demo of using javascript / typescript to interact with solana program
Is there any demo of using javascript / typescript to interact with solana program ?
For example, how to interact with this program ?
https://solscan.io/account/...
1
vote
0
answers
125
views
Cannot deploy program on mainnet for two weeks
I use solana command tool to deploy program on mainnet and always got failed. I have try for two weeks.
I try 1.14.X, 1.16.X and 1.17.X. But got failed.
tangaoyuan@tangaoyuandeMacBook-Pro program % ...
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
127
views
Getting ConstraintRaw Error
I'm integrating smart contract in next js. and getting this error
Uncaught (in promise) Error: failed to send transaction: Transaction simulation failed: Error processing Instruction 2: custom program ...
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 ...
0
votes
3
answers
60
views
what is the name of the second parameter for `CpiContext`
For example, when calling the instruction to mint_to my wallet,
I initialize the cpi_context
let cpi_context = CpiContext::new(
ctx.accounts.token_program.to_account_info(),
...
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
1
answer
207
views
Cannot perform a CPI call using anchor
I tried to make a CPI call from puppret_master to puppet program exactly like the anchor document and i did everything right but "program" AND "cpi" keywords are still unkown for ...
0
votes
1
answer
74
views
How can i enter a Vec<PubKey> in the solana play ground?
I want to enter a Vec as input But i can't do that i don't know what is wrong !
0
votes
1
answer
25
views
How does SOL accounting work in non-rent-exempt programs?
I wonder how does one reason about SOL accounting in non-rent-exempt Programs?
It seems to me that static analysis of a Program's balance is impossible besides just assuming that it changes on each ...
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 ...
5
votes
3
answers
536
views
How do you disassemble Solana programs?
Basically, what the title says. Since SBF != eBPF, the eBPF disassemblers don't work. When I try
$ solana-ledger-tool program disassemble foo.so
it complains about me not having a ledger folder or a ...
1
vote
2
answers
567
views
Is there a way to overwrite data in an account?
I have a PDA account, and I am trying to change the data format in the account.
from this
#[account]
pub dummy_data {
x_point: f32
}
to
#[account]
pub dummy_data {
x_point: u64,
y_point: f64,
...
3
votes
1
answer
245
views
Is it possible to access the program Authority In Anchor
When running solana program show <PROGRAM ADDDRESS>, this is what you might get as output.
Program Id: C3N7mj1oCrQNkzLW90dcaV7FrSbqNiFRX6BKkXePz2tFG
Owner: ...
4
votes
1
answer
256
views
What's the difference between the different program loaders?
what's the difference between:
BPFLoaderUpgradeab1e11111111111111111111111,
BPFLoader1111111111111111111111111111111111,
BPFLoader2111111111111111111111111111111111
for deploying your program?
5
votes
1
answer
200
views
How do you figure out your current program deployed max size?
When you deploy a program to a cluster, the default size allocated is the binary size * 2. However you won't be using the entire space on the cluster. How do you figure out the space left available in ...
4
votes
1
answer
322
views
What is the point of `declare_id`?
This question is the converse of What is the use for `program_id` in program's entrypoint.
What is the point of declare_id!(), because the program_id is passed as an argument to the the entrypoint?...
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
|
...
4
votes
1
answer
98
views
Upgrading program without keypair
Is it possible to upgrade a program using anchor deploy without having it's program keypair but being the program upgrade authority?
2
votes
2
answers
66
views
Is it possible to determine the fees for the current instruction from inside the contract?
I'm designing a solana contract where an admin performs an approval after a user makes a request.
The approval instruction closes a PDA corresponding to the request and returns its SOLs to the user ...
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 ...
3
votes
1
answer
77
views
Can you recommend an immutable and security audited escrow program that I can use?
I want to make something that requires an escrow, but it's probably better to make a CPI to something battle tested. Any recommendations?
0
votes
0
answers
105
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 ...