|
| 1 | +# Using Existing Bitcoin Data |
| 2 | + |
| 3 | +There are 2 methods, either reuse existing Bitcoin blockchain data from another MyNode instance or copy it from an external hard drive. |
| 4 | + |
| 5 | +## Using Bitcoin Data from Other MyNode |
| 6 | +In some cases, you may want to use Bitcoin data from a different node to get MyNode up and running faster or to save bandwidth. If you have another node that is already synced, you can copy that data to your MyNode. |
| 7 | + |
| 8 | +### Step 1 - Start MyNode |
| 9 | + |
| 10 | +The first thing you need to do is start your MyNode and disable QuickSync. To disable QuickSync, go to the settings page and click the "Disable QuickSync" button. |
| 11 | + |
| 12 | +This will reboot your device and start syncing Bitcoin from scratch. |
| 13 | + |
| 14 | +### Step 2 - Upload your own Data |
| 15 | + |
| 16 | +Next, you need to log into your device via SSH and copy files from your existing node. |
| 17 | + |
| 18 | +On the node with the source data, ensure the bitcoin block data is readable by the "admin" user or the user you are logging in with. Also, make sure that Bitcoin is not running. Run the following commands on each device. |
| 19 | + |
| 20 | +**On source node:** |
| 21 | +<br/><sub><sup>Steps may differ if source is not MyNode device</sup></sub> |
| 22 | +```sh |
| 23 | +# Stop Bitcoin and other services |
| 24 | +sudo /usr/bin/mynode_stop_critical_services.sh |
| 25 | + |
| 26 | +# Make sure block data is readable by the admin user |
| 27 | +sudo chmod -R 755 /mnt/hdd/mynode/bitcoin/blocks |
| 28 | +sudo chmod -R 755 /mnt/hdd/mynode/bitcoin/chainstate |
| 29 | +sudo chmod -R 755 /mnt/hdd/mynode/bitcoin/indexes |
| 30 | +``` |
| 31 | + |
| 32 | +**On destination node:** |
| 33 | +```sh |
| 34 | +# Stop Bitcoin and other services |
| 35 | +sudo /usr/bin/mynode_stop_critical_services.sh |
| 36 | + |
| 37 | +# Make sure old data is removed |
| 38 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/blocks |
| 39 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/chainstate |
| 40 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/indexes |
| 41 | + |
| 42 | +# Copy the blocks and chainstate folders from your existing node to /mnt/hdd/mynode/bitcoin/ |
| 43 | +# For example (fill in with your own IP and path): |
| 44 | +sudo rsync -aP [email protected]:/mnt/hdd/mynode/bitcoin/blocks /mnt/hdd/mynode/bitcoin/ |
| 45 | +sudo rsync -aP [email protected]:/mnt/hdd/mynode/bitcoin/chainstate /mnt/hdd/mynode/bitcoin/ |
| 46 | +sudo rsync -aP [email protected]:/mnt/hdd/mynode/bitcoin/indexes /mnt/hdd/mynode/bitcoin/ |
| 47 | +sudo chown -R bitcoin:bitcoin /mnt/hdd/mynode/bitcoin/ |
| 48 | +sudo reboot |
| 49 | +``` |
| 50 | + |
| 51 | +This will copy files from your remote node to your local node. After rebooting, your device will sync from the same state as your other node. |
| 52 | + |
| 53 | + |
| 54 | +## Using Bitcoin Data from Other Hard drive |
| 55 | +In some cases, you may want to use Bitcoin data from a different hard drive to get MyNode up and running faster or to save bandwidth. If you have another hard drive that is already synced, you can copy that data to your MyNode. |
| 56 | + |
| 57 | + |
| 58 | +### Step 1 - Install & Start MyNode |
| 59 | +Start with [MyNode standard installation](https://mynodebtc.com/download) and then [Getting started guide](https://mynodebtc.github.io/intro/getting-started.html) |
| 60 | + |
| 61 | +### Step 2 - Stop The Bitcoin Syncing |
| 62 | +As soon as the Bitcoin Blockchain syncing process has started, the web interface will displays `"Bitcoin Blockchain Syncing..."`. |
| 63 | + |
| 64 | +At this point, "stop" the syncing: |
| 65 | + |
| 66 | +```sh |
| 67 | + |
| 68 | +sudo /usr/bin/mynode_stop_critical_services.sh |
| 69 | +``` |
| 70 | + |
| 71 | +## Step 3 - Remove Old Data |
| 72 | +Remove any data that the syncing process has completed before you stopped the process. |
| 73 | + |
| 74 | +```sh |
| 75 | + |
| 76 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/blocks |
| 77 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/chainstate |
| 78 | +sudo rm -rf /mnt/hdd/mynode/bitcoin/indexes |
| 79 | +``` |
| 80 | + |
| 81 | +### Step 4 - Copy Existing Blockchain |
| 82 | +1. Connect a second hard drive (which has a copy of the blockchain) to your Raspberry Pi |
| 83 | +2. SSH into your node |
| 84 | + |
| 85 | +```sh |
| 86 | + |
| 87 | +``` |
| 88 | + |
| 89 | +3. Mount the second drive to some path |
| 90 | + |
| 91 | +```sh |
| 92 | +sudo mount -t auto /dev/sda<X> /mnt/sda<X> |
| 93 | +``` |
| 94 | + |
| 95 | +4. Set access-levels... |
| 96 | + |
| 97 | +```sh |
| 98 | +sudo chmod -R 755 /mnt/sda<X>/<some-path...>/bitcoin/blocks |
| 99 | +sudo chmod -R 755 /mnt/sda<X>/<some-path...>/bitcoin/chainstate |
| 100 | +sudo chmod -R 755 /mnt/sda<X>/<some-path...>/bitcoin/indexes |
| 101 | +``` |
| 102 | + |
| 103 | +5. Copy the existing blockchain from the other drive to MyNode's drive |
| 104 | + |
| 105 | +```sh |
| 106 | +sudo cp -r /mnt/sda<X>/<some-path...>/bitcoin/blocks /mnt/hdd/mynode/bitcoin/ |
| 107 | +sudo cp -r /mnt/sda<X>/<some-path...>/bitcoin/chainstate /mnt/hdd/mynode/bitcoin/ |
| 108 | +sudo cp -r /mnt/sda<X>/<some-path...>/bitcoin/indexes /mnt/hdd/mynode/bitcoin/ |
| 109 | +``` |
| 110 | + |
| 111 | +6. Change group access... |
| 112 | + |
| 113 | +```sh |
| 114 | +sudo chown -R bitcoin:bitcoin /mnt/hdd/mynode/bitcoin/ |
| 115 | +``` |
| 116 | + |
| 117 | +7. Reboot the node |
| 118 | + |
| 119 | +```sh |
| 120 | +sudo reboot |
| 121 | +``` |
| 122 | + |
0 commit comments