Questions tagged [program]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
13 views

Validate secp256k1 ethereum signature?

I’m working on an anchor-lang project to validate secp256k1 ethereum signature. I used secp256k1_recover program docs as a reference for this code. The problem is that the public key I get from the ...
Teodor Zafirov's user avatar
0 votes
0 answers
11 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?
Ron's user avatar
  • 1
0 votes
1 answer
25 views

How to pause program on Solana?

How can I pause program in Anchor on Solana like pause provided by Solidity? I know programs on Solana is stateless, but I need to achieve this function.
user9310's user avatar
0 votes
0 answers
20 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 ?
Coşkun Kömürcü's user avatar
0 votes
1 answer
38 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... for the life of me i dont know why i keep getting An error occurred: 'solders.transaction.Transaction' object has no ...
Dino Anastos's user avatar
2 votes
1 answer
45 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 ...
PandaPanda's user avatar
1 vote
2 answers
40 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 ...
Brian M.'s user avatar
  • 111
0 votes
1 answer
25 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....
Pun's user avatar
  • 1
1 vote
1 answer
23 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 ...
Jimii's user avatar
  • 1,438
2 votes
1 answer
54 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: ...
panicKing's user avatar
2 votes
1 answer
24 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 ...
AceGravity's user avatar
3 votes
2 answers
211 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/...
FDFD FDFD's user avatar
1 vote
1 answer
18 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?
Tahlil's user avatar
  • 151
3 votes
1 answer
160 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 ...
Amir reza Riahi's user avatar
2 votes
1 answer
65 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>) -&...
Dylan Kerler's user avatar
2 votes
1 answer
114 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 ...
Muhammad Ali's user avatar
1 vote
1 answer
93 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: ...
Dylan Kerler's user avatar
1 vote
1 answer
41 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 ...
Dylan Kerler's user avatar
2 votes
1 answer
115 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 ...
Dylan Kerler's user avatar
1 vote
1 answer
40 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 ...
Dylan Kerler's user avatar
2 votes
2 answers
83 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 ...
Dylan Kerler's user avatar
2 votes
1 answer
37 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 ...
Dylan Kerler's user avatar
3 votes
1 answer
86 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&...
Dylan Kerler's user avatar
2 votes
1 answer
42 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, ...
FluffyMuffin47's user avatar
0 votes
1 answer
20 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 ...
Nat's user avatar
  • 163
4 votes
1 answer
64 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 ...
Nat's user avatar
  • 163
2 votes
1 answer
46 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 ...
Nat's user avatar
  • 163
2 votes
2 answers
110 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 ...
Brian M.'s user avatar
  • 111
0 votes
1 answer
28 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?
Muhit Raihan's user avatar
1 vote
1 answer
42 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/...
Z W's user avatar
  • 11
1 vote
0 answers
25 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 % ...
user6717's user avatar
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 ...
johnhckuo's user avatar
  • 135
0 votes
0 answers
36 views

Is it possible to deploy program with Solana SDK

There are many examples and tutorials on how to deploy Solana account using anchor framework or the native way. I can successfully deploy account and update its field with anchor SDK & IDL. ...
johnhckuo's user avatar
  • 135
0 votes
1 answer
54 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 ...
Sabir Khan's user avatar
0 votes
1 answer
21 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 ...
Muhit Raihan's user avatar
0 votes
3 answers
53 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(), ...
Jimii's user avatar
  • 1,438
2 votes
1 answer
244 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 ...
Jimii's user avatar
  • 1,438
0 votes
1 answer
63 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 ...
pooria sarkhan's user avatar
0 votes
1 answer
37 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 !
pooria sarkhan's user avatar
0 votes
1 answer
22 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 ...
Paul Razvan Berg's user avatar
1 vote
3 answers
308 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 ...
Paul Razvan Berg's user avatar
2 votes
1 answer
28 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 ...
Paul Razvan Berg's user avatar
5 votes
3 answers
168 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 ...
Proph3t's user avatar
  • 402
1 vote
2 answers
217 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, ...
Jimii's user avatar
  • 1,438
1 vote
1 answer
86 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: ...
Jimii's user avatar
  • 1,438
4 votes
1 answer
131 views

What's the difference between the different program loaders?

what's the difference between: BPFLoaderUpgradeab1e11111111111111111111111, BPFLoader1111111111111111111111111111111111, BPFLoader2111111111111111111111111111111111 for deploying your program?
Jacob Creech's user avatar
  • 3,439
4 votes
1 answer
82 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 ...
Jacob Creech's user avatar
  • 3,439
3 votes
1 answer
108 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?...
itsfarseen's user avatar
3 votes
1 answer
172 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 | ...
Pankaj's user avatar
  • 51
3 votes
1 answer
54 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?
gud's user avatar
  • 395