Automated Address Management
When you publish or upgrade a package, its address is tracked in the Move.lock file. A package's address is its package ID. This happens automatically, so you do not need to manually record or update hexadecimal addresses.
When you publish or upgrade your package on multiple Sui networks (Mainnet, Testnet, Devnet), automated address management tracks separate addresses for each chain. Tracking is based on your active environment. You can run sui client active-env to see your current environment. For example, if your active environment is testnet and you publish a package, the Move.lock records the address for that package and associates it with testnet.
Automated address management works for one package published to one or more Sui networks. If a package is republished to a network, tracked addresses for that network are overwritten.
Adopting automated address management
Previously, a published-at entry in Move.toml was mandatory. It is no longer required if the data is tracked in Move.lock. For an existing package, you can migrate to automated tracking as follows:
- Switch to your active environment for the chain where your package is published:
sui client --switch --env <YOUR-CHAIN-ENVIRONMENT>
- Run the
manage-packagecommand with details of your published package:
sui move manage-package --environment "$(sui client active-env)" \
--network-id "$(sui client chain-identifier)" \
--original-id 'ORIGINAL-ADDRESS' \
--latest-id 'LATEST-ADDRESS' \
--version-number 'VERSION-NUMBER'
-
ORIGINAL-ADDRESS: The address where your package was first published. If you never upgraded, this matches thepublished-ataddress inMove.toml. -
LATEST-ADDRESS: The latest package address. If you never upgraded, this matchesORIGINAL-ADDRESS. If upgraded, it matches the currentpublished-ataddress. -
VERSION-NUMBER:1if you never upgraded. Otherwise, set to the upgrade count. Look up the package atLATEST-ADDRESSto confirm the version number.
-
Delete the
published-atline in yourMove.toml. -
Set your package's address to
0x0in the[addresses]section:
[package]
name = "Kiosk"
[dependencies]
# ... your dependencies ...
[addresses]
kiosk = "0x0"
Your package is now tracked. Repeat the steps to track addresses for additional environments.
Package upgrade guidance
When upgrading, you need the UpgradeCap ID of your package. Automated address management does not track UpgradeCap.
You must also set the [addresses] value for your package to 0x0 in Move.toml, and restore it with the ORIGINAL-ADDRESS after upgrading.
Troubleshooting
Conflicting addresses can occur if package data becomes inconsistent. For example, a package might still have a published-at value in Move.toml while also being tracked in Move.lock. The mismatch causes an error when publishing or upgrading.
To fix conflicts:
-
For your own package:
-
Delete the
published-atvalue inMove.tomlif it's no longer needed. Then set the package's address to0x0in[addresses]. -
Or, follow the adoption steps above.
-
-
For a dependency package:
- Fix the issue locally using the same steps, or contact the package maintainer to update it upstream.
Internal reference
This section explains the schema and internal operation of tracked addresses in Move.lock. Most developers do not need this detail.
Example schema in a Move.lock file:
[env]
[env.testnet]
chain-id = "4c78adac"
original-published-id = "0xa6041ac57f9151d49d00dcdc4f79f8c5ba1e399e1005dcb0fdd1c8632020d5a6"
latest-published-id = "0xa6041ac57f9151d49d00dcdc4f79f8c5ba1e399e1005dcb0fdd1c8632020d5a6"
published-version = "1"
[env.mainnet]
chain-id = "35834a8a"
original-published-id = "0xaee5759aedf6c533634cdd2de412f6e6dfc754a89b0ec554a73597348f334477"
latest-published-id = "0xaee5759aedf6c533634cdd2de412f6e6dfc754a89b0ec554a73597348f334477"
published-version = "1"
-
Each
[env]table entry represents an environment. When a package is published, its entry is added or updated. -
Entries are keyed by
chain-id, not the[env.NAME]. This ensures addresses are resolved consistently even if users assign arbitrary environment names. -
Key-value pairs correspond to the data described in adopting automated address management. Use the
sui move manage-packagecommand as the frontend to modify these values.