Skip to main content
5 votes

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

I can think of two ways it's useful depending on whether the address where your program is currently running is somehow important: The running address is important: receiving program_id allows you to ...
Nate's user avatar
  • 411
5 votes
Accepted

what does the sysvar PUBKEYs do?

A system account. Sysvars provide cluster state information such as current tick height, rewards points values, etc. Programs can access Sysvars via a Sysvar account (pubkey) or by querying via a ...
vicyyn's user avatar
  • 4,295
4 votes
Accepted

What is the behavior of the Instructions sysvar during CPI calls?

Yes, the instructions sysvar only includes instructions that are present in the toplevel transaction. This is due to the implementation: the instructions sysvar is filled before the transaction is ...
bennofs's user avatar
  • 338
3 votes

what does the sysvar PUBKEYs do?

Solana exposes a variety of cluster state data to programs via sysvar accounts. It's an address to an account on chain that contains the rental rate. These are static values. Let's look at the account ...
C.OG's user avatar
  • 2,907
3 votes
Accepted

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

Using the actual program_id is more robust to errors. If you declare the expected program_id, you have to keep track on it. (Like, for some reason you've chosen to deploy a new version to a new ...
totikom's user avatar
  • 396
3 votes
Accepted

Slot hash VS block hash?

As you've noticed, slot hash and block hash are not the same thing. They depend on each other for generation, but they have different purposes. To put it simply, the block hash belongs to a completed ...
Jon C's user avatar
  • 19.6k
2 votes
Accepted

Source of slot_hash and current timestamp on chain

All sysvars come directly from the Solana runtime, similar to how you can make a syscall in any other platform. And the provided sysvars are the most current time and slot hash at time of execution. ...
Jon C's user avatar
  • 19.6k
2 votes
Accepted

Is the Epoch Rewards sysvar deprecated?

No, the EpochRewards sysvar is not deprecated. It is actually rather new, having been added within the last year. It will become live on v0.17, which is not on all networks yet. If you look at the ...
nickfrosty's user avatar
  • 1,199
1 vote
Accepted

How do I get the recent blockhashses during program execution?

The slot_hashes sysvar is unfortunately too large to deserialize in an on-chain program. You can partially deserialize it, however, to get a small number of the hashes. Here's an example, lifted from ...
Jon C's user avatar
  • 19.6k
1 vote

Compare start Time in account state from context and current time of SYSVAR clock

It is difficult to control two independent walltime sources like this. Instead of letting the user submit the start_time from the frontend, use a transaction to set it from the clock sysvar
trent.sol's user avatar
  • 4,585
1 vote

Mocking the Clock sysvar in solana_program_test

I think you're blocking the async executor with std::thread::sleep(). Try tokio::time:sleep() instead
trent.sol's user avatar
  • 4,585

Only top scored, non community-wiki answers of a minimum length are eligible