|
| 1 | +--- |
| 2 | +title: Installing the archive migration package |
| 3 | +sidebar_label: Installing archive migration package |
| 4 | +hide_title: false |
| 5 | +description: Satisfying the archive migration prerequisites. |
| 6 | +keywords: |
| 7 | + - Berkeley |
| 8 | + - upgrade |
| 9 | + - archive migration |
| 10 | + - installing |
| 11 | + - prerequisites |
| 12 | + - mina archive node |
| 13 | + - archive node |
| 14 | +--- |
| 15 | + |
| 16 | +The archive node Berkeley migration package is sufficient for satisfying the migration from Devnet/Mainnet to Berkeley. |
| 17 | +However, it has some limitations. For example, the migration package does not migrate a non-canonical chain and it skips orphaned blocks that are not part of a canonical chain. |
| 18 | + |
| 19 | +To mitigate these limitations, the archive node maintenance package is available for use by archive node operators who want to maintain a copy of their Devnet and Mainnet databases for historical reasons. |
| 20 | + |
| 21 | +## Install with Google Cloud SDK |
| 22 | + |
| 23 | +The Google Cloud SDK installer does not always register a `google-cloud-sdk` apt package. The best way to install gsutil is using the apt repostory: |
| 24 | + |
| 25 | +```sh |
| 26 | +curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg |
| 27 | +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 |
| 28 | +sudo apt-get update && sudo apt-get install google-cloud-sdk |
| 29 | +``` |
| 30 | + |
| 31 | +## Download the o1labs Mainnet archive database |
| 32 | + |
| 33 | +We strongly encourage you to perform the migration on your own data to preserve the benefits of decentralization. However, if you want to use the archive data that o1labs runs (for example, to bootstrap a new archive from SQL without waiting all day for the chain to download and replay), you can use the following steps: |
| 34 | + |
| 35 | +1. Download the Devnet/Mainnet archive data using cURL or gsutil: |
| 36 | + |
| 37 | + - cURL: |
| 38 | + |
| 39 | + For Devnet: |
| 40 | + ```sh |
| 41 | + curl https://storage.googleapis.com/mina-archive-dumps/devnet-archive-dump-{date}_0000.sql.tar.gz |
| 42 | + ``` |
| 43 | + |
| 44 | + For Mainnet: |
| 45 | + ```sh |
| 46 | + curl https://storage.googleapis.com/mina-archive-dumps/mainnet-archive-dump-{date}_0000.sql.tar.gz |
| 47 | + ``` |
| 48 | + |
| 49 | + To filter the dumps by date, replace `{date}` using the required `yyyy-dd-mm` format. For example, for March 15, 2024, use `2024-03-15`. |
| 50 | + |
| 51 | + :warning: The majority of backups have the `0000` suffix. If a download with that name suffix is not available, try incrementing it. For example, `0001`, `0002`, and so on. |
| 52 | + |
| 53 | + - gsutil: |
| 54 | + |
| 55 | + ```sh |
| 56 | + gsutil cp gs://mina-archive-dumps/mainnet-archive-dump-2024-01-15* . |
| 57 | + ``` |
| 58 | + |
| 59 | +2. Extract the tar package. |
| 60 | + |
| 61 | + ```sh |
| 62 | + tar -xvzf {network}-archive-dump-{date}_0000.sql.tar.gz {network}-archive-dump-{date}_0000.sql |
| 63 | + ``` |
| 64 | + |
| 65 | +3. Import the Devnet/Mainnet archive dump into the Berkeley database. |
| 66 | + |
| 67 | + Run this command at the database server: |
| 68 | + |
| 69 | + ```sh |
| 70 | + psql -U {user} -f {network}-archive-dump-{date}_0000.sql |
| 71 | + ``` |
| 72 | + |
| 73 | + The database in the dump **archive_balances_migrated** is created with the Devnet/Mainnet archive schema. |
| 74 | + |
| 75 | + Note: This database does not have any Berkeley changes. |
| 76 | + |
| 77 | +## Ensure the location of Google Cloud bucket with the Devnet/Mainnet precomputed blocks |
| 78 | + |
| 79 | +The recommended method is to perform migration on your own data to preserve the benefits of decentralization. |
| 80 | + |
| 81 | +`gsutil cp gs://mina_network_block_data/{network}-*.json .` |
| 82 | + |
| 83 | +:warning: Precomputed blocks for the Mainnet network take ~800 GB of disk space. Plan for adequate time to download these blocks. The Berkeley migration app downloads them incrementally only when needed. |
| 84 | + |
| 85 | +## Validate the Devnet/Mainnet database |
| 86 | + |
| 87 | +The correct Devnet/Mainnet database state is crucial for a successful migration. |
| 88 | + |
| 89 | +[Missing blocks](/berkeley-upgrade/archive-migration/mainnet-database-maintenance#missing-blocks) is one the most frequent issues when dealing with the Devnet/Mainnet archive. Although this step is optional, it is strongly recommended that you verify the archive condition before you start the migration process. |
| 90 | + |
| 91 | +To learn how to maintain archive data, see [Devnet/Mainnet database maintenance](/berkeley-upgrade/archive-migration/mainnet-database-maintenance). |
| 92 | + |
| 93 | +## Download the migration applications |
| 94 | + |
| 95 | +Migration applications are distributed as part of the archive migration Docker and Debian packages. |
| 96 | + |
| 97 | +Choose the packages that are appropriate for your environment. |
| 98 | + |
| 99 | +### Debian packages |
| 100 | + |
| 101 | +To get the Debian packages: |
| 102 | + |
| 103 | +``` |
| 104 | +CODENAME=bullseye |
| 105 | +CHANNEL=stable |
| 106 | +VERSION=3.0.1-e848ecb |
| 107 | +
|
| 108 | +echo "deb [trusted=yes] http://packages.o1test.net $CODENAME $CHANNEL" | tee /etc/apt/sources.list.d/mina.list |
| 109 | +apt-get update |
| 110 | +apt-get install --allow-downgrades -y "mina-archive-migration=$VERSION" |
| 111 | +``` |
| 112 | + |
| 113 | +### Docker image |
| 114 | + |
| 115 | +To get the Docker image: |
| 116 | + |
| 117 | +``` |
| 118 | +docker pull gcr.io/o1labs-192920/mina-archive-migration:3.0.1-e848ecb-{codename} |
| 119 | +``` |
| 120 | + |
| 121 | +Where supported codenames are: |
| 122 | +- bullseye |
| 123 | +- focal |
| 124 | +- buster |
| 125 | + |
| 126 | + |
| 127 | +## Devnet/Mainnet genesis ledger |
| 128 | + |
| 129 | +The Mina Devnet/Mainnet genesis ledger is stored in GitHub in the `mina` repository under the `genesis_ledgers` subfolder. However, if you are already running a daemon that is connected to the Mina Mainnet or the Devnet network, you already have the genesis ledger locally. |
| 130 | + |
| 131 | +## Berkeley database schema files |
| 132 | + |
| 133 | +You can get the Berkeley schema files from different locations: |
| 134 | + |
| 135 | +- GitHub repository from the `berkeley` branch. |
| 136 | + |
| 137 | + Note: The `berkeley` branch can contain new updates regarding schema files, so always get the latest schema files instead of using an already downloaded schema. |
| 138 | + |
| 139 | +- Archive/Rosetta Docker from `berkeley` version |
| 140 | + |
| 141 | +### Example: Downloading schema sources from GitHub |
| 142 | + |
| 143 | + ```sh |
| 144 | + wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/zkapp_tables.sql |
| 145 | + |
| 146 | + wget https://raw.githubusercontent.com/MinaProtocol/mina/berkeley/src/app/archive/create_schema.sql |
| 147 | + ``` |
| 148 | + |
| 149 | +## Next steps |
| 150 | + |
| 151 | +Congratulations on completing the essential preparation and verification steps. You are now ready to perform the migration steps in [Migrating Devnet/Mainnet Archive to Berkeley Archive](/berkeley-upgrade/archive-migration/migrating-archive-database-to-berkeley). |
0 commit comments