Skip to main content

Restore archived contract data using the Soroban CLI

If a contract's persistent storage entry has been archived, you can restore it using the Soroban CLI. For a storage entry that uses a simple Symbol as its storage key, you can run a command like so:

soroban contract restore \
--source S... \
--network testnet \
--id C... \
--key COUNTER \
--durability persistent

If your storage entry uses a more advanced storage key, such as Balance(Address) in a token contract, you'll need to provide the key in a base64-encoded XDR form:

soroban contract restore \
--source S... \
--network testnet \
--id C... \
--key-xdr AAAABgAAAAHXkotywnA8z+r365/0701QSlWouXn8m0UOoshCtNHOYQAAAA4AAAAHQmFsYW5jZQAAAAAB \
--durability persistent
info

Be sure to check out our guide on creating XDR ledger keys for help generating them.

Guides in this category: