IC-Solana Gateway for interacting with Solana from the IC

Hi @tiamo

A blockhash expires after 150 blocks (about 1 minute assuming 400ms block times), after which the transaction cannot be processed.

Sure, but the problem is that the canister cannot even see the response of getLatestBlockhash since there will be a consensus error. There are basically 2 solutions that I see:

  1. Use durable transactions, but this requires setting up a nonce account.
  2. Hacky way:
    1. retrieve current slot, round that number to artificially increase the block time and avoid consensus errors.
    2. Retrieve the block for that slot with getBlock, which contains blockhash. That hash will not be super fresh (due to HTTPs outcall latency) but should be fresh enough to send a transaction for example.
  1. Can I test this locally without deploying to mainnet?

Deser errors should be visible locally, but certain pitfalls of HTTPs outcalls (IPv6 + consensus) are only visible on mainnet. For this reason I would strongly encourage you to test on mainnet.

3 Likes