Skip to content

Latest commit

 

History

History
119 lines (86 loc) · 2.73 KB

INSTALL.md

File metadata and controls

119 lines (86 loc) · 2.73 KB

The manual for building BitSQL database with MariaDB

Requirements

  1. Library
sudo apt install libmariadb-dev
  1. Download (bitcoin core)[https://bitcoin.org/en/download] and Block data
./bitcoind
  1. configuration edit
# add at line 75
server=1
    
# add at line 102: result from `generate_rpcauth.py`
rpcauth=...

# add at line 153
txindex=1
  1. Reindex and Rescan (JUST ONCE!!)
  • After performing once, run without parameters
bitcoind -reindex -rescan
  1. Check bitcoin-cli COMMAND
./bitcoin-cli getblockheight 1
  1. Create MariaDB container on docker
sudo apt install ca-certificates curl gnupg lsb-release
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# uno to focal
sudo vi /etc/apt/sources.list.d/docker.list
sudo apt update
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin
sudo usermod -aG docker $USER
docker pull mariadb
docker run --name bitsqldb -p 3306:3306 -v /my/own/datadir/var/lib/mysql:/var/lib/mysql -e MARIADB_ROOT_PASSWORD=my-secret-pw -d mariadb:latest --innodb_buffer_pool_size=137438953472 --key_buffer_size=137438953472 --max_allowed_packet=1073741824
  • Create user and database
docker exec -it bitsqldb bash
mariadb -uroot -p
CREATE DATABASE bitsqldb;
CREATE USER IF NOT EXISTS user@bitsqldb IDENTIFIED BY 'user-secret-pw';
SHOW WARNINGS;
GRANT ALL PRIVILEGES ON bitsqldb.* TO 'user'@'%' IDENTIFIED BY 'user-secret-pw';
FLUSH PRIVILEGES;
SET GLOBAL query_cache_size = 1073741824;
  • Create secret.py
# Contents of secret.py
rpcuser = USER
rpcpassword = PASSWORD
dbrootpassword = PASSWORD
dbdatabase = DATABASE
dbuser = USER
dbpassword = PASSWORD
dbhost = HOST
dbport = PORT
  1. Install python3 library and install library
apt install libmariadb-dev
python3 -m venv venv
source venv/bin/activate
pip3 install --upgrade -r requirements.txt