{"id":13572159,"url":"https://github.com/nodetec/bitcoin-full-node","last_synced_at":"2025-04-04T09:31:51.706Z","repository":{"id":39629730,"uuid":"458927570","full_name":"nodetec/bitcoin-full-node","owner":"nodetec","description":"₿ Tutorial for Setting up and Interacting with a Bitcoin FullNode","archived":false,"fork":false,"pushed_at":"2022-12-10T02:48:10.000Z","size":33,"stargazers_count":28,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-05T05:33:56.357Z","etag":null,"topics":["bitcoin","bitcoin-core","bitcoin-node","linux","raspberry-pi"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nodetec.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-13T20:48:06.000Z","updated_at":"2024-08-12T20:20:35.000Z","dependencies_parsed_at":"2023-01-26T02:16:22.514Z","dependency_job_id":null,"html_url":"https://github.com/nodetec/bitcoin-full-node","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodetec%2Fbitcoin-full-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodetec%2Fbitcoin-full-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodetec%2Fbitcoin-full-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nodetec%2Fbitcoin-full-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nodetec","download_url":"https://codeload.github.com/nodetec/bitcoin-full-node/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247153552,"owners_count":20892689,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bitcoin","bitcoin-core","bitcoin-node","linux","raspberry-pi"],"created_at":"2024-08-01T14:01:15.187Z","updated_at":"2025-04-04T09:31:46.693Z","avatar_url":"https://github.com/nodetec.png","language":null,"readme":"# Bitcoin Full Node Setup\n\nYou will need:\n\n- Raspberry Pi 4 (4GB Memory, at least 32GB micro SD storage)\n- Official Rpi Power brick\n- Ethernet cord (optional but recommended)\n- Minimum 1TB external drive (for storing the blockchain)\n- Non metered internet connection\n\n[Link parts needed](https://www.amazon.com/hz/wishlist/ls/1FSSY7WAANYXG?ref_=wl_share)\n\n## OS\n\nWe need an OS, and the best one that I could think of is the official OS developed by the people who make the Raspberry Pi.\n\n[Raspberry Pi OS Docs](https://www.raspberrypi.com/documentation/computers/getting-started.html) \n[Raspberry Pi Imager](https://www.raspberrypi.com/software/) is the recommended way to install Raspberry Pi OS. \n\n```\nsudo apt install rpi-imager\n```\n\nI recommend installing the `Raspberry Pi OS (64-bit)` for now you can find that in the *other* section.\n\nWhen installing you will also have the option to configure a few settings when clicking the gear in the bottom right.\n\nI recommend at least checking the box to automatically enable ssh.\n\nMake sure you have your SD card inserted into the computer, and when you're ready click the write button and wait for the OS to install.\n\n## Interacting with the Pi\n\nYou can use the Pi same as any other computer, so if you want to just plugin a mouse, keyboard and monitor that's an option. If you do things this way you will have access to graphical various tools.\n\nAnother option is to ssh into the Pi from another computer. Which is what I will be doing and this tutorial will assume you are doing everything via SSH. You can obviously still easily follow along with your graphical interface by just opening up a terminal.\n\n## SSH into rpi\n\n**prereqs**\n\n- inetutils\n- nmap\n\nFrom your host computer:\n\n```sh\n$ hostname -i\n192.168.1.102\n```\n\nNow use `nmap` to ping and scan your whole subnet range\n\n*NOTE* (I'm just showing the rpi address you'll likely see many other devices returned)\n\n*NOTE* (make sure to run this with sudo to see the associated name)\n\n```sh\n$sudo nmap -sn 192.168.1.0/24\nMAC Address: E4:5F:01:5E:25:72 (Raspberry Pi Trading)\nNmap scan report for 192.168.1.57\nHost is up (0.00016s latency).\n```\n\nNow you can ssh into your rpi\n\n*NOTE* (make sure to change `pi` to whatever your username is)\n\n```sh\nssh pi@192.168.1.57\n```\n\n## Format external Drive\n\nTo find the drive enter the following:\n\n```sh\nsudo fdisk -l\n```\n\nYou should see something like:\n\n```\nDevice     Start        End    Sectors  Size Type\n/dev/sda1   2048 3907028991 3907026944  1.8T Linux filesystem\n```\n\nYou will know it's the right drive because the Size should be much larger than the micro SD card. Also take note of `/dev/sda1/` this tells us that we will be targeting `/dev/sda` when we go to format that drive.\n\nWe can now begin formatting the drive using `fdisk`:\n\n```\nsudo fdisk /dev/sda\n```\n\nYou can press `m` to get help understanding the different operations available.\n\nWe will do the following:\n\n- `g`: create a new empty GPT partition table\n\n- `n`: add a new partition (press `Enter` to proceed with using the whole drive)\n\n- `y`: confirm and remove signature (NOTE this may not be necessary if there is no signature to remove)\n\n- `w`: write table to disk and exit\n\nRunning `sudo fdisk -l` will show your new partition\n\nNow we can build our file system with:\n\n```\nsudo mkfs.exfat /dev/sda1\n```\n\n## Mounting USB External Drive\n\nWe will now need to mount the drive and also make sure it automatically mounts when we reboot. We'll also change the permissions to allow the user read, write and execute access.\n\n**NOTE** change `pi` to your username\n\n\n```\nsudo mkdir /mnt/bitcoin\n\nsudo chown -R pi:pi /mnt/bitcoin # change pi to your username\n\nsudo chmod -R 775 /mnt/bitcoin\n\nsudo mount /dev/sda1 /mnt/bitcoin\n```\n\nSet all future permissions for the mount point to pi user and group:\n\n```\nsudo setfacl -Rdm g:pi:rwx /mnt/bitcoin\nsudo setfacl -Rm g:pi:rwx /mnt/bitcoin\n```\n**NOTE:** the above may fail, just move on with the installation since this may not be necessary anyway\n\nWe don't want to have to mount our drive every time we reboot so we'll be adding an entry to the `fstab` file so our OS knows to mount the drive on boot.\n\nFirst get the UUID id:\n\n```\nsudo blkid | grep sda1\n```\n\n**NOTE** if you have other drives installed this may be sdb1 or sbc1 etc..\n\nYou should see an output that looks like:\n\n```\n/dev/sda1: UUID=\"XXXX-XXXX\" BLOCK_SIZE=\"512\" TYPE=\"exfat\" PTTYPE=\"dos\" PARTUUID=\"XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\"\n```\n\nWe are only interested in the line that starts with `/dev/sda1`\n\nWe can add that line to the `fstab` by opening the `fstab` file with `vim` or `nano` and adding the following line to the bottom, make sure to change the UUID to the one generated by the `blkid` command from earlier\n\n```\nvim /etc/fstab\n```\n\n```\nUUID=XXXX-XXXX  /mnt/bitcoin exfat   nofail,uid=pi,gid=pi   0   0\n```\n\nAfter you reboot your node the drive should be mounted to `/mnt/bitcoin`\n\n## Install Bitcoin Core\n\nTODO: explain what bitcoin core is\n\n### Clone the repository:\n\n```\ngit clone https://github.com/bitcoin/bitcoin.git \n```\n\nTODO: checkout stable version\n\n### Install Berkeley DB\n\nFor backwards compatibility we will need to install and older version of Berkeley DB. Fortunately there is a script provided in the contrib folder, which we can use to install this version of BDB.\n\n```\n./contrib/install_db4.sh\n```\n\n### Install Dependencies\n\nAll of the dependencies can be found in the `build-unix.md` file located in the `docs` folder, for more information make sure to read that.\n\n- Build requirements:\n\n```\nsudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils\n\nsudo apt install libevent-dev libboost-dev libboost-test-dev\n```\n\n- Install SQLite for descriptor wallet\n\n```\nsudo apt install libsqlite3-dev\n```\n\n- Optional port mapping libraries:\n\n```\nsudo apt install libminiupnpc-dev libnatpmp-dev\n```\n\n- ZMQ dependencies, used to get events out of the daemon (useful for things like block explorers):\n\n```\nsudo apt-get install libzmq3-dev\n```\n\n- User-Space, Statically Defined Tracing (USDT) dependencies:\n\n```\nsudo apt install systemtap-sdt-dev\n```\n\n- GUI dependencies (if you installed your RpiOS with a Desktop):\n\n**NOTE** To build without GUI pass `--without-gui`\n\n```\nsudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools\n```\n\n- For QR Code Support:\n\n```\nsudo apt-get install libqrencode-dev\n```\n\n### Generate Build Scripts\n\nNow we should be able to generate the build scripts, if you missed any dependencies you should be able to catch them here:\n\n```\n./autogen.sh\n```\n\nConfigure:\n\n**NOTE** The extra arguments are needed since we are using Berkeley DB.\n\n```\nexport BDB_PREFIX='/home/pi/Repos/bitcoin/db4'\n\n./configure BDB_LIBS=\"-L${BDB_PREFIX}/lib -ldb_cxx-4.8\" BDB_CFLAGS=\"-I${BDB_PREFIX}/include\"\n```\n\n### Compile \u0026 Install\n\n- Compile (This could take about an hour): \n\n```\nmake\n```\n\n- Install\n\n```\nsudo make install\n```\n\nThis will place the binaries in `/usr/local/bin`\n\n```\n/usr/local/bin/bitcoind\n\n/usr/local/bin/bitcoin-cli\n```\n\n## Start and Run your Bitcoin Core Node\n\nTODO: talk about bitcoin core vs node\n\n### Configuration\n\n- Let's create a config file for bitcoind\n\n```\ntouch ~/.bitcoin/bitcoin.conf\n```\n\n- Add the following to your config\n\n```\nrpcuser=pi\nrpcpassword=CHANGE_THIS\nmaxconnections=15\ndatadir=/mnt/bitcoin\ntxindex=1\n```\n\nTODO: Explain these options\n\n- To find more config options checkout:\n\n```\nbitcoind --help\n```\n\n### Tor (Optional)\n\n### Running bitcoind\n\n```\nbitcoind -conf=/home/pi/.bitcoin/bitcoin.conf -daemon\n```\n\n### Stopping bitcoind\n\n```\nbitcoin-cli stop\n```\n\nThis will start your bitcoin node and begin downloading the entire blockchain into the `/mnt/bitcoin` directory\n\n## References\n\n- [Raspberry Pi Guide](https://www.htpcguides.com/properly-mount-usb-storage-raspberry-pi/) \n\n- [Mastering Bitcoin]() \n\nTODO: check out tor setup\n- [Tor setup](https://8bitcoin.medium.com/how-to-run-a-bitcoin-full-node-over-tor-on-an-ubuntu-linux-virtual-machine-bdd7e9415a70) \n\n","funding_links":[],"categories":["Others"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodetec%2Fbitcoin-full-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodetec%2Fbitcoin-full-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodetec%2Fbitcoin-full-node/lists"}