5
votes
Accepted
How to verify data on chain with Solana
The solution is to use something called Program Derived Addresses.
What Are They?
Your program has its own unique address space to which it can allocate Program Derived Addresses. These are derived ...
4
votes
how can i check / verify past events of my smartcontract?
You can fetch the transaction history of your program (address) and then parse the transactions using Anchor event parser.
fetching the transactions
connection.getSignaturesForAddress is limited to ...
4
votes
Is there a rust equivalent of onProgramAccountChange()?
Yes,
You have to use the PubsubClient
solana_client::{
nonblocking::pubsub_client::PubsubClient,
};
This is the method you want:
pub async fn account_subscribe(
&self,
...
3
votes
Blocks on testnet have no transactions
The transactions field in UIConfirmedBlock being of type Option means that this field can either contain some data (Some(LongTransactionType)) or be empty (None). If you're consistently getting None, ...
3
votes
Accepted
How to use Solana rust client to request SOL balance?
The error message Slice must be the same length as a Pubkey: TryFromSliceError(()) is a clue to what the problem is.
Solana addresses are in base58 format, while the Pubkey::new function expects &[...
2
votes
Depencencies in Cargo.toml file Solana-SDK and Solana-Client doesn't work
From Solana documentation:
On-chain Rust programs support most of Rust's libstd, libcore, and liballoc, as well as many 3rd party crates.
There are some limitations since these programs run in a ...
2
votes
Accepted
Connection to solana cluster using the ThinClient of the rust client library giving timeout error?
It looks like the tpu address is most likely incorrect. When you start your local validator, it should give the address, ie:
solana-test-validator
Ledger location: test-ledger
Log: test-ledger/...
2
votes
Accepted
"Error: receiving on an empty and disconnected channel" from `solana_client::PubsubClient`
So... I had a hunch that the async version would work... and well... it did...
I am no rust expert but it still seems that the "blocking" version of the pubsub_client is just straight up ...
2
votes
Accepted
How to obtain transaction logs via RPC?
This answer helped me to find get_transaction() method of solana_client::rpc_client::RpcClient, so to obtain logs of the transaction one needs to do the following:
let signature = rpc_client....
2
votes
Getting an error when attempting to send transactions to the TPU from a Rust client
Your client is trying to send to the old TPU port, which used to accept UDP. Now you must configure your client to use QUIC.
That code has changed a lot recently, so the easiest thing might be to ...
2
votes
Accepted
How can I get the transaction history of a wallet with more than 1000 transactions/signatures?
In order to fetch the next 1000 transactions after the last transaction returned, you'll need to use the before filter, where signature is the last signature on the array returned from ...
2
votes
How can I get the program_id from the last transaction response Solana Blockchain Rust
You're very close! Once you get to UiParsedInstruction::Parsed(d), the program_id is right there, so you can do:
UiParsedInstruction::Parsed(d) => {
...
2
votes
Accepted
Blocks on testnet have no transactions
If you want to fetch devnet transactions, you need to change your API to point to that cluster https://api.devnet.solana.com
As the name suggests, the EncodedTransactionWithStatusMeta is the encoded ...
1
vote
Can I update the FEE and Withheld authority if I'm only the Update Authority?
With SPL Token, only the applicable authority can update that authority type. So for example, only the mint authority can change the mint authority, only the freeze authority can change the freeze ...
1
vote
error: could not compile `spl-type-length-value`
Solution seems to be to add spl-type-length-value = "=0.3.0".
[dependencies]
solana-sdk = "1.18.17"
solana-client = "1.18.17"
spl-type-length-value = "=0.3.0"
...
1
vote
How to use solana-client from a tokio async runtime?
This is definitely a confusing error, but it makes perfect sense.
The RpcClient that you're using is the blocking RPC client, which uses a non-blocking RPC client under the hood. This non-blocking RPC ...
1
vote
Loading lookup table accounts with rust RPC client
If you're using get_transaction from the RPC client, it will give you all of the accounts that were part of the transaction, both static ones and address-lookup-table ones, so there's no other work to ...
1
vote
Accepted
Solana TPU client and sending versioned transactions
This should probably get fixed at the TPU client level, but in the meantime, you can serialize the versioned transaction and use send_wire_transaction, ie:
tpu_client.send_wire_transaction(bincode::...
1
vote
Accepted
websocket_url for solana_client::tpu_client::TpuClient
Per the solana_client rust crate documentation, this is the correct syntax.
See this function prototype:
pub fn new(
rpc_client: Arc<RpcClient>,
websocket_url: &str,
config: ...
1
vote
Accepted
How to retrieve a FileSystem Wallet in a .ts file
Here's a reference that you can adapt. It generates a .env file with a new keypair if one does not already exist, otherwise it creates the keypair from the file.
export async function ...
1
vote
How can I get the transaction history of a wallet with more than 1000 transactions/signatures?
Use this getSignaturesForAddress template to get signatures (transactions) up to a certain limit (default 100000).
It takes connection, address, and maxLength and returns list of signatures
* @param ...
1
vote
How to obtain transaction logs via RPC?
To get the log messages for a transaction, you can use the getTransaction endpoint from JSON RPC, and then pull out the meta.logMessages.
Not all RPC endpoints provide log messages, however, so you ...
1
vote
1
vote
Solana-SDK and Solana-Client doesn't work as a dependencies
Please upgrade your solana cli to stable 1.13.4
And also in your smart contract (on chain) programs you are suppose to use
solana-program library.
solana-sdk and solana-client are for client side ...
1
vote
Trouble initializing solana contract on front-end client
I don't see any function called initialize in the image you've attached. There's a difference between having an Initialize struct and an initialize function. I bet you have a function start_stuff_off ...
1
vote
Sometimes receiving duplicate logs using solana_client::nonblocking::pubsub_client::PubsubClient
The WebSocket indeed seems to be extremely buggy. I sometimes don't even receive notifications, and then sometimes I get duplicates too.
Could you check if the subscription ID is the same for both?
1
vote
Get transactionID string with Transaction object
The Transaction is really the request. It does not carry the response, i.e. the transaction signature.
Transaction signature is only returned from one of the send transaction methods, e.g. Connection....
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
solana-client × 37rust × 11
solana-sdk × 9
solana-program × 8
anchor × 5
rpc × 5
transactions × 3
anchor-client × 3
cargo × 3
web3.js × 3
solana-client-sdk × 3
spl-token × 2
solana-cli × 2
send-transaction × 2
solana-program-test × 2
anchor-test × 1
solana-wallet-adapter × 1
error × 1
solana-test-validator × 1
mainnet × 1
jsonrpc-api × 1
keypair × 1
anchor-program-idl × 1
deserialization × 1
balance × 1