> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# EIP-1967 on Solana: Program Upgrades Without Proxies

> Replace upgradeable proxies with Solana's upgrade authority: redeploy to the same program ID, transfer or revoke the authority, and migrate account data.

Ethereum contracts are immutable, so upgradeable systems route calls through a
proxy that EIP-1967 standardizes. Solana programs are upgradeable at the
protocol level: an upgrade authority replaces the code at the same program ID.

## What EIP-1967 defines

A proxy contract holds the state and forwards every call to an implementation
contract with `delegatecall`. EIP-1967 fixes the storage slots where the proxy
keeps the implementation address and the admin address, so tools can find them
and the slots do not collide with the implementation's variables.

<Steps>
<Step title="User calls the proxy">

The proxy address never changes.

</Step>
<Step title="Proxy delegates">

`delegatecall` runs the implementation's code against the proxy's storage.

</Step>
<Step title="Admin upgrades">

The admin points the proxy at a new implementation contract.

</Step>
<Step title="Storage must match">

The new implementation has to keep the same storage layout.

</Step>
</Steps>

## How upgrades work on Solana

A Solana program's address points to a program data account that stores the code
and the [upgrade authority](/developers/docs/core/programs/program-deployment).
An upgrade writes new code into that account. Callers keep using the same
program ID, and state is unaffected because it lives in separate accounts.

```mermaid
flowchart TD
    P["Program account<br/>The program ID that clients call"]
    P -->|points to| P0["Program data account<br/>The executable code and the upgrade authority"]
```

<div className="sol-mermaid" data-fallback="mermaid" data-mermaid="653c65942071">
  <img className="block dark:hidden" src="/docs-assets/assets/docs/mermaid/653c65942071-light.svg" alt="An upgrade replaces the code in the program data account. The program ID and the data accounts that the program owns stay as they are." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/mermaid/653c65942071.svg" alt="An upgrade replaces the code in the program data account. The program ID and the data accounts that the program owns stay as they are." />

  <img className="block dark:hidden" src="/docs-assets/assets/docs/mermaid/653c65942071-sm-light.svg" alt="An upgrade replaces the code in the program data account. The program ID and the data accounts that the program owns stay as they are." />

  <img className="hidden dark:block" src="/docs-assets/assets/docs/mermaid/653c65942071-sm.svg" alt="An upgrade replaces the code in the program data account. The program ID and the data accounts that the program owns stay as they are." />
</div>

<p className="sol-caption">An upgrade replaces the code in the program data account. The program ID and the data accounts that the program owns stay as they are.</p>

<Columns cols={2}>
<Card title="EIP-1967 proxy">

- You deploy a proxy and an implementation.
- `delegatecall` adds gas to every call.
- Storage collisions between versions can corrupt state.
- The admin is an address in a storage slot.

</Card>
<Card title="Solana program">

- You deploy one program. Upgradeability is built in.
- Calls go directly to the program.
- State lives in separate accounts with their own layouts.
- The upgrade authority is a field of the program data account.

</Card>
</Columns>

## Upgrade, transfer, or lock a program

The upgrade authority signs each of these commands. Removing the authority with
`--final` cannot be undone.

```bash Terminal
# Deploy a new build to the same program ID
solana program deploy ./target/deploy/my_program.so --program-id <PROGRAM_ID>

# Hand the upgrade authority to another keypair
solana program set-upgrade-authority <PROGRAM_ID> --new-upgrade-authority <NEW_AUTHORITY_KEYPAIR>

# Make the program immutable
solana program set-upgrade-authority <PROGRAM_ID> --final
```

<Warning>

**Protect the upgrade authority**

Whoever holds the upgrade authority can replace the program's code. Move it to a
multisig or a governance program before launch. Such an address cannot sign in
the CLI, so pass it with `--skip-new-upgrade-authority-signer-check`. After
that, upgrade by writing the new build to a buffer account and approving the
upgrade through the multisig. Publish a [verified
build](/developers/docs/programs/verified-builds) so users can confirm that the
deployed code matches your source.

</Warning>

## Migrate account data

An upgrade changes the code, and existing accounts keep their old layout. Plan
the data change the way you would plan a storage layout change behind a proxy.

<Steps>
<Step title="Version your accounts">

Store a version field in each account type so the program can tell layouts
apart.

</Step>
<Step title="Append new fields">

Add fields at the end of a struct, and resize each existing account before the
new code reads it, unless you reserved padding. Reordering or removing fields
breaks deserialization of existing accounts.

</Step>
<Step title="Resize existing accounts">

Grow an account with a reallocation, an instruction that changes its data size,
and fund the extra rent deposit. An account can grow by at most 10 KiB per
instruction.

</Step>
<Step title="Migrate lazily or in batches">

Upgrade each account the next time its owner uses it, or run a script that calls
the migration instruction for every account.

</Step>
</Steps>

## Side by side

| Question | EIP-1967 proxy | Solana |
| --- | --- | --- |
| What stays constant? | The proxy address | The program ID |
| Who can upgrade? | The proxy admin | The upgrade authority |
| How do you make it immutable? | Renounce the admin or deploy without a proxy | Set the upgrade authority to none |
| Where does state live? | In the proxy's storage | In data accounts the program owns |
| How do users verify the code? | Verified source for the implementation | A verified build of the program |

## Next steps

<Columns cols={3}>
<Card title="Program deployment" href="/developers/docs/core/programs/program-deployment" arrow>

Read how the loader upgrades a program.

</Card>
<Card title="Verified builds" href="/developers/docs/programs/verified-builds" arrow>

Publish a build that others can reproduce.

</Card>
<Card title="Solidity patterns" href="/developers/docs/migrate-to-solana/ethereum/complete-guide#patterns">

Map other Solidity patterns to Solana.

</Card>
</Columns>
