Nothing special Please only run, this in public internet, if you know what you are doing
- mainnet 250go
- testnet 25go
- debian stretch
- bitcoin - v0.16.3
- lightningd - v0.6.2
apt update && apt upgrade
apt-get install git build-essential htop tmux -yhere, we use debian. There is no perfect distribution. Debian as a good security focus and stable environment.
When interacting with this tutorial. Your default user should not be root.
- blocks all ports except SSH/bitcoind(8333)/lightningd
- temporary open git/apt/80/443
Excellent tutorial are available in the web.
Bitcoin as 3 majors implementations for server
- bitcoind maintain by bitcoin core developers and bitcoin developers
- btcd maintain by The btcsuite developers
- libbitcoin
We use bitcoind
https://github.com/bitcoin/bitcoin/blob/master/doc/dependencies.md
apt update
apt install autoconf libboost-all-dev libssl-dev libtool libevent-dev libminiupnpc-dev pkg-config -ythis is the library that store chain history.
wget 'http://download.oracle.com/berkeley-db/db-4.8.30.NC.tar.gz'
tar -xzvf db-4.8.30.NC.tar.gz
cd db-4.8.30.NC/build_unix/
../dist/configure --prefix=/usr/local --enable-cxx
make
sudo make installapt-get install libprotobuf-dev protobuf-compileror
git clone https://github.com/google/protobuf.git
cd protobuf
git checkout v2.6.1
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig # refresh shared library cache for linux.export BDB_INCLUDE_PATH="/usr/local/BerkeleyDB.4.8/include"
export BDB_LIB_PATH="/usr/local/BerkeleyDB.4.8/lib"
ln -s /usr/local/BerkeleyDB.4.8/lib/libdb-4.8.so /usr/local/lib/libdb-4.8.sogit clone https://github.com/bitcoin/bitcoin.git
cd bitcoin
git checkout v0.16.3
./autogen.sh
./configure CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" --enable-cxx --disable-shared --with-pic --without-gui --prefix=/usr/local/ LDFLAGS="-L$BDB_LIB_PATH -L/usr/local/lib -L." CPPFLAGS="-I$BDB_INCLUDE_PATH -I/include/google/protobuf"
make
sudo make installwithout => self explaining enable-cxx => because client have c++ code disable shared => as you like if you prefer portable or shared libs with-pic => position independant code prefix => where the binary is installed
adduser bitcointarget a place with sufficient space, here we just do it in /opt
mkdir -p /opt/bitcoin-data
chown bitcoin:bitcoin /opt/bitcoin-dataLook at bitcoin.conf, rpc access is not setup. Make sure you have rpc/zmq interface and txindex=1. Copy bitcoin.conf in the data directory.
cp bitcoin.conf /opt/bitcoin-dataFrom the bitcoin repository's root, run the following command (replacing {{login-name}} with the login name of your choice):
./share/rpcauth/rpcauth.py {{login-name}}This script will gave you the rpc access line to replace in bitcoin.conf and give you password to be used to connect to rpc socket.
as user bitcoin, launch bitcoin daemon
su bitcoin
bitcoind -datadir=/opt/bitcoin-dataor
bitcoind -datadir=/opt/bitcoin-data -testnet=1for testnet
tail -f /opt/bitcoin-data/debug.logbitcoin-cli -datadir=/opt/bitcoin-data getblockcountsudo apt-get install -y \
libgmp-dev \
libsqlite3-dev python python3 net-tools zlib1g-devgit clone https://github.com/ElementsProject/lightning.git
cd lightning
git checkout v0.6.2make
sudo make installchown -R bitcoin:bitcoin /opt/clightning/su bitcoin
/usr/local/bin/lightningd --pid-file=/run/clightningd/lightningd.pid \
--bitcoin-cli=/usr/local/bin/bitcoin-cli --bitcoin-datadir=/opt/bitcoin-data \
--addr="{{ip_addr}}:9735" --alias={{super_alias}} \
--lightning-dir=/opt/clightning/ --log-level=debug --network=testnetlightning-cli --lightning-dir=/opt/bitcoin-data getinfo- systemd
- tor
- rate limiting
- lightning charge
- enjoy