Skip to content

Commit 10d11f0

Browse files
committed
Add final content
1 parent a095801 commit 10d11f0

File tree

7 files changed

+102
-3
lines changed

7 files changed

+102
-3
lines changed

develop/parachains/maintenance/unlock-parachain.md

Lines changed: 102 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
title: Unlock Parachain
2+
title: Unlock a Parachain
33
description: TODO
44
---
55

6-
# Unlock Parachain
6+
# Unlock a Parachain
77

88
## Introduction
99

@@ -22,4 +22,103 @@ A parachain can be unlocked only with following conditions:
2222

2323
## Check if a Parachain is Locked
2424

25-
To check if a parachain is locked,
25+
To check if a parachain is locked:
26+
27+
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+
29+
2. Query the parachain locked status:
30+
1. Select **`registrar`**
31+
2. Choose the **`paras`** option
32+
3. Input the parachain ID you want to check as a parameter (e.g. `2006`)
33+
4. Click the **+** button to execute the query
34+
5. Check the status of the parachain lock
35+
36+
![](/images/develop/parachains/maintenance/unlock-parachain/unlock-parachain-1.webp)
37+
38+
## How to Unlock a Parachain
39+
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.
41+
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.
43+
44+
This guide explains how to send this message assuming your parachain has a Sudo pallet (and the XCM configuration/pallets).
45+
46+
### Prepare the Call
47+
48+
First, you need to prepara the call that will be executed on the relay chain. To do this:
49+
50+
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+
52+
2. Build the `registrar.removeLock` extrinsic
53+
1. Select the **registrar** pallet
54+
2. Choose the **removeLock** extrinsic
55+
3. Fill in the parachain ID parameter (e.g. `2006`)
56+
4. Copy the encoded call data
57+
58+
![](/images/develop/parachains/maintenance/unlock-parachain/unlock-parachain-2.webp)
59+
60+
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:
61+
62+
![](/images/develop/parachains/deployment/coretime-renewal/coretime-renewal-3.webp)
63+
64+
### Fund Sovereign Account
65+
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:
68+
69+
- 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+
71+
- Calculate it manually:
72+
73+
1. Identify the appropriate prefix:
74+
75+
- For parent/child chains use the prefix `0x70617261` (which decodes to `b"para"`)
76+
77+
2. Encode your parachain ID as a u32 [SCALE](https://docs.polkadot.com/polkadot-protocol/basics/data-encoding/#data-types){target=\_blank} value:
78+
79+
- For parachain 2006, this would be `d6070000`
80+
81+
3. Combine the prefix with the encoded ID to form the sovereign account address:
82+
83+
- **Hex** - `0x70617261d6070000000000000000000000000000000000000000000000000000`
84+
- **SS58 format** - `5Ec4AhPW97z4ZyYkd3mYkJrSeZWcwVv4wiANES2QrJi1x17F`
85+
86+
### Craft and Submit the XCM
87+
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:
91+
92+
1. Withdraw DOT from your parachain's sovereign account on the relay chain
93+
2. Buy execution to pay for transaction fees
94+
3. Execute the `registrar.removeLock` extrinsic
95+
4. Refund surplus DOT back to the sovereign account
96+
97+
Here's how to submit this XCM using Astar (Parachain 2006) as an example:
98+
99+
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
100+
101+
2. Create a `sudo.sudo` extrinsic that executes `polkadotXcm.send`:
102+
1. Use the `sudo.sudo` extrinsic to execute the following call as Root
103+
2. Select the **polkadotXcm** pallet
104+
3. Choose the **send** extrinsic
105+
4. Set the **dest** parameter as the relay chain
106+
107+
![](/images/develop/parachains/maintenance/unlock-parachain/unlock-parachain-4.webp)
108+
109+
3. Construct the XCM and submit it:
110+
1. Add a **WithdrawAsset** instruction
111+
2. Add a **BuyExecution** instruction
112+
3. Add a **Transact** instruction with the following parameters:
113+
- **originKind** - use `Native`
114+
- **requireWeightAtMost** - use the weight calculated previously
115+
- **call** - use the encoded call data generated before
116+
4. Add a **RefundSurplus** instruction
117+
5. Add a **DepositAsset** instruction to send the remaining funds to the parachain sovereign account
118+
6. Click the **Submit Transaction** button
119+
120+
![](/images/develop/parachains/maintenance/unlock-parachain/unlock-parachain-5.webp)
121+
122+
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.
123+
124+
![](/images/develop/parachains/maintenance/unlock-parachain/unlock-parachain-6.webp)
208 KB
Loading
165 KB
Loading
113 KB
Loading
213 KB
Loading
554 KB
Loading
198 KB
Loading

0 commit comments

Comments
 (0)