Skip to main content

Debian example

You can follow these steps that can be copy-pasted directly into a fresh Debian 11.

This example uses an altered two-step version of the full simplified workflow.

apt update && apt install lsb-release sudo postgresql curl wget gpg # debian:11 is surprisingly light

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-sdk

sudo rm /etc/apt/sources.list.d/mina*.list
sudo echo "deb [trusted=yes] http://packages.o1test.net $(lsb_release -cs) unstable" | sudo tee /etc/apt/sources.list.d/mina.list
sudo apt-get update && sudo apt-get install --allow-downgrades -y mina-archive-migration=3.0.0-rc1-4277e73

mkdir -p mina-migration-workdir
cd mina-migration-workdir

gsutil cp gs://mina_network_block_data/devnet-bundle-3NKRsRWBzmPR8Z8ZmJb4u8FLpnSkjRitUpKZzVkHp11QuwP5i839.tar.gz .
tar -xf devnet-bundle-3NKRsRWBzmPR8Z8ZmJb4u8FLpnSkjRitUpKZzVkHp11QuwP5i839.tar.gz

wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/create_schema.sql
wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/zkapp_tables.sql

# this next step is required only if you don't have an archive yet
createdb devnet_balances_migrated
createdb devnet_really_migrated

psql -d devnet_really_migrated -f create_schema.sql

gsutil cp gs://mina-archive-dumps/devnet-archive-dump-2024-03-22_0000.sql.tar.gz .
tar -xf devnet-archive-dump-2024-03-22_0000.sql.tar.gz
# the next step ensures you don't accidentally merge mainnet and devnet data
sed -i -e s/archive_balances_migrated/devnet_balances_migrated/g devnet-archive-dump-2024-03-22_0000.sql
psql -d devnet_balances_migrated -f devnet-archive-dump-2024-03-22_0000.sql

mina-berkeley-migration-script initial \
--genesis-ledger /var/lib/coda/devnet.json \
--source-db postgres:///devnet_balances_migrated \
--target-db postgres:///devnet_really_migrated \
--blocks-batch-size 100 --blocks-bucket mina_network_block_data \
--network devnet

# now, do a final migration

gsutil cp gs://mina-archive-dumps/devnet-archive-dump-2024-03-22_2050.sql.tar.gz .
tar -xf devnet-archive-dump-2024-03-22_2050.sql.tar.gz
# the next step ensures you don't accidentally merge mainnet and devnet data
sed -i -e s/archive_balances_migrated/devnet_balances_migrated/g devnet-archive-dump-2024-03-22_2050.sql
psql -d devnet_balances_migrated -f devnet-archive-dump-2024-03-22_2050.sql

curl -O https://gist.githubusercontent.com/ghost-not-in-the-shell/cfe629a15702e7bae7b0c1415fe0d85e/raw/8d8bff2814c1d0c15deb70b388dea8a28a485184/genesis.json

mina-berkeley-migration-script final \
--genesis-ledger /var/lib/coda/devnet.json \
--source-db postgres:///devnet_balances_migrated \
--target-db postgres:///devnet_really_migrated \
--blocks-batch-size 100 --blocks-bucket mina_network_block_data \
--network devnet \
--replayer-checkpoint migration-checkpoint-437195.json \
--fork-state-hash 3NKoUJX87VrfmNAoUdqoWUykVvt66ztm5rzruDQR7ihwYaWsdJKq \
--fork-config genesis.json \
--prefetch-blocks