You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop/parachains/maintenance/unlock-parachain.md
+34-27Lines changed: 34 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,28 +1,32 @@
1
1
---
2
2
title: Unlock a Parachain
3
-
description: TODO
3
+
description: Learn how to unlock your parachain. This step-by-step guide covers verifying lock status, preparing calls, and executing the unlock process.
4
4
---
5
5
6
6
# Unlock a Parachain
7
7
8
8
## Introduction
9
9
10
-
Parachain locks are designed in such way to ensure the decentralization of parachains. If parachains are not locked when it should be, it could introduce centralization risk for new parachains.
10
+
Parachain locks are a critical security mechanism in the Polkadot ecosystem designed to maintain decentralization during the parachain lifecycle. These locks prevent potential centralization risks that could emerge during the early stages of parachain operation.
11
+
The locking system follows strict, well-defined conditions that distribute control across multiple authorities:
11
12
12
-
A parachain can be locked only with following conditions:
13
+
The locking system follows strict, well-defined conditions that distribute control across multiple authorities:
13
14
14
-
-Relaychain governance MUST be able to lock any parachain.
15
-
- A parachain MUST be able to lock its own lock.
16
-
-A parachain manager SHOULD be able to lock the parachain.
17
-
-A parachain SHOULD be locked when it successfully produced a block for the first time.
15
+
-Relay chain governance has the authority to lock any parachain
16
+
- A parachain can lock its own lock
17
+
-Parachain managers have permission to lock the parachain
18
+
-Parachains are locked automatically when they successfully produce their first block
18
19
19
-
A parachain can be unlocked only with following conditions:
20
-
- Relaychain governance MUST be able to unlock any parachain.
21
-
- A parachain MUST be able to unlock its own lock.
20
+
Similarly, unlocking a parachain follows controlled procedures:
22
21
23
-
## Check if a Parachain is Locked
22
+
- Relay chain governance retains the authority to unlock any parachain
23
+
- A parachain has the ability to unlock its own lock
24
24
25
-
To check if a parachain is locked:
25
+
This document guides you through the process of checking a parachain's lock status and safely executing the unlock procedure from a parachain using XCM (Cross-Consensus Messaging).
26
+
27
+
## Check if the Parachain is Locked
28
+
29
+
Before attempting to unlock a parachain, you should verify its current lock status. This can be done through the Polkadot.js interface:
26
30
27
31
1. In [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank}, connect to the relay chain, navigate to the **Developer** dropdown and select the **Chain State** option
28
32
@@ -37,15 +41,15 @@ To check if a parachain is locked:
37
41
38
42
## How to Unlock a Parachain
39
43
40
-
Unlocking a parachain is then allowed by sending an XCM call to the relay chain with the parachain origin or by executing this from the governance of the relay chain as a roo call.
44
+
Unlocking a parachain requires sending an XCM (Cross-Consensus Message) to the relay chain from the parachain itself, sending a message with Root origin, or this can be accomplished through the relay chain's governance mechanism executing a root call.
41
45
42
-
From a parachain, the XCM message has to be sent from the Root origin. Depending on the parachain, this can be done by using the Sudo pallet or by using the governance mechanism of the parachain.
46
+
If sending an XCM, the parachain origin must have proper authorization, which typically comes from either the parachain's sudo pallet (if enabled) or through its governance system.
43
47
44
-
This guide explains how to send this message assuming your parachain has a Sudo pallet (and the XCM configuration/pallets).
48
+
This guide demonstrates the unlocking process using a parachain with the sudo pallet. For parachains using governance-based authorization instead, the process will require adjustments to how the XCM is sent.
45
49
46
-
### Prepare the Call
50
+
### Prepare the Unlock Call
47
51
48
-
First, you need to prepara the call that will be executed on the relay chain. To do this:
52
+
Before sending the XCM, you need to construct the relay chain call that will be executed. Follow these steps to prepare the `registrar.removeLock` extrinsic:
49
53
50
54
1. In [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank}, connect to the relay chain, navigate to the **Developer** dropdown and select the **Extrinsics** option
51
55
@@ -57,14 +61,17 @@ First, you need to prepara the call that will be executed on the relay chain. To
3.Check the transaction weight for executing the call. You can estimate this by executing the `transactionPaymentCallApi.queryCallInfo` runtime call with the encoded call data previously obtained:
64
+
3.Determine the transaction weight required for executing the call. You can estimate this by executing the `transactionPaymentCallApi.queryCallInfo` runtime call with the encoded call data previously obtained:
This weight information is crucial for properly configuring your XCM message's execution parameters in the next steps.
69
+
70
+
### Fund the Sovereign Account
65
71
66
-
The [sovereign account](https://github.com/polkadot-fellows/xcm-format/blob/10726875bd3016c5e528c85ed6e82415e4b847d7/README.md?plain=1#L50){target=\_blank} of your parachain on the relay chain needs adequate funding to cover the XCM transaction fees.
67
-
To determine your parachain's sovereign account address, you can:
72
+
For a successful XCM execution, the [sovereign account](https://github.com/polkadot-fellows/xcm-format/blob/10726875bd3016c5e528c85ed6e82415e4b847d7/README.md?plain=1#L50){target=\_blank} of your parachain on the relay chain must have sufficient funds to cover transaction fees. The sovereign account is a deterministic address derived from your parachain ID.
73
+
74
+
You can identify your parachain's sovereign account using either of these methods:
68
75
69
76
- Use the **"Para ID" to Address** section in [Substrate Utilities](https://www.shawntabrizi.com/substrate-js-utilities/){target=\_blank} with the **Sibling** option selected
70
77
@@ -82,17 +89,17 @@ To determine your parachain's sovereign account address, you can:
You can transfer funds to this account from any account on the relay chain using a standard transfer.
85
94
86
95
### Craft and Submit the XCM
87
96
88
-
To unlock your parachain, you will submit an XCM from your parachain to the relay chain using Root origin.
89
-
90
-
The XCM needs to execute these operations:
97
+
With the call data prepared and the sovereign account funded, you can now construct and send the XCM from your parachain to the relay chain. The XCM will need to perform several operations in sequence:
91
98
92
-
1. Withdraw DOT from your parachain's sovereign account on the relay chain
99
+
1. Withdraw DOT from your parachain's sovereign account
93
100
2. Buy execution to pay for transaction fees
94
101
3. Execute the `registrar.removeLock` extrinsic
95
-
4.Refund surplus DOT back to the sovereign account
102
+
4.Return any unused funds to your sovereign account
96
103
97
104
Here's how to submit this XCM using Astar (Parachain 2006) as an example:
98
105
@@ -119,6 +126,6 @@ Here's how to submit this XCM using Astar (Parachain 2006) as an example:
After successful execution, your parachain should be unlocked. To verify this, check the status of the parachain lock again using the method described in the [Check if a Parachain is Locked](#check-if-a-parachain-is-locked) section. You should see that the lock has been removed.
129
+
After submitting the transaction, wait for it to be finalized and then verify that your parachain has been successfully unlocked by following the steps described in the [Check if a Parachain is Locked](#check-if-a-parachain-is-locked) section. If the parachain shows as unlocked, your operation has been successful. If it still appears locked, verify that your XCM transaction was processed correctly and consider troubleshooting the XCM built.
- [**`decl_test_networks`**](https://github.com/paritytech/polkadot-sdk/blob/{{dependencies.repositories.polkadot_sdk.version}}/cumulus/xcm/xcm-emulator/src/lib.rs#L916){target=\_blank} - defines a testing network with relay chains, parachains, and bridges, implementing message transport and processing logic. Example:
694
694
695
695
```rust
696
-
Failed to fetch snippet after 3 attempts
696
+
decl_test_networks! {
697
+
pub struct WestendMockNet {
698
+
relay_chain = Westend,
699
+
parachains = vec![
700
+
AssetHubWestend,
701
+
BridgeHubWestend,
702
+
CollectivesWestend,
703
+
CoretimeWestend,
704
+
PeopleWestend,
705
+
PenpalA,
706
+
PenpalB,
707
+
],
708
+
bridge = ()
709
+
},
710
+
}
697
711
```
698
712
699
713
By leveraging these macros, developers can customize their testing networks by defining relay chains and parachains tailored to their needs. For guidance on implementing a mock runtime for a Polkadot SDK-based chain, refer to the [Pallet Testing](/develop/parachains/testing/pallet-testing/){target=\_blank} article.
@@ -5600,30 +5614,136 @@ For a complete implementation example of multi-block migrations, refer to the [o
description: Learn how to unlock your parachain. This step-by-step guide covers verifying lock status, preparing calls, and executing the unlock process.
5605
5619
---
5606
5620
5607
-
# Unlock Parachain
5621
+
# Unlock a Parachain
5608
5622
5609
5623
## Introduction
5610
5624
5611
-
Parachain locks are designed in such way to ensure the decentralization of parachains. If parachains are not locked when it should be, it could introduce centralization risk for new parachains.
5625
+
Parachain locks are a critical security mechanism in the Polkadot ecosystem designed to maintain decentralization during the parachain lifecycle. These locks prevent potential centralization risks that could emerge during the early stages of parachain operation.
5626
+
The locking system follows strict, well-defined conditions that distribute control across multiple authorities:
5627
+
5628
+
The locking system follows strict, well-defined conditions that distribute control across multiple authorities:
5629
+
5630
+
- Relay chain governance has the authority to lock any parachain
5631
+
- A parachain can lock its own lock
5632
+
- Parachain managers have permission to lock the parachain
5633
+
- Parachains are locked automatically when they successfully produce their first block
5634
+
5635
+
Similarly, unlocking a parachain follows controlled procedures:
5636
+
5637
+
- Relay chain governance retains the authority to unlock any parachain
5638
+
- A parachain has the ability to unlock its own lock
5639
+
5640
+
This document guides you through the process of checking a parachain's lock status and safely executing the unlock procedure from a parachain using XCM (Cross-Consensus Messaging).
5641
+
5642
+
## Check if the Parachain is Locked
5643
+
5644
+
Before attempting to unlock a parachain, you should verify its current lock status. This can be done through the Polkadot.js interface:
5645
+
5646
+
1. In [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank}, connect to the relay chain, navigate to the **Developer** dropdown and select the **Chain State** option
5647
+
5648
+
2. Query the parachain locked status:
5649
+
1. Select **`registrar`**
5650
+
2. Choose the **`paras`** option
5651
+
3. Input the parachain ID you want to check as a parameter (e.g. `2006`)
Unlocking a parachain requires sending an XCM (Cross-Consensus Message) to the relay chain from the parachain itself, sending a message with Root origin, or this can be accomplished through the relay chain's governance mechanism executing a root call.
5660
+
5661
+
If sending an XCM, the parachain origin must have proper authorization, which typically comes from either the parachain's sudo pallet (if enabled) or through its governance system.
5662
+
5663
+
This guide demonstrates the unlocking process using a parachain with the sudo pallet. For parachains using governance-based authorization instead, the process will require adjustments to how the XCM is sent.
5612
5664
5613
-
A parachain can be locked only with following conditions:
5665
+
### Prepare the Unlock Call
5666
+
5667
+
Before sending the XCM, you need to construct the relay chain call that will be executed. Follow these steps to prepare the `registrar.removeLock` extrinsic:
5668
+
5669
+
1. In [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank}, connect to the relay chain, navigate to the **Developer** dropdown and select the **Extrinsics** option
5670
+
5671
+
2. Build the `registrar.removeLock` extrinsic
5672
+
1. Select the **registrar** pallet
5673
+
2. Choose the **removeLock** extrinsic
5674
+
3. Fill in the parachain ID parameter (e.g. `2006`)
3. Determine the transaction weight required for executing the call. You can estimate this by executing the `transactionPaymentCallApi.queryCallInfo` runtime call with the encoded call data previously obtained:
This weight information is crucial for properly configuring your XCM message's execution parameters in the next steps.
5684
+
5685
+
### Fund the Sovereign Account
5686
+
5687
+
For a successful XCM execution, the [sovereign account](https://github.com/polkadot-fellows/xcm-format/blob/10726875bd3016c5e528c85ed6e82415e4b847d7/README.md?plain=1#L50){target=\_blank} of your parachain on the relay chain must have sufficient funds to cover transaction fees. The sovereign account is a deterministic address derived from your parachain ID.
5688
+
5689
+
You can identify your parachain's sovereign account using either of these methods:
5690
+
5691
+
- Use the **"Para ID" to Address** section in [Substrate Utilities](https://www.shawntabrizi.com/substrate-js-utilities/){target=\_blank} with the **Sibling** option selected
5692
+
5693
+
- Calculate it manually:
5614
5694
5615
-
- Relaychain governance MUST be able to lock any parachain.
5616
-
- A parachain MUST be able to lock its own lock.
5617
-
- A parachain manager SHOULD be able to lock the parachain.
5618
-
- A parachain SHOULD be locked when it successfully produced a block for the first time.
5695
+
1. Identify the appropriate prefix:
5696
+
5697
+
- For parent/child chains use the prefix `0x70617261` (which decodes to `b"para"`)
5698
+
5699
+
2. Encode your parachain ID as a u32 [SCALE](https://docs.polkadot.com/polkadot-protocol/basics/data-encoding/#data-types){target=\_blank} value:
5700
+
5701
+
- For parachain 2006, this would be `d6070000`
5702
+
5703
+
3. Combine the prefix with the encoded ID to form the sovereign account address:
You can transfer funds to this account from any account on the relay chain using a standard transfer.
5709
+
5710
+
### Craft and Submit the XCM
5711
+
5712
+
With the call data prepared and the sovereign account funded, you can now construct and send the XCM from your parachain to the relay chain. The XCM will need to perform several operations in sequence:
5713
+
5714
+
1. Withdraw DOT from your parachain's sovereign account
5715
+
2. Buy execution to pay for transaction fees
5716
+
3. Execute the `registrar.removeLock` extrinsic
5717
+
4. Return any unused funds to your sovereign account
5718
+
5719
+
Here's how to submit this XCM using Astar (Parachain 2006) as an example:
5720
+
5721
+
1. In [Polkadot.js Apps](https://polkadot.js.org/apps/#/explorer){target=\_blank}, connect to the parachain, navigate to the **Developer** dropdown and select the **Extrinsics** option
5722
+
5723
+
2. Create a `sudo.sudo` extrinsic that executes `polkadotXcm.send`:
5724
+
1. Use the `sudo.sudo` extrinsic to execute the following call as Root
After submitting the transaction, wait for it to be finalized and then verify that your parachain has been successfully unlocked by following the steps described in the [Check if a Parachain is Locked](#check-if-a-parachain-is-locked) section. If the parachain shows as unlocked, your operation has been successful. If it still appears locked, verify that your XCM transaction was processed correctly and consider troubleshooting the XCM built.
0 commit comments