# Jail/Unjail

### **Introduction**[​](https://docs.multiversx.com/validators/staking/unjailing#introduction) <a href="#introduction" id="introduction"></a>

In the unfortunate event of losing too much **rating score**, a validator will be **jailed**. This means they will be removed from the Sovereign Shard, will not participate in consensus, and consequently, will not earn any rewards. Currently, a node will be jailed if its rating falls to `10` or below. Learn more on the Rating page.

### How to Unjail a Validator

Unjailing a validator is a straightforward process that involves submitting a transaction to the Staking Smart Contract. This transaction, known as an **unjailing transaction**, is essentially a fine payment that facilitates the return of your jailed validator to the network. Upon successful execution, the validator is reinstated in the following epoch, starting anew with a rating of `50`.

#### Requirements for Unjailing Transactions

* **Proper Encoding:** The transaction must include all necessary information, correctly encoded.
* **Sufficient Gas Limit:** Ensure the gas limit is high enough to carry out the transaction without issues.
* **BLS Public Keys:** Examples may showcase BLS public keys. **Important:** These keys are randomly generated for demonstrative purposes only and do not correspond to actual nodes. Avoid using them in your real staking transactions.

#### Steps to Unjail Your Validator

1. **Through the Online Wallet:** Navigate to OneFinity Wallet where you can easily submit your unjailing transaction.
2. **Using Command-Line Tools:** Alternatively, tools like `ofpy` allow for command-line submission of unjailing transactions.

Remember, choosing to unjail your validator is an opportunity to reintegrate into the network and contribute once again as a fresh participant.

The following pages will describe both approaches in each specific case.

## **Prerequisites**[​](https://docs.multiversx.com/validators/staking/unjailing#prerequisites) <a href="#prerequisites" id="prerequisites"></a>

In order to submit an unjailing transaction, you require the following:

