Skip to main content

Questions tagged [program]

The tag has no usage guidance.

11 votes
1 answer
338 views

Why is SOL refunded after a program deploy?

I've noticed that some of the SOL required to deploy a program is refunded after the deploy. What's going on to cause this? Is it that the program is uploaded to multiple accounts and then one of them ...
Callum M's user avatar
  • 3,190
9 votes
2 answers
2k views

How can I calculate the cost the deploy a progam to main net?

I want to deployed a program to main net would like to figure out before hand how much it will cost. For accounts I can just calculate it by counting the bytes to be rent exempt but how do I do that ...
Jonas H.'s user avatar
  • 5,817
8 votes
2 answers
749 views

How do I create an NFT using Anchor?

What is the simplest way to create an NFT using Anchor, without using the candy machine. The goal is to be able to mint a token and corresponding metadata. Ideally with a single instruction.
zfedoran's user avatar
  • 761
8 votes
1 answer
634 views

How can I freeze NFT in user wallet

There are a few instructions in Metaplex which would allow a delegate to freeze an NFT in user wallet, so I though it would be possible to stake user NFTs by freezing them in their wallets, so that I ...
RowanStone's user avatar
8 votes
1 answer
136 views

Are there any downsides to using unix_timestamp vs slot to time lock programs?

Let's say I want to restrict access to my program up until a certain time. Given some future time I can either: Use Clock::get()?.unix_timestamp to check if my future time has occurred yet Assuming ...
seruob's user avatar
  • 91
7 votes
2 answers
336 views

What is the use for `program_id` in program's entrypoint

All Solana programs receive its own program_id as a parameter. But I don't see how this is useful, as you can use declare_id to declare it in case you need it. I've also seen that if you get your ...
RowanStone's user avatar
7 votes
2 answers
222 views

how to transfer native SOL from program to user

I have SOL in my program account. Is it possible to transfer that native (NOT WSOL) SOL to user? If yes, How?
Gajesh Naik's user avatar
5 votes
3 answers
344 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
  • 422
5 votes
1 answer
684 views

Create Token Account only if not Initialized yet in program (Native Rust)

Doing this in Typescript is pretty straightforward by making an RPC call or getOrCreateAssociatedAccount, but I am wondering if there is a way to do this program side as well without using Anchor. For ...
ixmorrow's user avatar
  • 101
4 votes
2 answers
451 views

How to fetch all PDAs owned by a program

Is there a way to fetch all PDA's owned by a Solana program?
incog's user avatar
  • 567
4 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?
user avatar
4 votes
1 answer
156 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,894
4 votes
1 answer
198 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,894
4 votes
1 answer
481 views

How to deal with floating point arithmetic in solana programs

Let us suppose an item A costs 5 USD and I want to purchase this item with the equivalent SOL amount inside my solana program. For robustness, I am fetching the price from within the program using an ...
Burger Bob's user avatar
  • 1,466
4 votes
1 answer
145 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

15 30 50 per page
1
2 3 4 5
10