# How to use staking-deposit-cli to generate SignedBLSToExecutionChange
[TOC]
## Introduction
To enable your beacon chain validator(s) to automatically withdraw balances to your **execution layer (Eth1) address**, you can use the `staking-deposit-cli` tool to generate the `SignedBLSToExecutionChange` message JSON file. This message includes the request to change your old BLS withdrawal credentials to the new withdrawal credentials in execution address format .
To make this message to be included in Mainnet, you will need to upload this message to a beacon node's `SignedBLSToExecutionChange` pool **after** Capella/Shanghai hard fork.
To learn more about withdrawals, see [Withdrawals FAQ](https://notes.ethereum.org/@launchpad/withdrawals-faq).
## Installation
### Option 1: binary files
- You can find the binary files in [PR description](https://github.com/ethereum/staking-deposit-cli/pull/313).
### Option 2: source code + virtualenv
Download `bls-to-execution-change` branch:
```sh
git clone -b bls-to-execution-change
[email protected]:ethereum/staking-deposit-cli.git
```
Install and set virtualenv:
```sh
pip3 install virtualenv
virtualenv venv
source venv/bin/activate
```
Install dependencies:
```sh
python3 setup.py install
pip3 install -r requirements.txt
```
## Generate `bls_to_execution_changes-*.json` file
:::info
Assume you have generated deposit in [EIP-2334](https://eips.ethereum.org/EIPS/eip-2334#eth2-specific-parameters) format and have BLS withdrawal credentials. If not, you can generate it by following [docs](https://github.com/ethereum/staking-deposit-cli#step-2-create-keys-and-deposit_data-json-2).
:::
### Execute with params
:::success
You can find [docs of full arguments here](https://github.com/ethereum/staking-deposit-cli/blob/bls-to-execution-change/README.md#generate-bls-to-execution-change-arguments).
:::
#### Option 1: binary files
##### Interactive mode
```
./deposit ./staking_deposit/deposit.py generate-bls-to-execution-change
```
##### Command line with flags
```sh
./deposit ./staking_deposit/deposit.py --language=english generate-bls-to-execution-change \
--chain=mainnet \
--mnemonic="<YOUR MNEMONIC>" \
--bls_withdrawal_credentials_list="<YOUR OLD BLS WITHDRAWAL>" \
--validator_start_index=<THE KEY START INDEX IN EIP-2334> \
--validator_indices="<YOUR VALIDATOR INDEICES>" \
--execution_address="<THE EXECUTION ADDRESS FOR WITHDRAWALS>"
```
[Example]
```sh
./deposit --language=english generate-bls-to-execution-change \
--chain=mainnet \
--mnemonic="sister protect peanut hill ready work profit fit wish want small inflict flip member tail between sick setup bright duck morning sell paper worry" \
--bls_withdrawal_credentials_list="0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de,0x00a75d83f169fa6923f3dd78386d9608fab710d8f7fcf71ba9985893675d5382" \
--validator_start_index=0 \
--validator_indices="1,2" \
--execution_address='0x3434343434343434343434343434343434343434'
```
#### Option 2: source code + virtualenv
##### Interactive mode
```
python ./staking_deposit/deposit.py generate-bls-to-execution-change
```
##### Command line with flags
```sh
python ./staking_deposit/deposit.py --language=english generate-bls-to-execution-change \
--chain=mainnet \
--mnemonic="<YOUR MNEMONIC>" \
--bls_withdrawal_credentials_list="<YOUR OLD BLS WITHDRAWAL>" \
--validator_start_index=<THE KEY START INDEX IN EIP-2334> \
--validator_indices="<YOUR VALIDATOR INDICES>" \
--execution_address="<THE EXECUTION ADDRESS FOR WITHDRAWALS>"
```
[Example]
```sh
python ./staking_deposit/deposit.py --language=english generate-bls-to-execution-change \
--chain=mainnet \
--mnemonic="sister protect peanut hill ready work profit fit wish want small inflict flip member tail between sick setup bright duck morning sell paper worry" \
--bls_withdrawal_credentials_list="0x00bd0b5a34de5fb17df08410b5e615dda87caf4fb72d0aac91ce5e52fc6aa8de,0x00a75d83f169fa6923f3dd78386d9608fab710d8f7fcf71ba9985893675d5382" \
--validator_start_index=0 \
--validator_indices="15566,15567" \
--execution_address='0x3434343434343434343434343434343434343434'
```
:::info
For devnet, you can add a param:
```sh
--devnet_chain_setting='{"network_name": "<NETWORK_NAME>", "genesis_fork_version": "<GENESIS_FORK_VERSION>", "genesis_validator_root": "<GENESIS_VALIDATOR_ROOT>"}'
```
[Example: `withdrawal-mainnet-shadowfork-1`]
```sh
--devnet_chain_setting='{"network_name": "withdrawal-msf-1", "genesis_fork_version": "0x10000043", "genesis_validator_root": "0xe9ec351d158fd3b89b6afd2e6033bcae8d8adc2dd4c560c4bbf852d47ed0410e"}'
```
:::
## Expected outputs
```
**[Warning] you are setting an Eth1 address as your withdrawal address. Please ensure that you have control over this address.**
**[Warning] Using devnet chain setting to generate the SignedBLSToExecutionChange.**
Verifying your BLSToExecutionChange file: [####################################] N/N
Success!
Your SignedBLSToExecutionChange JSON file can be found at: /.../staking-deposit-cli/bls_to_execution_changes
Press any key.
```
You can find the `bls_to_execution_changes-*.json` file in the `./bls_to_execution_changes` folder by default.
## Upload to Beacon Node BLSToExecutionChange pool
```
curl -X POST -H “Content-Type: application/json” -d @<@FILENAME DESTINATION> \
http://<BEACON_NODE_HTTP_API_URL>/eth/v1/beacon/pool/bls_to_execution_changes
```