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

# Extend a deployed contract's Wasm code TTL

> Use Stellar CLI to extend contract's Wasm bytecode TTL, with or without local binary

You can use the Stellar CLI to extend the TTL of a contract's Wasm bytecode. This can be done in two forms: if you do or do not have the compiled contract locally. If you do have the compiled binary on your local machine:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
stellar contract extend \
    --source S... \
    --network testnet \
    --wasm ../relative/path/to/soroban_contract.wasm \
    --ledgers-to-extend 535679 \
    --durability persistent
```

This example uses 535,679 ledgers as the new archival TTL. This is the maximum allowable value for this argument on the CLI. This corresponds to roughly 30 days (averaging 5 second ledger close times).

If you do not have the compiled binary on your local machine, you can still use the CLI to extend the bytecode TTL. You'll need to know the Wasm hash of the installed contract code:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
stellar contract extend \
    --source S... \
    --network testnet \
    --wasm-hash <hex-encoded-wasm-hash> \
    --ledgers-to-extend 535679 \
    --durability persistent
```

> [!NOTE]
>
> You can learn more about finding the correct Wasm hash for a contract instance [here (JavaScript)](https://developers.stellar.org/docs/build/guides/rpc/retrieve-contract-code-js.md) and [here (Python)](https://developers.stellar.org/docs/build/guides/rpc/retrieve-contract-code-python.md).
