Skip to content

Instantly share code, notes, and snippets.

@mikemaccana
Last active July 7, 2025 21:02
Show Gist options
  • Save mikemaccana/138c8fa8d0bcf0b93d51587f32ab9a35 to your computer and use it in GitHub Desktop.
Save mikemaccana/138c8fa8d0bcf0b93d51587f32ab9a35 to your computer and use it in GitHub Desktop.
Get the block from a transaction hash
import { Signature } from "@solana/kit";
import { connect } from "solana-kite";
const log = console.log;
const KOWALSKI_TRANSACTION =
"2BM8psEVuV7QDZgX97Q3sEhjk6zKkKPNXhzFJNE9H2PbSZRdcD6fz1bR7xXBNWp3zgSUDYFBtKqYz2zz1YBZgb63";
const connection = connect("quicknode-mainnet");
const transaction = await connection.rpc
.getTransaction(KOWALSKI_TRANSACTION as Signature, {
encoding: "json",
maxSupportedTransactionVersion: 0,
})
.send();
console.log(transaction?.slot);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment