Skip to content

Instantly share code, notes, and snippets.

Last active February 1, 2022 01:48
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eriknylund/a58d7587f785881eee0aea10bba60546 to your computer and use it in GitHub Desktop.
Save eriknylund/a58d7587f785881eee0aea10bba60546 to your computer and use it in GitHub Desktop.
Bitcoin Core v22.0 reproducible build with Guix

Overview for creating Guix signatures


Bitcoin Core v22.0 Guix build on a Digital Ocean $160/mo VPS

  • Debian 9 x64 Memory-Optimized
  • 4 CPUs / 32 GB Memory / 100 GB Disk / FRA1
  • More than 50 GB disk space is required or you'll get a Performing a Bitcoin Core Guix build for the selected HOSTS requires 44 GiB, however, only 41 GiB is available. Please free up some disk space before performing the build.
  • Estimated cost to perform a build: ~$2

Install base packages required for consecutive steps

apt update && apt upgrade -y
apt update && apt install -y xz-utils git make curl screen

Setup user account

adduser erik sudo
mkdir -p /home/erik/.ssh
cp .ssh/authorized_keys /home/erik/.ssh
chown erik:erik /home/erik/.ssh/authorized_keys
su erik

Install guix

chmod +x
sudo ./
guix install glibc-utf8-locales
export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
# Apply fix for exception 
# guix environment: error: cannot create container: unprivileged user cannot create user namespaces
# guix environment: error: please set /proc/sys/kernel/unprivileged_userns_clone to "1"
sudo su -
echo 1 > /proc/sys/kernel/unprivileged_userns_clone

Clone repos

git clone
git clone
git clone

Set build variables and download macOS SDK

export VERSION=22.0
export GUIX_SIGS_REPO="$PWD/guix.sigs"
export DETACHED_SIGS_REPO="$PWD/bitcoin-detached-sigs"
export ADDITIONAL_GUIX_COMMON_FLAGS='--max-jobs=4'
export HOSTS='x86_64-apple-darwin18'

mkdir SDKs
tar -C $PWD/SDKs -xaf Xcode-12.1-12A7403-extracted-SDK-with-libcxx-headers.tar.gz 


# Run in screen so we can detach and come back in two hours 
# and don't have to worry about losing connectivity
pushd bitcoin
git fetch 
git checkout "v${VERSION}"
# Expect the first time Guix setup to last for 1-2 hours to compile all dependencies 
# and then build the bitcoin binaries
# Sign binary

# Exit screen with CTRL + a + d
# Come back at any time and resume with screen -D -r


Verify binaries

# Downloading binary to compare hash against
curl -O

shasum -a 256 bitcoin-22.0-osx-signed.dmg bitcoin/guix-build-22.0/output/x86_64-apple-darwin18-codesigned/bitcoin-22.0-osx-signed.dmg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment