bittensor.core.extrinsics.asyncex.coldkey_swap#
Functions#
|
Announces a coldkey swap by submitting the BlakeTwo256 hash of the new coldkey. |
|
Clears (withdraws) a pending coldkey swap announcement. |
|
Disputes the coldkey swap announcement for the current coldkey. |
|
Removes a coldkey swap announcement. |
|
Executes a previously announced coldkey swap. |
Module Contents#
- async bittensor.core.extrinsics.asyncex.coldkey_swap.announce_coldkey_swap_extrinsic(subtensor, wallet, new_coldkey_ss58, *, mev_protection=DEFAULT_MEV_PROTECTION, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, wait_for_revealed_execution=True)#
Announces a coldkey swap by submitting the BlakeTwo256 hash of the new coldkey.
This extrinsic allows a coldkey to declare its intention to swap to a new coldkey address. The announcement must be made before the actual swap can be executed, and a delay period must pass before execution is allowed. After making an announcement, all transactions from the coldkey are blocked except for swap_coldkey_announced.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance with the connection to the chain.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object (should be the current coldkey wallet).
new_coldkey_ss58 (str) – SS58 address of the new coldkey that will replace the current one.
mev_protection (bool) – If
True, encrypts and submits the transaction through the MEV Shield pallet to protect against front-running and MEV attacks. The transaction remains encrypted in the mempool until validators decrypt and execute it. IfFalse, submits the transaction directly without encryption.period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning
Falseif unsuccessful.wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
wait_for_revealed_execution (bool) – Whether to wait for the revealed execution of transaction if mev_protection used.
- Returns:
The result object of the extrinsic execution.
- Return type:
Notes
A swap cost is charged when making the first announcement (not when reannouncing).
After making an announcement, all transactions from the coldkey are blocked except for swap_coldkey_announced.
The swap can only be executed after the delay period has passed (check via get_coldkey_swap_announcement).
The destination coldkey cannot have any staking hotkeys. It must be completely new without any staking activity.
- async bittensor.core.extrinsics.asyncex.coldkey_swap.clear_coldkey_swap_announcement_extrinsic(subtensor, wallet, *, mev_protection=DEFAULT_MEV_PROTECTION, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, wait_for_revealed_execution=True)#
Clears (withdraws) a pending coldkey swap announcement.
Callable by the coldkey that has an active, undisputed swap announcement. The reannouncement delay must have elapsed past the execution block before the announcement can be cleared.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance with the connection to the chain.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object (should be the current coldkey with an active announcement).
mev_protection (bool) – If
True, encrypts and submits the transaction through the MEV Shield pallet.period (Optional[int]) – The number of blocks during which the transaction will remain valid.
raise_error (bool) – Raises a relevant exception rather than returning
Falseif unsuccessful.wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
wait_for_revealed_execution (bool) – Whether to wait for the revealed execution if mev_protection used.
- Returns:
The result object of the extrinsic execution.
- Return type:
Notes
The coldkey must have an active, undisputed swap announcement.
The reannouncement delay must have elapsed past the execution block.
- async bittensor.core.extrinsics.asyncex.coldkey_swap.dispute_coldkey_swap_extrinsic(subtensor, wallet, *, mev_protection=DEFAULT_MEV_PROTECTION, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, wait_for_revealed_execution=True)#
Disputes the coldkey swap announcement for the current coldkey.
Callable by the coldkey that has an active swap announcement. Marks the swap as disputed. The account is blocked until root calls reset_coldkey_swap.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance with the connection to the chain.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object (should be the current coldkey with an active announcement).
mev_protection (bool) – If
True, encrypts and submits the transaction through the MEV Shield pallet.period (Optional[int]) – The number of blocks during which the transaction will remain valid.
raise_error (bool) – Raises a relevant exception rather than returning
Falseif unsuccessful.wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
wait_for_revealed_execution (bool) – Whether to wait for the revealed execution if mev_protection used.
- Returns:
The result object of the extrinsic execution.
- Return type:
Notes
The coldkey must have an active swap announcement.
After disputing, only root can clear the state via reset_coldkey_swap.
- async bittensor.core.extrinsics.asyncex.coldkey_swap.remove_coldkey_swap_announcement_extrinsic(subtensor, wallet, coldkey_ss58, *, mev_protection=DEFAULT_MEV_PROTECTION, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, wait_for_revealed_execution=True)#
Removes a coldkey swap announcement.
This extrinsic can only called by root. It removes a pending coldkey swap announcement for the specified coldkey.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance with the connection to the chain.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object (must be root/admin wallet).
coldkey_ss58 (str) – SS58 address of the coldkey to remove the swap announcement for.
mev_protection (bool) – If
True, encrypts and submits the transaction through the MEV Shield pallet to protect against front-running and MEV attacks. The transaction remains encrypted in the mempool until validators decrypt and execute it. IfFalse, submits the transaction directly without encryption.period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning
Falseif unsuccessful.wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
wait_for_revealed_execution (bool) – Whether to wait for the revealed execution of transaction if mev_protection used.
- Returns:
The result object of the extrinsic execution.
- Return type:
Notes
This function can only called by root.
- async bittensor.core.extrinsics.asyncex.coldkey_swap.swap_coldkey_announced_extrinsic(subtensor, wallet, new_coldkey_ss58, *, mev_protection=DEFAULT_MEV_PROTECTION, period=None, raise_error=False, wait_for_inclusion=True, wait_for_finalization=True, wait_for_revealed_execution=True)#
Executes a previously announced coldkey swap.
This extrinsic executes a coldkey swap that was previously announced via announce_coldkey_swap_extrinsic. The new coldkey address must match the hash that was announced, and the delay period must have passed.
- Parameters:
subtensor (bittensor.core.async_subtensor.AsyncSubtensor) – AsyncSubtensor instance with the connection to the chain.
wallet (bittensor_wallet.Wallet) – Bittensor wallet object (should be the current coldkey wallet that made the announcement).
new_coldkey_ss58 (str) – SS58 address of the new coldkey to swap to. This must match the hash that was announced.
mev_protection (bool) – If
True, encrypts and submits the transaction through the MEV Shield pallet to protect against front-running and MEV attacks. The transaction remains encrypted in the mempool until validators decrypt and execute it. IfFalse, submits the transaction directly without encryption.period (Optional[int]) – The number of blocks during which the transaction will remain valid after it’s submitted. If the transaction is not included in a block within that number of blocks, it will expire and be rejected. You can think of it as an expiration date for the transaction.
raise_error (bool) – Raises a relevant exception rather than returning
Falseif unsuccessful.wait_for_inclusion (bool) – Whether to wait for the inclusion of the transaction.
wait_for_finalization (bool) – Whether to wait for the finalization of the transaction.
wait_for_revealed_execution (bool) – Whether to wait for the revealed execution of transaction if mev_protection used.
- Returns:
The result object of the extrinsic execution.
- Return type:
Notes
The new coldkey hash must match the hash that was announced.
The delay period must have passed (check via get_coldkey_swap_announcement).
- All assets, stakes, subnet ownerships, and hotkey associations are transferred from the old coldkey to the new
one.