Skip to main content

Questions tagged [native-programs]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
17 views

How to generate a random number based on clock and recent blockhash?

i want to generate a random number in native rust on solana by using clock and recent blockhash. Right now I'm simply generating it by let clock = Clock::get()?; let random_number = (clock.slot % 100) ...
user22198's user avatar
0 votes
1 answer
11 views

Transfering sol from pda to a hardcoded account pubkey

Can i transfer money from a program owned PDA to a hardcoded pubkey without AccountInfo of the receiver ? Or do I NEED to pass it from the client? let hardcoded_pubkey = Pubkey::from_str("----...
DumSolProgramer's user avatar
1 vote
1 answer
18 views

Transfering money from a pda to a user wallet with native rust

Sorry for a noob question but im writing a solana program without anchor. And I'm having a problem with transfering sol from pda to a wallet in a program. pub fn process_instruction( program_id: &...
user21930's user avatar
0 votes
1 answer
27 views

How to fix "instruction tries to borrow reference for an account which is already borrowed" error

I'm writing a native solana program and from this code fragment i'm getting error: "instruction tries to borrow reference for an account which is already borrowed" invoke_signed( &...
user21922's user avatar
1 vote
0 answers
14 views

Account Serialization error in `spl-stake-pool`'s add-validator instruction

I'm trying to Add validator to my stake-pool through a program, When i try to do that i get this error i use version 2.0.0 of stake-pool and version 2.0.0 of solana I use this instruction in my ...
Abhishek Faliya's user avatar
1 vote
1 answer
20 views

How to deserialize StakePool account data on a solana native program on chain?

let stake = try_from_slice_unchecked::<StakePool>(&stake_pool.data.borrow())?; i have tried try_from, try_from_slice,unchecheked and with schema as well, but I get this same error, the ...
Abhishek Faliya's user avatar
4 votes
1 answer
146 views

Replicate Anchor remaining accounts in native

Anchor has the concept of "remaining accounts", which allows me to pass in an array of unvalidated accounts of an arbitrary size. This is great if I need accounts for inner instructions and ...
Joey Meere's user avatar
  • 1,445
0 votes
0 answers
13 views

Is there any other way to store the merkle tree as global variables are not recommended in solana like static?

use { borsh::{BorshDeserialize, BorshSerialize}, merkletreers::{tree::MerkleTree, utils::hash_it}, solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError,}, }; #[...
Aditya's user avatar
  • 157
0 votes
0 answers
29 views

Here i am not able to access the tree in native rust. It shows symbol name is longer than 16 bytes

Here in processor in instruction pre_sale i want to use Tree struct from whitelist. but this error comes Error: ELF error: ELF error: Failed to parse ELF file: Section or symbol name .bss._ZN3ico12in ...
Aditya's user avatar
  • 157
0 votes
0 answers
12 views

I want to use tree struct in presale instructions. But it takes more memory than 16 bytes please suggest a way to access Tree Struct form white list

Whitelist :- use { borsh::{BorshDeserialize, BorshSerialize}, merkletreers::{tree::MerkleTree, utils::hash_it}, solana_program::{entrypoint::ProgramResult, msg, program_error::ProgramError}...
Aditya's user avatar
  • 157
1 vote
1 answer
28 views

How can i pass 4 arguments in entrypoint of solana_program. This function takes 4 arguments but 3 arguments were supplied

Not able to understand this error. function takes 4 arguments but 3 arguments were suppliedrustcClick for full compiler diagnostic entrypoint.rs(132, 19): Actual error occurred here entrypoint.rs(132, ...
Aditya's user avatar
  • 157
0 votes
0 answers
12 views

cannot move out of `whitelist_tree.merkle_tree` which is behind a shared reference

move occurs because whitelist_tree.merkle_tree has type MerkleTree, which does not implement the Copy trait :- use { super::WhitelistArgs, crate::instructions::{transfer_tokens, whitelist::...
Aditya's user avatar
  • 157
1 vote
1 answer
112 views

Error: ELF error: ELF error: Failed to parse ELF file: Section or symbol name `.bss._ZN3ico12in` is longer than `16` bytes

This error comes after adding the Tree Static variable :- use { borsh::{BorshDeserialize, BorshSerialize}, merkletreers::{tree::MerkleTree, utils::hash_it}, solana_program::{entrypoint::...
Aditya's user avatar
  • 157
2 votes
0 answers
30 views

How to do account white listing using merkle tree on solana native rust program? Is it really possible to do whitelist account using merkle on solana?

I did this code But have doubt that it will not work as desired:- use borsh::{BorshDeserialize, BorshSerialize}; use merkletreers::tree::MerkleTree; use merkletreers::utils::hash_it; use ...
Aditya's user avatar
  • 157
1 vote
0 answers
19 views

Failed to send transaction: Transaction simulation failed: Error processing Instruction 0: incorrect program id for instruction

In the const sx = await sendAndConfirmTransaction i am getting error const { Connection, Keypair, SystemProgram, SYSVAR_RENT_PUBKEY, TransactionInstruction, ...
Aditya's user avatar
  • 157
1 vote
1 answer
203 views

WSOL Account Keypairs

I created a WSOL token account so I don't have to be creating temporary token accounts every time I want to make a transaction. Thing is, I created that account using Python and the function that does ...
lsrth's user avatar
  • 21
0 votes
1 answer
104 views

What is the compute cost for calling the native Ed25519 signature verification program?

I'm trying to measure the compute unit cost for my transaction which has 2 instructions: { ix0: native ed25519 sig verify (Ed25519SigVerify111111111111111111111111111) ix1: myprogram.foobar } but ...
Nick G's user avatar
  • 3
1 vote
2 answers
231 views

Can invoke_signed Be Used in Solana Native Programs to Handle SPL Tokens for Staking?

While reviewing the Solana codebase, I came across the invoke_signed function, which is commonly used for cross-program invocations. I'm particularly interested in understanding if it's possible to ...
Syed Ghazanfer Anwar's user avatar
0 votes
1 answer
56 views

How reliable is the accounts: &[AccountInfo] array is?

I am trying to learn solana development[native solana] and when reading some example programs I saw they all use the "accounts: &[AccountInfo]" in order to figure out the accounts ...
Yali Haviv's user avatar
2 votes
2 answers
803 views

How can I transfer SOL using programs and PDA's with native rust?

Hey I try to create a basic program which takes and manages sol for users. Something like the weth contract on ethereum. The program just needs to store the SOL and under some conditions users will be ...
Yali Haviv's user avatar
3 votes
1 answer
85 views

Where can I find ic_msg logs?

I’m writing a native program and I’m using the ic_msg macro with the solana_test_validator binary, but I can’t seem to find the log messages. Where do the ic_msg logs go? Do I need to configure ...
Kevin Ji's user avatar
  • 185
0 votes
1 answer
113 views

Why we need to pass all that accounts into functions in native solana?

I am go through the solana course and I am not understand that basics of writing solana native programs. Why do we need to pass to the functions some AccountInfo slice? Where this adressess should ...
Gilsson's user avatar
2 votes
1 answer
57 views

What is the instruction_data struct for program ED25519?

I'm trying to deserialize the ED25519 program, but the struct I derived does not tally with the bytes in the instruction data (buffer) https://github.com/solana-labs/solana/blob/master/sdk/src/...
Sewy's user avatar
  • 85
2 votes
1 answer
228 views

Can not send transaction from client

In my project, I'm using native Solana to create a contract. It is a basic program for users to enter their product info. I successfully built and deployed the contract but when I try to send a ...
brknarsy's user avatar
-1 votes
1 answer
111 views

native invoke_signed create_account pda: writable privilege escalated [closed]

i'm thinking the client can't create my pda state_account since only the program can sign for it, but i must be missing something. my native excerpt: let state_account = next_account_info(...
user3438's user avatar
1 vote
1 answer
74 views

Is it safe to assume that the program_id passed via the solana runtime Entrypoint cannot be Forged

I am writing a program of which I cannot know the program ID ahead of time for several non-trivial reasons. I am curious whether or not it is safe to assume the safety of the program_id passed via the ...
Cyrial Kamda's user avatar
1 vote
1 answer
83 views

Is the zk proof verifier program open source?

So i wanted to get an idea on how the equality and range proofs get verified by the native proof verifier program but I don’t see verifier codebase anywhere. Is it open source? If not when will it be?
Harsh Patel's user avatar
1 vote
1 answer
94 views

'failed to select a version' error when running 'cargo test-bpf'

I am writing unit tests for a native rust program using solana-sdk, solana-program-test and assert_matches crates. After writing the tests, when I try to execute them using cargo test-bpf command, I ...
Shubham Singh's user avatar
0 votes
2 answers
42 views

Do Native program adresses should also be passed into the transaction?

I have reached the maximum transaction size and looking for a way to reduce the number of 32bytes addresses involved. I see the proposal being accepted but not implemented https://docs.solana.com/...
mehh's user avatar
  • 117