# @solana/sysvars

> An abstraction layer over signing messages and transactions in Solana

Latest version **8.3.0** (published 2026-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install @solana/sysvars
pnpm add @solana/sysvars
yarn add @solana/sysvars
bun add @solana/sysvars
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 8.3.0 |
| Published | 2026-09-09 |
| First published | 2024-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.18.0 |
| Dependencies | 6 |
| Unpacked size | 416.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 695 |
| Author | Solana Labs Maintainers |
| Maintainers | solana-devs |
| Keywords | blockchain, solana, web3 |

## Links

- npm: https://www.npmjs.com/package/@solana/sysvars
- Repository: https://github.com/anza-xyz/kit
- Homepage: https://www.solanakit.com/api#solanasysvars
- Issues: https://github.com/anza-xyz/kit/issues
- npm.io page: https://npm.io/package/@solana/sysvars

## Dependencies (6)

- [@solana/errors](https://npm.io/package/@solana/errors.md) 8.3.0
- [@solana/accounts](https://npm.io/package/@solana/accounts.md) 8.3.0
- [@solana/rpc-types](https://npm.io/package/@solana/rpc-types.md) 8.3.0
- [@solana/codecs-core](https://npm.io/package/@solana/codecs-core.md) 8.3.0
- [@solana/codecs-numbers](https://npm.io/package/@solana/codecs-numbers.md) 8.3.0
- [@solana/codecs-data-structures](https://npm.io/package/@solana/codecs-data-structures.md) 8.3.0

## Recent versions

- 8.3.0 (latest) — 2026-09-09
- 8.4.0-canary-20260924083259 (canary) — 2026-09-24
- 5.1.0-experimental-20251205104522 (experimental) — 2025-12-05
- 4.0.0 (4x) — 2025-10-08
- 3.0.3 (3x) — 2025-09-11
- 2.0.0 (next) — 2024-11-07
- 2.0.0-rc.4 (rc) — 2024-11-05
- 2.0.0-preview.4.20240731091009.c2717fc498afa3228c8f8b01600a575989afae99 (preview) — 2024-07-31
- 2.0.0-preview.4 (tp4) — 2024-07-02
- 2.0.0-preview.3 (tp3) — 2024-04-25
- 8.4.0-canary-20260923083123 — 2026-09-23
- 8.4.0-canary-20260922155338 — 2026-09-22
- 8.4.0-canary-20260922151509 — 2026-09-22
- 8.4.0-canary-20260922084122 — 2026-09-22
- 8.4.0-canary-20260922083419 — 2026-09-22
- … 1717 more at https://npm.io/package/@solana/sysvars/versions

## README

[![npm][npm-image]][npm-url]
[![npm-downloads][npm-downloads-image]][npm-url]
<br />
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]

[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
[code-style-prettier-url]: https://github.com/prettier/prettier
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/sysvars?style=flat
[npm-image]: https://img.shields.io/npm/v/@solana/sysvars?style=flat
[npm-url]: https://www.npmjs.com/package/@solana/sysvars

# @solana/sysvars

This package contains types and helpers for fetching and decoding Solana sysvars. It can be used standalone, but it is also exported as part of Kit [`@solana/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).

More information about the available sysvars on Solana can be found in the docs
at <https://docs.solanalabs.com/runtime/sysvars>.

All currently available sysvars can be retrieved and/or decoded using this
library.

## Sysvar API

This package offers a simple API for working with sysvars.

One can fetch an encoded sysvar account using an RPC client.

```ts
const maybeEncodedClock = await fetchEncodedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
maybeEncodedClock satisfies MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
```

One can also attempt to fetch a JSON-parsed sysvar account.

```ts
const maybeJsonParsedClock = await fetchJsonParsedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
maybeJsonParsedClock satisfies
    | MaybeAccount<JsonParsedSysvarAccount, 'SysvarC1ock11111111111111111111111111111111'>
    | MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;
```

Each sysvar within the library ships with its own
[codec](https://github.com/anza-xyz/kit/tree/main/packages/codecs)
for deserializing the account data.

You can pair this codec with the helpers from
[`@solana/accounts`](https://github.com/anza-xyz/kit/tree/main/packages/accounts)
to assert and decode sysvar account data.

```ts
// Fetch.
const clock = await fetchEncodedSysvarAccount(rpc, SYSVAR_CLOCK_ADDRESS);
clock satisfies MaybeEncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;

// Assert.
assertAccountExists(clock);
clock satisfies EncodedAccount<'SysvarC1ock11111111111111111111111111111111'>;

// Decode.
const decodedClock = decodeAccount(clock, getSysvarClockDecoder());
decodedClock satisfies Account<SysvarClock, 'SysvarC1ock11111111111111111111111111111111'>;
```

Each supported sysvar also ships with its own fetch-and-decode function to
perform the steps above and return the decoded sysvar data.

```ts
const clock: SysvarClock = await fetchSysvarClock(rpc);
```

## Supported Sysvars:

This package supports the following Solana sysvars:

- [`Clock`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/clock.ts)
- [`EpochRewards`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/epoch-rewards.ts)
- [`EpochSchedule`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/epoch-schedule.ts)
- [`LastRestartSlot`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/last-restart-slot.ts)
- [`RecentBlockhashes`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/recent-blockhashes.ts)
- [`Rent`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/rent.ts)
- [`SlotHashes`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/slot-hashes.ts)
- [`SlotHistory`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/slot-history.ts)
- [`StakeHistory`](https://github.com/anza-xyz/kit/tree/main/packages/sysvars/src/stake-history.ts)

The `Instructions` sysvar is also supported but does not exist on-chain,
therefore has no corresponding module or codec.

---
_Source: https://npm.io/package/@solana/sysvars · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