* A wallet with at least 300 ONE (the cost of unjailing a *single validator*). If you want to unjail multiple validators at once, you need to multiply that minimum amount with the number of validators. For example, unjailing 3 validators at once will require 900 ONE. Make sure you have enough in your wallet.
* The **BLS public keys** of the validators you want to unjail. You absolutely **do not require the secret key** of the validators. The BLS public keys of the validators are found in the `validatorKey.pem` files. Please read [Validator Keys](https://docs.multiversx.com/validators/key-management/validator-keys) to find out how to extract the public key only. Remember that the BLS public key consists of exactly 192 hexadecimal characters (that is, `0` to `9` and `a` to `f` only).

## Unjailing Nodes Through the Wallet

To unjail nodes, carefully follow the steps outlined below, ensuring that you replace the placeholders with your actual data.

1. **Open the Wallet**: Navigate to [Onefinity Wallet](https://wallet.onefinity.com).
2. **Fee Limit Section**: Expand this section in the form to reveal the "Gas limit" field. The value for "Gas limit" is calculated based on how many nodes you intend to unjail. Use the following formula: `6000000 * [Number of Nodes]`. Examples:

   * For 1 node: `6000000`
   * For 2 nodes: `12000000`
   * For 3 nodes: `18000000`

   This action also enables the "Fee limit" field to auto-calculate the transaction cost.
3. **Amount Field**: Determine the amount of ONE needed by multiplying `[Number of Nodes]` by `300 ONE`. Examples:
   * For 1 node: `300 ONE`
   * For 2 nodes: `600 ONE`
   * For 3 nodes: `900 ONE`
4. **To Field**: Insert the Staking SmartContract address responsible for unjailing.
5. **Send**: Hit the "Send" button once all fields are correctly filled.

Ensure you understand each information piece and adjust accordingly with your specific details.

## **Data field**[​](https://docs.multiversx.com/validators/staking/unjailing#the-data-field) <a href="#the-data-field" id="the-data-field"></a>

When entering information into the "Data" field, it's imperative that you follow the specific format outlined below. The information you input must be precisely structured, as the Staking Smart Contract utilizes this data to identify which nodes you intend to unjail. You have the flexibility to unjail multiple nodes simultaneously.

#### **Unjailing a single node**[​](https://docs.multiversx.com/validators/staking/unjailing#unjailing-a-single-node) <a href="#unjailing-a-single-node" id="unjailing-a-single-node"></a>

If you want to unjail a single node, the format of the "Data" field is simple:

```
unJail@<BLS1>
```

To correctly populate the "Data" field, do not directly copy and paste the template provided. Instead, you must substitute `<BLS1>` with the actual **BLS public key** from the node you wish to stake with. Locate this key within the `validatorKey.pem` file associated with the desired node. This step ensures accurate and secure staking configurations.

For an unjailing transaction of a single node, the "Data" field appears thus: Do not remove the `@` symbol, which separates information within "Data". Replace `<BLS1>`, removing the angle:

`unJail@b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27`

![img](https://gblobscdn.gitbook.com/assets%2F-LhHlNldCYgbyqXEGXUS%2F-MA1YB7F53LJCTlFj8qn%2F-MA1_N1up06vncGVTyfp%2Funjailing-single-node.png?alt=media\&token=fe0ca638-6433-4c07-b7ac-ef3fcf199835)

## **Unjailing multiple nodes at once**[​](https://docs.multiversx.com/validators/staking/unjailing#unjailing-multiple-nodes-at-once) <a href="#unjailing-multiple-nodes-at-once" id="unjailing-multiple-nodes-at-once"></a>

Unjailing multiple nodes simultaneously follows a similar process to unjailing a single node. Simply concatenate the BLS public keys of each additional node you want to unjail, using `@` as a separator, in the "Data" field. Ensure you're familiar with the process for unjailing a single node by reviewing "Unjailing a single node" section beforehand. Remember to adjust the "Amount" and "Gas Limit" fields based on the total number of nodes you're unjailing.

For a *single* node:

```
unJail@<BLS1>
```

For *two* nodes:

```
unJail@<BLS1>@<BLS2>
```

And for *three* nodes:

```
unJail@<BLS1>@<BLS2>@<BLS3>
```

To augment the existing format with additional nodes, incorporate the specific **BLS public keys** of your nodes by substituting `@<BLS…>` with the relevant keys. You can locate these public keys in the `validatorKey.pem` files for each node. It's crucial to ensure that you're only using the **BLS public keys** and not exposing any BLS secret keys. For guidance on reading and understanding the contents of `validatorKey.pem` files, please refer to the Validator Keys documentation.

For example, the "Data" field for an unjailing transaction for two nodes looks like this:

`unJail@b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27@f921a0f76ed70e8a806c6f9119f87b12700f96f732e6070b675e0aec10cb0723803202a4c40194847c38195db07b1001f6d50c81a82b949e438cd6dd945c2eb99b32c79465aefb9144c8668af67e2d01f71b81842d9b94e4543a12616cb5897d`

![img](https://gblobscdn.gitbook.com/assets%2F-LhHlNldCYgbyqXEGXUS%2F-MA1mbsWLwDtxs1LX3w-%2F-MA1nGcSQTZqmnGoxtRA%2Funjailing-two-nodes.png?alt=media\&token=991f11c8-fe7c-46f5-93fb-566ab0590279)

#### &#x20;<a href="#the-general-format" id="the-general-format"></a>

## **Unjailing through ofpy**[​](https://docs.multiversx.com/validators/staking/unjailing#unjailing-through-mxpy) <a href="#unjailing-through-mxpy" id="unjailing-through-mxpy"></a>

Ensure you have the latest version of `ofpy` installed before proceeding. If you haven't installed `ofpy`, please follow these instructions (LINK TO INSTRUCTIONS). By utilizing `ofpy` for submitting the unjailing transaction, you eliminate the need to manually craft the "Data" section. `ofpy` allows for the automatic construction and direct submission of the transaction to the network in a single, streamlined command.

### **Your Wallet PEM file**[​](https://docs.multiversx.com/validators/staking/unjailing#your-wallet-pem-file) <a href="#your-wallet-pem-file" id="your-wallet-pem-file"></a>

To send transactions on your behalf *without* using the online OneFinity Wallet, `ofpy` must be able to sign for you. For this reason, you have to generate a PEM file using your Wallet mnemonic.

Please follow the guide [Deriving the Wallet PEM file](https://docs.multiversx.com/sdk-and-tools/sdk-py/deriving-the-wallet-pem-file) CHECK LINK!. Make sure you know exactly where the PEM file was generated, because you'll need to reference its path in the `ofpy` commands.

After the PEM file was generated, you can issue transactions from `ofpypy`directly.

## **The unjailing transaction**[​](https://docs.multiversx.com/validators/staking/unjailing#the-unjailing-transaction) <a href="#the-unjailing-transaction" id="the-unjailing-transaction"></a>

The following commands assume that the PEM file for your Wallet was saved with the name `walletKey.pem` in the current folder, where you are issuing the commands from.

The command to submit an unjailing transaction with `ofpy` is this:

```
ofpy --verbose validator unjail --pem=walletKey.pem --value="<unjail-value>" --nodes-public-keys="<BLS1>,<BLS2>,...,<BLS99>" --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce
```

Notice that we are using the `walletKey.pem` file. Moreover, before executing this command, you need to replace the following:

* Replace `<unjail-value>` with the amount of EGLD required for unjailing your validators. You need to calculate this value with respect to the number of nodes you are unjailing. See the [beginning of the Unjailing through the Wallet](https://docs.multiversx.com/validators/staking/unjailing#unjailing-through-the-wallet) section for info on how to do it.
* Replace all the `<BLS…>` with the actual **BLS public keys** of your nodes, which you can find inside their individual `validatorKey.pem` files. Make sure you **do not write the BLS secret keys**! Read the page [Validator Keys](https://docs.multiversx.com/validators/key-management/validator-keys) to see how to interpret the `validatorKey.pem` files.

Additionally, it's important to note that "Gas Limit" calculations are not provided by default. However, by using the `--estimate-gas` option with `mxpy`, the gas limit can be automatically estimated for you.

Here's an example for an unjailing command for one validator:

```
ofpy --verbose validator unjail --pem=walletKey.pem --value="2500000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27" --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce
```

{% hint style="warning" %}
IMPORTANT

You must take **denomination** into account when specifying the `value` parameter in **ofpy**.
{% endhint %}

For two validators, the command becomes this one:

```
ofpy --verbose validator unjail --pem=walletKey.pem --value="5000000000000000000000" --nodes-public-keys="b617d8bc442bda59510f77e04a1680e8b2d3293c8c4083d94260db96a4d732deaaf9855fa0cef2273f5a67b4f442c725efc06a5d366b9f15a66da9eb8208a09c9ab4066b6b3d38c3cf1ea7fab6489a90713b3b56d87de68c6558c80d7533bf27,f921a0f76ed70e8a806c6f9119f87b12700f96f732e6070b675e0aec10cb0723803202a4c40194847c38195db07b1001f6d50c81a82b949e438cd6dd945c2eb99b32c79465aefb9144c8668af67e2d01f71b81842d9b94e4543a12616cb5897d" --proxy=https://gateway.multiversx.com --estimate-gas --recall-nonce
```

Notice that the two BLS public keys are separated by a comma, with no extra space between them.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.onefinity.network/technology/run-a-onefinity-node/jail-unjail.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
