Skip to main content
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 ...
HelmetFace's user avatar
  • 1,807
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 ...
vicyyn's user avatar
  • 4,295
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, ...
Frank C.'s user avatar
  • 656
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, ...
Mitch's user avatar
  • 848
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 &[...
dade's user avatar
  • 292
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 ...
acheron's user avatar
  • 2,909
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/...
Jon C's user avatar
  • 19.6k
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 ...
TovarishFin's user avatar
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....
totikom's user avatar
  • 396
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 ...
Jon C's user avatar
  • 19.6k
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 ...
Fawnzee's user avatar
  • 36
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) => { ...
Jon C's user avatar
  • 19.6k
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 ...
Jimii's user avatar
  • 7,712
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 ...
Jon C's user avatar
  • 19.6k
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" ...
john's user avatar
  • 7,794
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 ...
Jon C's user avatar
  • 19.6k
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 ...
Jon C's user avatar
  • 19.6k
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::...
Jon C's user avatar
  • 19.6k
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: ...
SEJeff's user avatar
  • 76
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 ...
john's user avatar
  • 7,794
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 ...
vicyyn's user avatar
  • 4,295
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 ...
Jon C's user avatar
  • 19.6k
1 vote

Build solana-client for wasm target

You might want to use solana-client-wasm crate. Source.
acheron's user avatar
  • 2,909
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 ...
Nagaprasad Vr's user avatar
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 ...
Kirima's user avatar
  • 155
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?
Pirulax's user avatar
  • 21
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....
sohrab's user avatar
  • 1,851

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