Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Optional: Manual creation of wallets and config files

Not needed if you used the option for automatic deployment with Docker.

In the Installation page we used the provided quickstart script to create Bitcoin wallets and generate keys and configuration files for all validators and users. This page provides an alternative, manual way to generate them.

You do not need to run any of this if you have used the quickstart script, or if you used the default Docker deployment via the bitcoin-ipc container. You can use this page if you want to manually create new validators and users. If deploying via the bitcoin-ipc container, you must run all following commands inside the bitcoin-ipc container.

Step 1: Set up Bitcoin wallets for validators and clients

Throughout the demo we will use six validators (four in the initial subnet and two to demonstrate the dynamic participation) and two clients. In this step we create the necessary bitcoin wallets for them.

In order for each validator to stake, they need to have a bitcoin wallet with enough funds in it. We'll create and fund a bitcoin wallet for each validator.

# create the wallets
bitcoin-cli loadwallet "default"
bitcoin-cli createwallet "validator1"
bitcoin-cli createwallet "validator2"
bitcoin-cli createwallet "validator3"
bitcoin-cli createwallet "validator4"
bitcoin-cli createwallet "validator5"
bitcoin-cli createwallet "user1"
bitcoin-cli createwallet "user2"

# fund the wallets
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=default getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=validator1 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=validator2 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=validator3 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=validator4 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=validator5 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=user1 getnewaddress)"
bitcoin-cli generatetoaddress 2 "$(bitcoin-cli --rpcwallet=user2 getnewaddress)"
bitcoin-cli generatetoaddress 100 "$(bitcoin-cli --rpcwallet=default getnewaddress)"

# check balances
bitcoin-cli --rpcwallet=validator1 getbalance
bitcoin-cli --rpcwallet=validator2 getbalance
bitcoin-cli --rpcwallet=validator3 getbalance
bitcoin-cli --rpcwallet=validator4 getbalance
bitcoin-cli --rpcwallet=validator5 getbalance
bitcoin-cli --rpcwallet=user1 getbalance
bitcoin-cli --rpcwallet=user2 getbalance

All wallets should have at least 100 BTC.

After restarting

If in the future you restart bitcoind, you only have to load each wallet:

Step 2: Create IPC wallets for each validator

Now each validator has personal funds on Bitcoin. We will set up an IPC wallet for each validator and each user, that is, eight IPC wallets. This wallet will be used to interact with the child subnet and, for validators, to sign multisig transactions.

List and record the newly created wallets addresses and corresponding x-only public keys:

Pick four validators that you want to use in the initial subnet and

  • Write down their IPC addresses, or set the env variables ${IPC_ADDRESS_OF_VALIDATOR_1} , ..., ${IPC_ADDRESS_OF_VALIDATOR_4} . The IPC address is printed as Address: by ipc-cli and starts with 0x .

  • Construct and write down the validator-whitelist (to be used in the next step) as a comma-separated list using the the x-only public keys of these four validators return by ipc-cli (printed as XonlyPubKey:). This should look like the following. Observe that there are no empty spaces between the keys.

Let's export the secret keys of all validators:

Step 3: Create .env file for each validator and user

The .env file of each validator is used by the bitcoin monitor and bitcoin provider.

Create .env for validators

Navigate to bitcoin-ipc directory and run the following commands:

In each .env file modify the values

  • RPC_USER and RPC_PASS : Update them if you changed the default values in the bitcoin.conf file (in )

  • WALLET_NAME : Use the bitcoin wallet names created on the previous step ("validator1", ... "validator5")

  • DATABASE_URL : You can use <HOME_DIR>/.ipc/validator1/regtest_db , ... , <HOME_DIR>/.ipc/validator5/regtest_db

  • PROVIDER_PORT : Use ports 3030, 3031, 3032, 3033, 3034, respectively.

  • PROVIDER_AUTH_TOKEN : You can use validator1_auth_token , ... , validator5_auth_token

  • VALIDATOR_SK_PATH : Use <HOME_DIR>/.ipc/validator1/validator.sk , ..., <HOME_DIR>/.ipc/validator5/validator.sk

  • replace <HOME_DIR> with your absolute home directory path.

Let's see the ~/.ipc/validator1/.env file as an example:

Create .env for users

Let's do the same for the users.

Edit the two new .env files as follows:

  • RPC_USER and RPC_PASS : Update them if you changed the default values in the bitcoin.conf file (in )

  • WALLET_NAME : Use user1 and user2 , respectively.

  • DATABASE_URL : You can use <HOME_DIR>/.ipc/user1/regtest_db and <HOME_DIR>/.ipc/user2/regtest_db , respectively

  • PROVIDER_PORT : Use 3040, 3041, respectively

  • PROVIDER_AUTH_TOKEN : You can use user1_auth_token and user2_auth_token , respectively

  • VALIDATOR_SK_PATH : It is irrelevant, it is only used by validators

  • replace <HOME_DIR> with your absolute home directory path.

Let's see the ~/.ipc/validator1/.env file as an example:

Step 5: Initialise the config file for each validator and user

The config.toml of each validator file is used by Fendermint and by ipc-cli.

Navigate to the ipc repo and run the following.

For each validator's and user's config file, modify:

  • provider_http to match the port you set in PROVIDER_PORT in the .env file of the validator, that is, using ports 3030, 3031, 3032, 3033, 3034 for the validators and 3040, 3041 for the user.

  • auth_token to match the PARENT_AUTH_TOKEN you've set in the .env file of the validator, that is use validator1_auth_token , ... , validator5_auth_token for validators and user1_auth_token , ... , user2_auth_token for users.

Let's see ~/.ipc/validator1/config.toml for example. It should look similar to the following.

Last updated