Questions tagged [native-programs]
The native-programs tag has no usage guidance.
34 questions
1
vote
2
answers
57
views
Cannot Create an Associated Token Account
I'm not the first to ask a question about this problem, but none of the questions asked were answered. The problem is that I'm trying to create an associated token account to mint an NFT, but the ...
1
vote
0
answers
13
views
How to prevent signature replay when using Ed25519 Native Program
If I am using the Native Ed25519 Program to verify a message signature, I will need to add the pre instruction that will contain signature, message and public key to verify. In my custom program, I ...
2
votes
1
answer
20
views
PDA takes ~10s to upate even after tx is confirmed
I have been using anchor programs before , In those programs i could send multiple transactions back to back and the pda are reflected correct in every transactions.
But since then i started creating ...
2
votes
1
answer
72
views
how to get an token account's Mint address on chain?
In my anchor program, I declare a uncheck account that will check by code inside instruction function
/// CHECK: do check inside function.
#[account(mut)]
pub user_ata: UncheckedAccount&...
2
votes
1
answer
53
views
How to run test cases in typescript using native rust?
How can I run test cases in typescript using native rust not anchor.
1
vote
1
answer
33
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) ...
0
votes
1
answer
23
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("----...
2
votes
1
answer
34
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: &...
0
votes
1
answer
130
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(
&...
1
vote
1
answer
37
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 ...
1
vote
1
answer
41
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 ...
5
votes
1
answer
314
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 the number ...
0
votes
0
answers
23
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,},
};
#[...
1
vote
0
answers
37
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 ...
1
vote
0
answers
17
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}...
1
vote
1
answer
37
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, ...
0
votes
0
answers
13
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::...
1
vote
1
answer
361
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::...
3
votes
0
answers
77
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 ...
1
vote
0
answers
20
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,
...
1
vote
1
answer
283
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 ...
0
votes
1
answer
155
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 ...
1
vote
2
answers
344
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 ...
0
votes
1
answer
90
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 ...
2
votes
2
answers
1k
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 ...
3
votes
1
answer
111
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 ...
0
votes
1
answer
193
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 ...
3
votes
1
answer
67
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/...
2
votes
1
answer
284
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 ...
-1
votes
1
answer
164
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(...
1
vote
1
answer
114
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 ...
1
vote
1
answer
90
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?
1
vote
1
answer
111
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 ...
0
votes
2
answers
48
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/...