概要
起動中のL1 Blockchainをアップグレードしたい場合があります。 例えば、L1 Blockchainの新しい設定を定義・反映・管理やVMバイナリの更新などです。
avalanche blockchain upgrade [subcommand] [flags]アップグレードファイルの生成
L1 Blockchainの新しい設定ファイルである upgrade.json ファイルを生成します。
以下のコマンドを実行してください。
「chain name」には、アップグレードファイルを生成したいL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade generate <chain name>以下のように間違った状態でチェーンの設定ファイルを反映させると、L1 Blockchainが停止する可能性があるという警告文が表示されます。 「Yes」を選択してください。
Any mistakes in configuring network upgrades or coordinating them on validators may cause the network to halt and recovering may be difficult.
Please consult https://docs.avax.network/avalanche-l1s/upgrade/customize-avalanche-l1#network-upgrades-enabledisable-precompiles for more information
Use the arrow keys to navigate: ↓ ↑ → ←
? Press [Enter] to continue, or abort by choosing 'no':
▸ Yes
Noアップグレードする項目について確認されます。 1回のアップグレードで1つの項目にすることが推奨されています。 今回は「Native Minting」を選択してみます。
Avalanchego and this tool support configuring multiple precompiles. However, we suggest to only configure one per upgrade.
Use the arrow keys to navigate: ↓ ↑ → ←
? Select the precompile to configure:
Contract Deployment Allow List
Adjust Fee Settings Post Deploy
▸ Native Minting
Transaction Allow List
Customize Fees Distributionいつから反映させるかを確認されています。 「In 5 minutes」を選択してください。
Set parameters for the "Native Minting" precompile
Use the arrow keys to navigate: ↓ ↑ → ←
? When should the precompile be activated?:
▸ In 5 minutes
In 1 day
In 1 week
In 2 weeks
Custom「Allow List」への設定を求めらるので、まずは現在の設定を確認します。 「Preview Allow List」を選択してください。
The chosen block activation time is 2025-09-04 14:32:52
Use the arrow keys to navigate: ↓ ↑ → ←
? Configure the addresses that are allowed to mint native tokens:
Add an address for a role to the allow list
▸ Preview Allow List
Confirm Allow List
Cancel現在は以下のように何も設定がされていません。
+---------+-------------+
| Admins | |
+---------+-------------+
| Manager | |
+---------+-------------+
| Enabled | |
+---------+-------------+
Caution: Allow lists are empty. You will not be able to easily change the precompile settings in the future.追加するために、「Add an address for a role to the allow list」を選択してください。
? Configure the addresses that are allowed to mint native tokens:
▸ Add an address for a role to the allow list
Preview Allow List
Confirm Allow List
Cancel管理者権限を追加したいので、「Admin」を選択してください。
? What role should the address have?:
▸ Admin
Manager
Enabled
Explain the difference
Cancel以下で管理者に設定するアドレスの入力を求めらるので、任意のアドレスを設定してください。 複数選択する場合は、カンマ区切りでつなげてください。
✔ Enter the address of the account (or multiple comma separated):- 例
✔ Enter the address of the account (or multiple comma separated): 0xAe451f1873B4C4D7263631Bf0ea141D54Ba39eEa✔ Enter the address of the account (or multiple comma separated): 0xCe451f1873B4C4D7263631Bf0ea141D54Ba39eEa,0xDe451f1873B4C4D7263631Bf0ea141D54Ba39eEaでは、再度現在の設定を確認してみます。 「Preview Allow List」を選択してください。
? Configure the addresses that are allowed to mint native tokens:
Add an address for a role to the allow list
Remove address from the allow list
▸ Preview Allow List
Confirm Allow List
Cancel以下のように先ほど追加したアドレスが追加されているはずです。
+---------+--------------------------------------------+
| Admins | 0xAe451f1873B4C4D7263631Bf0ea141D54Ba39eEa |
+---------+--------------------------------------------+
| Manager | |
+---------+--------------------------------------------+
| Enabled | |
+---------+--------------------------------------------+「Confirm Allow List」を選択して、設定を確定してください。
? Configure the addresses that are allowed to mint native tokens:
Add an address for a role to the allow list
Remove address from the allow list
Preview Allow List
▸ Confirm Allow List
Cancel以下のように確認を求められるので、「Yes」を選択してください。
? Confirm?:
▸ Yes
No, keep editing初期発行するか聞かれるので、「Yes」を選択してください。
? Airdrop more tokens? (`initialMint` section in file):
▸ Yes
Noどのように初期発行するか聞かれるので、「Add」を選択してください。
? How would you like to distribute your funds:
▸ Add
Delete
Preview
More Info
↓ Done初期発行先のアドレスの選択を求められるので、任意のアドレスを入力してください。
✗ Address to airdrop to:発行するトークン量の入力を求められるので、「10000000」など任意の値を入力してください。
✗ Amount to airdrop (in TK01 units):「Preview」を選択して、現在の設定を確認します。
? How would you like to distribute your funds:
Add
Delete
▸ Preview
More Info
↓ Done以下のように、先ほど設定したアドレスとトークン量が設定されているはずです。 先ほどの「Add」と同じ手順でアドレスを追加することで、複数アドレスを設定することも可能です。
0. 0xAe451f1873B4C4D7263631Bf0ea141D54Ba39eEa-10000000「Done」を選択してください。
? How would you like to distribute your funds:
Add
Delete
Preview
More Info
↓ ▸ Done他のプリコンパイルを設定するか聞かれます。 先ほども言ったように、1回のアップグレードでは1つの設定変更が推奨されているため、「No」を選択してください。
? Should we configure another precompile?:
▸ No
Yes以下のように出力されていれば実行が成功して、「/Users/<username>/.avalanche-cli/subnets/chain1/upgrade.json」という場所に先ほどの設定が反映されているファイルが保存されます。
Writing upgrade into /Users/<username>/.avalanche-cli/subnets/chain1/upgrade.json
To apply the change on Local Network:
avalanche network stop
avalanche network start
To apply the change to local validators on Fuji:
avalanche node local stop chain1-local-node-fuji
avalanche node local start chain1-local-start-fuji
To apply the change to local validators on Mainnet:
avalanche node local stop chain1-local-node-mainnet
avalanche node local start chain1-local-start-mainnet{
"precompileUpgrades": [
{
"contractNativeMinterConfig": {
"adminAddresses": [
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea"
],
"blockTimestamp": 1756963972,
"initialMint": {
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea": "0x989680"
}
}
}
]
}実際にファイルとして保存されているかも確認します。
以下のコマンドを実行して、~/.avalanche-cli/subnets/chain1 配下のファイルを確認します。
ls ~/.avalanche-cli/subnets/chain1以下のように、upgrade.json というファイルが生成されています。
chain.json genesis.json sidecar.json upgrade.json中身を確認すると以下のようになっているので、ちゃんと先ほどの設定を反映したファイルが生成されています。
{
"precompileUpgrades": [
{
"contractNativeMinterConfig": {
"adminAddresses": [
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea"
],
"blockTimestamp": 1756963972,
"initialMint": {
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea": "0x989680"
}
}
}
]
}アップグレードファイルの出力
生成したアップグレードファイルの内容をコンソールに出力して、すぐに内容を確認していきます。 以下のコマンドを実行してください。 「chain name」には、作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade print <chain name>- 例
avalanche blockchain upgrade print chain1以下のようにコンソールに出力されていれば実行成功です。
{
"precompileUpgrades": [
{
"contractNativeMinterConfig": {
"adminAddresses": [
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea"
],
"blockTimestamp": 1756963972,
"initialMint": {
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea": "0x989680"
}
}
}
]
}アップグレードファイルのexport
生成済みのアップグレードバイトファイルを任意の場所に出力します。 このファイルは他のノードへの配布やバックアップに利用できます。 以下のコマンドを実行してください 「chain name」には、作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade export <chain name>- 例
avalanche blockchain upgrade export chain1そうすると以下のようにどこに保存するかを確認されるので、config.json としてしてください。
Provide a path where we should export the file to:そうすると、実行したディレクトリの配下に config.json が生成されます。
中身を確認してみると以下のようになっており、先ほど設定した情報が出力されています。
{
"precompileUpgrades": [
{
"contractNativeMinterConfig": {
"adminAddresses": [
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea"
],
"blockTimestamp": 1756963972,
"initialMint": {
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea": "0x989680"
}
}
}
]
}upgrade.json の内容が出力されるため、upgrade.json がない場合は以下のようなエラーが出ます。
Error: open /Users/cardene/.avalanche-cli/subnets/chain2/upgrade.json: no such file or directory以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--force If true, overwrite a possibly existing file without prompting
--upgrade-filepath string Export upgrade bytes file to location of choice on disk--forceエクスポート先に同名のファイルが既に存在する場合でも、確認なしで上書き保存します。--upgrade-filepath stringアップグレードバイトファイルを出力するパスを指定します。 任意のディレクトリ・ファイル名を設定可能です。
アップグレードファイルのimport
exportされたアップグレードファイルをローカル環境に取り込みます。 このコマンドを利用することで、他ノードから共有されたアップグレードファイルを自身の作成したL1 Blockchainに適用することができます。
まずは別のL1 Blockchainを作成する必要があるため、chain2 というチェーンを作成します。
以下のコマンドを実行してください。
avalanche blockchain create chain2詳細は「L1の作成」を参考にしてください。
デプロイはしなくて良いので、以下のコマンドで chain1 のアップグレード設定を chain2 に反映させます。
以下のコマンドを実行してください。
「chain name」には、先ほど作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade import <chain name>- 例
avalanche blockchain upgrade import chain2どのファイルをimportするか聞かれるので、先ほどexportしたファイルのパスである config.json を入力してください。
✗ Provide the path to the upgrade file to import:以下のように出力されていれば、chain2 に chain1 のアップグレード設定を反映できています。
Writing upgrade into /Users/cardene/.avalanche-cli/subnets/chain2/upgrade.json
To apply the change on Local Network:
avalanche network stop
avalanche network start
To apply the change to local validators on Fuji:
avalanche node local stop chain2-local-node-fuji
avalanche node local start chain2-local-start-fuji
To apply the change to local validators on Mainnet:
avalanche node local stop chain2-local-node-mainnet
avalanche node local start chain2-local-start-mainnet念の為、print コマンドで確認してみます。
以下のコマンドを実行してください。
「chain name」には、先ほど作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade import <chain name>- 例
avalanche blockchain upgrade print chain2以下のように出力されていれば、chain1 のアップグレード設定が適切に chain2 にも反映されています。
{
"precompileUpgrades": [
{
"contractNativeMinterConfig": {
"adminAddresses": [
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea"
],
"blockTimestamp": 1756963972,
"initialMint": {
"0xae451f1873b4c4d7263631bf0ea141d54ba39eea": "0x989680"
}
}
}
]
}以下のようなオプションがあるので簡単に説明します。
--upgrade-filepath string Import upgrade bytes file into local environment--upgrade-filepath stringimportするアップグレードバイトファイルのパスを指定します。 エクスポート済みファイルを取り込む際に必須のオプションです。
VMバイナリのアップグレード
ブロックチェーンのVM(仮想マシン)バイナリをアップグレードするために利用します。 対象はローカル環境のブロックチェーンかFuji / Mainnetにデプロイされたブロックチェーンの両方です。 以下のコマンドを実行してください。 「chain name」には、先ほど作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade vm <chain name>- 例
avalanche blockchain upgrade vm chain2変更するVMの設定について確認されますが、現在は1つしかないのでそのまま選択してください。
What deployment would you like to upgrade:
▸ Update config for future deploymentsどのようにVMを更新するか確認されます。 今回は別バージョンのVMを設定したので、「Update to a specific version」を選択してください。
? How would you like to update your subnet's virtual machine:
Update to latest version
▸ Update to a specific version
Update to a custom binary更新するバージョンを幾つにするか確認されるので、「v0.7.5」と入力してください。 Subnet EVMのバージョンについては以下から確認できます。 https://github.com/ava-labs/subnet-evm/releases
Enter version:以下のように出力されれば、VMの設定完了です。 次回のアップグレード反映時に適用されるようになります。
VM updated for future deployments. Update will apply next time subnet is deployed.以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--binary string Upgrade to custom binary
--fuji fuji upgrade existing fuji deployment (alias for `testnet`)
--latest upgrade to latest version
--local local upgrade existing local deployment
--mainnet mainnet upgrade existing mainnet deployment
--plugin-dir string plugin directory to automatically upgrade VM
--print print instructions for upgrading
--testnet testnet upgrade existing testnet deployment (alias for `fuji`)
--version string Upgrade to custom version--binary stringカスタムのVMバイナリファイルを指定してアップグレードを行います。--fujiFuji Testnet上にデプロイ済みのブロックチェーンをアップグレードします。--testnetのエイリアスです。--latest利用可能な最新のVMバージョンにアップグレードします。--localローカル環境にデプロイ済みのブロックチェーンをアップグレードします。--mainnetMainnet上にデプロイ済みのブロックチェーンをアップグレードします。--plugin-dir string指定したプラグインディレクトリを利用してVMを自動的にアップグレードします。--print実際の適用は行わず、アップグレード手順を出力します。 Publicネットワーク上での手動作業の参考に使えます。--testnetTestnet(Fuji)上のブロックチェーンをアップグレードします。--fujiと同義です。--version string特定のバージョンを指定してアップグレードを実行します。
アップグレードの反映
生成済みのアップグレードファイルを現在稼働中のL1 Blockchainノードに適用します。 Publicネットワーク(Fuji Testnet または Mainnet)で利用する場合は、対象のバリデータにアクセスできる必要があります。 Avalanche CLIが同一マシンで動作している場合はノード設定を自動で変更しますが、別マシンから実行する場合は手動で行うための設定手順を出力します。
設定を更新した後は必ずバリデータを手動で再起動** してください。
また --avalanchego-chain-config-dir を指定すると、アップグレードファイルをそのディレクトリに書き込みます。
以下のコマンドを実行してください。
「chain name」には、先ほど作成したL1 Blockchainの名前を入力してください。
avalanche blockchain upgrade apply <chain name>- 例
avalanche blockchain upgrade apply chain1どの設定を適用させるか確認されますが、1つしかないのでそのまま選択してください。
? What deployment would you like to upgrade:
▸ Existing local deploymentアップグレードの確認を求めらるので、「Yes」を選択してください。
Warning: one or more of your upgrades is set to happen in the past.
If you've already upgraded your network, the configuration is likely correct and will not cause problems.
If this is a new upgrade, this configuration could cause unpredictable behavior and irrecoverable damage to your Subnet.
The config MUST be removed. Use caution before proceeding
Use the arrow keys to navigate: ↓ ↑ → ←
? Do you want to continue (use --force to skip prompting)?: ▸ Yes
Noただ、なぜか以下のようにうまくいかないので、原因がわかったらこの部分を修正します。
No local network running. Please start the network first.
Error: timed out trying to contact backend controller, it is most probably not running以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--avalanchego-chain-config-dir string avalanchego's chain config file directory (default "/home/runner/.avalanchego/chains")
--config create upgrade config for future subnet deployments (same as generate)
--force If true, don't prompt for confirmation of timestamps in the past
--fuji fuji apply upgrade existing fuji deployment (alias for `testnet`)
-h, --help help for apply
--local local apply upgrade existing local deployment
--mainnet mainnet apply upgrade existing mainnet deployment
--print if true, print the manual config without prompting (for public networks only)
--testnet testnet apply upgrade existing testnet deployment (alias for `fuji`)
--log-level string log level for the application (default "ERROR")
--skip-update-check skip check for new versions--avalanchego-chain-config-dir stringAvalancheGoのチェーン設定ファイルを配置するディレクトリを指定します。 デフォルトは、/home/runner/.avalanchego/chainsです。--config将来のサブネットデプロイ用にアップグレード設定を生成します。upgrade generateと同等の動作を行います。--force過去のタイムスタンプに関する確認を行わず、強制的に適用します。--fujiFuji Testnet上の既存デプロイにアップグレードを適用します。--testnetのエイリアスです。--localローカル環境にデプロイされたブロックチェーンにアップグレードを適用します。--mainnetMainnet上の既存デプロイにアップグレードを適用します。--printPublicネットワークで利用する時に、アップグレード手順を実行せずに表示します。 手動設定を行いたい場合に有効です。--testnetTestnet(Fuji)上の既存デプロイにアップグレードを適用します。--fujiのエイリアスです。--log-level stringログ出力の詳細度を指定します。 デフォルトは"ERROR"です。 例:"INFO","DEBUG","WARN"