├── .gitignore ├── .gitmodules ├── CHANGES.txt ├── COPYING ├── Makefile ├── README.md ├── TODO.txt ├── Usage_Brief.txt ├── Usage_More.txt ├── bitcoin_envs.sh ├── configs ├── aliases.sh ├── bin │ ├── bitcoind │ │ ├── mainnet-bitcoind-start │ │ ├── mainnet-bitcoind-stop │ │ ├── testnet-bitcoind-start │ │ └── testnet-bitcoind-stop │ ├── lightning │ │ ├── mainnet-lightning-start │ │ ├── mainnet-lightning-stop │ │ ├── testnet-lightning-start │ │ └── testnet-lightning-stop │ ├── lncli-web │ │ ├── mainnet-lncli-web-start │ │ ├── mainnet-lncli-web-stop │ │ ├── testnet-lncli-web-start │ │ └── testnet-lncli-web-stop │ └── lnd │ │ ├── mainnet-lnd-debug-start │ │ ├── mainnet-lnd-start │ │ ├── mainnet-lnd-stop │ │ ├── testnet-lnd-debug-start │ │ ├── testnet-lnd-start │ │ └── testnet-lnd-stop ├── bitcoind │ ├── bitcoin-mainnet.conf │ └── bitcoin-testnet.conf ├── electrumx │ └── env.sh └── lnd │ └── bitcoind │ ├── lnd-mainnet.conf │ └── lnd-testnet.conf ├── define_all_ipaddresses.sh ├── golang_envs.sh ├── iptables.template ├── mk ├── autotools.mk ├── binutils.mk ├── bitcoind.mk ├── cmake.mk ├── common.mk ├── electrumx.mk ├── finally.mk ├── gcc.mk ├── git.mk ├── golang.mk ├── i-want-lightning.mk ├── inotify.mk ├── iptables.mk ├── libs.mk ├── lncli-web.mk ├── lnd.mk ├── miniupnp.mk ├── nodejs.mk ├── python2.mk ├── python3.mk ├── rsync.mk ├── rust.mk ├── sqlite3.mk ├── tor.mk └── zeromq.mk ├── test_ver.sh ├── update_lnd_cert_to_standard_cert.sh └── update_wallet_macaroon_files_to_standard_dir.sh /.gitignore: -------------------------------------------------------------------------------- 1 | /autoconf-* 2 | /automake-* 3 | /sqlite-autoconf-* 4 | /zlib-* 5 | /libtool-* 6 | /gmp-* 7 | /mpfr-* 8 | /mpc-* 9 | /isl-* 10 | /gcc-* 11 | /binutils-* 12 | /node-* 13 | /pkg-config 14 | /boost_* 15 | /openssl 16 | /libevent 17 | /bitcoin-uasf 18 | /bitcoin-core 19 | /electrumx 20 | *.tar.gz 21 | /*_install 22 | /*_download 23 | /*_update 24 | /*-update 25 | my_make_output.txt 26 | *.komodoproject 27 | Python-* 28 | /build 29 | /upnp 30 | /network_*.mk 31 | /network_*.sh 32 | /i-want-lightning 33 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "external/libzmq"] 2 | path = external/libzmq 3 | url = https://github.com/zeromq/libzmq.git 4 | [submodule "external/bitcoin-core"] 5 | path = external/bitcoin-core 6 | url = https://github.com/bitcoin/bitcoin.git 7 | [submodule "external/openssl"] 8 | path = external/openssl 9 | url = https://github.com/openssl/openssl.git 10 | [submodule "external/libevent"] 11 | path = external/libevent 12 | url = https://github.com/libevent/libevent.git 13 | [submodule "external/pkg-config"] 14 | path = external/pkg-config 15 | url = https://gitlab.freedesktop.org/pkg-config/pkg-config.git 16 | [submodule "external/miniupnp"] 17 | path = external/miniupnp 18 | url = https://github.com/miniupnp/miniupnp.git 19 | [submodule "external/inotify-tools"] 20 | path = external/inotify-tools 21 | url = https://github.com/rvoicilas/inotify-tools.git 22 | [submodule "external/rust"] 23 | path = external/rust 24 | url = https://github.com/rust-lang/rust.git 25 | [submodule "external/boost"] 26 | path = external/boost 27 | url = https://github.com/boostorg/boost.git 28 | -------------------------------------------------------------------------------- /CHANGES.txt: -------------------------------------------------------------------------------- 1 | 2025-02-28 2 | * Added LIBS=... to bitcoind (v28.1) options for CentOS 6.* compiling 3 | * some improvements 4 | 5 | 2025-02-19 6 | * LND update v0.18.5-beta 7 | 8 | 2025-01-17 9 | * LND update v0.18.4-beta 10 | * bitcoind update up to v28.1 11 | * Updated: openssl, boost, libevent, libzmq, miniupnp pkg-config, rust libraries 12 | * Updated python from 3.8.* to 3.9.* 13 | * c-lightning was removed because it's not updated by me many many years... 14 | * Improved the script mainnet-lnd-start 15 | 16 | 2024-09-13 17 | * LND update v0.18.3-beta 18 | 19 | 2024-05-31 20 | * LND update v0.18.0-beta 21 | * Improved the README.md file 22 | 23 | 2024-02-20 24 | * LND update v0.17.4-beta 25 | 26 | 2024-02-02 27 | * LND update v0.17.4-beta.rc1 28 | 29 | 2023-11-22 30 | * LND update v0.17.3-beta 31 | 32 | 2023-11-22 33 | * Update of Bitcoin Core to v25.1 34 | 35 | 2023-11-21 36 | * LND update v0.17.2-beta 37 | 38 | 2023-11-19 39 | * LND update v0.17.2-beta.rc1 40 | 41 | 2023-11-16 42 | * LND update v0.17.1-beta 43 | 44 | 2023-10-04 45 | * LND update v0.17.0-beta 46 | 47 | 2023-07-17 48 | * LND update v0.16.4-beta 49 | 50 | 2023-06-27 51 | * LND update v0.16.4 rc1 52 | 53 | 2023-05-02 54 | * LND update v0.16.2-beta 55 | 56 | 2023-04-26 57 | * Update go to golang 1.20.3 58 | * Update LND to v0.16.1-beta 59 | 60 | 2023-02-10 61 | * Update Bitcoin Core from v23.0 to v23.1 (as submodule from source repo) 62 | 63 | 2023-01-18 64 | * Update LND 0.15.5-beta + Fixes potential channel announcements missing 65 | 66 | 2022-12-09 67 | * Update to v0.15.5-beta 68 | * Updated to fresh versions (as submodules): openssl (v1.1.1), boost library, libevent 69 | 70 | 2022-12-01 71 | * LND: added compile tags: monitoring peersrpc 72 | * Update to v0.15.5-beta.rc2 73 | 74 | 2022-11-01 75 | * The LND update up to lnd v0.15.4-beta 76 | 77 | 2022-10-10 78 | * The LND update up to v0.15.2-beta 79 | 80 | 2022-09-13 81 | * The LND update up to v0.15.1-beta 82 | 83 | 2022-06-20 84 | * The LND update up to v0.15.0-beta.rc6 85 | * bitcoind update up to v23.0 86 | 87 | 2021-10-20 88 | * The LND update up to v0.13.3-beta 89 | 90 | 2021-03-03 91 | * The LND update up to v0.12.1-beta 92 | 93 | 2021-02-10 94 | * The LND update up to v0.12.0-beta 95 | * small fix with new installations (there was no tag `routerrpc` before) 96 | 97 | 2020-12-18 98 | * The update to the LND current master branch 99 | 100 | 2020-10-12 101 | * LND v0.11.1-beta 102 | 103 | 2020-10-02 104 | * LND v0.11.1-beta.rc5 105 | 106 | 2020-08-14 107 | * LND v0.11.0-beta.rc4 108 | 109 | 2020-07-14 110 | * LND v0.10.3-beta as minimum + wumbo channel commits 111 | 112 | 2020-03-02 (the "mainnet-lightning-start" branch now - it to be testing by me now) 113 | * LND was updated to 0.9.1-beta 114 | * Bitcoin Core was updated to 0.19.0.1 (For upgrade to see https://github.com/Perlover/bitcoin-kit-makefile#upgrade-lnd--bitcoin-core) 115 | * Openssl was updated to fresh branch OpenSSL_1_1_1-stable (will be affected in new installations) 116 | * miniupnp utility was updated to fresh master branch (will be affected in new installations) 117 | * The lncli-web utility was deleted from mainnet-lightning-[start|stop] scripts because i don't want to support it here. 118 | * golang was updated to v1.14 119 | * update boost library (for bitcoin core) 120 | 121 | 2020-02-26 122 | * LND master branch - v0.9.1-beta.rc1 as minumum (+ all sub-servers are included) 123 | 124 | 2020-01-24 125 | * LND master branch - v0.9.0-beta as minumum (+ all sub-servers are included) 126 | * Now a backup of files to be run only if LND_BACKUP shell's variable is set. 127 | 128 | 2020-01-17 129 | * LND v0.9.0-beta-rc2 (+ all sub-servers are included) 130 | 131 | 2020-01-10 132 | * LND v0.9.0-beta-rc1 (+ all sub-servers are included) 133 | 134 | 2019-12-16 135 | * Update LND to v0.8.2-beta (+ all sub-servers are included) 136 | 137 | 2019-12-09 138 | * Update LND to v0.8.2-beta-rc2 (+ all sub-servers are included) 139 | 140 | 2019-12-06 141 | * Update LND to v0.8.2-beta-rc1 (+ all sub-servers are included) 142 | 143 | 2019-11-18 144 | * Update up to 0.8.1-beta + added build tags for sub-servers API 145 | 146 | 2019-10-22 147 | * Fix of previous upgrade of LND v0.8.0-beta. For LND 0.8.0-beta the Golang 1.13.1 as minimum to be needed 148 | Now there is upgrade to Golang 1.13.3 before upgrading/installing of LND 149 | 150 | 2019-10-15 151 | * Update LND - v0.8.0-beta from 2019-10-15 152 | 153 | 2019-07-31 154 | * Big update: 155 | - Bitcoin Core 0.18.0 (commit 2472733a24a9364e4c6233ccd04166a26a68cc65) 156 | - LND 0.7.1-beta (commit add905d17f7bbb11d0df2761cdf8accf2fef2b00) 157 | - OpenSSL library OpenSSL_1_1_1-stable master branch (2019-07-31) 158 | - libzmq v4.3.2 159 | - libevent master branch (2019-07-31) 160 | 161 | For update commands to see here: https://github.com/Perlover/bitcoin-kit-makefile#upgrade-lnd--bitcoin-core 162 | 163 | 2019-07-01 164 | * Update LND up to v0.7.0-beta-rc3 165 | 166 | 2019-06-24 167 | * Update golang up to 1.12.6 168 | * Update LND up to v0.7.0-beta-rc2 169 | 170 | 2019-05-07 171 | * Update LND - current master branch (0.6.1-beta-rc2) 172 | 173 | 2019-05-06 174 | * Update LND - current master branch (0.6.1-beta release) 175 | 176 | 2019-04-10 177 | * Update LND - current master branch (0.6-rc4 + some new commits) 178 | 179 | 2019-04-09 180 | * Now the inotify-tools are compiled from sources for LND (for Static Channel Backups). It installed for backup tools 181 | For example for this script: https://gist.github.com/alexbosworth/2c5e185aedbdac45a03655b709e255a3 182 | 183 | 2019-04-03 184 | * Update LND up to current master for SCB feature (static channel backups) 185 | 186 | 2019-03-20 187 | * Update LND - current master branch 188 | * Now the mainnet-lnd-debug-start script to be installed when we do update 189 | * Increased timeout delay (from 5 to 20 seconds) when lnd to be stopped before killing 190 | 191 | 2019-03-11 192 | * Update LND - current master branch 193 | 194 | 2019-03-05 195 | + Added the mainnet-lnd-debug-start & testnet-lnd-debug-start commands. 196 | * Updated the README.md for a debug lnd mode 197 | 198 | 2019-02-20 199 | * Added commands (bash functions): loc & ltoc - an openning channel with node of format pubkey@host:port 200 | The format: loc 201 | This commands (loc - mainnet, ltoc - testnet) connect and open channel (because native lncli commands don't understand same format...) 202 | Before an openning this command will check do we have already a channel with them or not. If yes the channel will not be opened. 203 | 204 | 2019-02-19 205 | * The command [mainnet|testnet]-lnd-start now have optional parameter - 'changepassword'. Now we can change the wallet password by command: 206 | $ mainnet-lnd-start changepassword. To see README.txt details about it. 207 | 208 | 2019-02-13 209 | * Now this is compiled on Ubuntu 18.04 and on CentOS 6.* 210 | 211 | 2019-02-08 212 | + Update LND - v0.5.2-beta 213 | + Update bitcoind - v0.17.1 214 | + UPdate lncli-web up to fresh current commit 215 | * The fix autoconf - with new perl version the 1.15 version was not compiled 216 | * Fix README.md 217 | * Fix LND repositary problem: i think after the beta realese (tag v0.5.2-beta) the team of LND rebased commits so i need to make git fetch --tags origin before update 218 | 219 | 2019-01-30 220 | * The LND version is updated to v0.5.2-beta-rc3 (commit 5ec1df5c5f2e87d6880a748d5d5d1de6d3e148e7). Not tested but i hope it will work ;-) 221 | 222 | 2019-01-26 223 | * fix in makefile. Tested 224 | 225 | 2019-01-14 226 | * Update LND up to fresh LND (2019-01-14) 227 | * Now macaroons files are located in standard for v0.5.1 directories 228 | * For upgrade LND you must to do: 229 | $ mainnet-lnd-stop && make prepare-lnd-update && make lnd-update 230 | To see README -> Upgrade LND & Bitcoin Core section 231 | 232 | 2018-11-15 233 | * Update LND up to v0.5.1-beta-rc1 (commmit 3f57f65bf0cb710159b0182391d1d75e9e3005bc) 234 | 235 | 2018-11-14 236 | * Some improvements in makefiles. This was tested in two CentOS 6 installations 237 | 238 | 2018-11-11 239 | * update to Bitcoin Core v0.17.0.1 240 | * The openssl version is now 1.1.1 241 | * update LND up to fresh version (commit is d4b042dc1946ece8b60d538ade8e912f035612fe - the current master branch) 242 | 243 | 2017-06-11 244 | * Actual bitcoind's version is v0.16.0 245 | + Added installation of electrumx server 246 | + Some makefile pieces are splitted by *.mk files 247 | 248 | 2017-07-17 249 | + Now actual version of UASF is v0.14.2-uasfsegwit1.0 (this is the tag of original git repo) 250 | + Added the new make target: bitcoin-uasf_update 251 | You can easy to upgrade by: "make bitcoin-uasf_update restart" or by commands in README.txt 252 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2017 Perlover 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2017 Perlover 2 | # Distributed under the MIT software license, see the accompanying 3 | # file COPYING or http://www.opensource.org/licenses/mit-license.php. 4 | 5 | # Makefile for CentOS to compile full bitcoin core node for UASF 6 | # This make does many things under user local folder ( NOT root! ;-) ): 7 | # Compiling and installing from fresh sources (actual at 2017-06-06): 8 | # - autotools 9 | # - pkg-config 10 | # - libevent 11 | # - openssl 12 | # - automake 13 | # - m4 14 | # - gcc 15 | # - bitcoin core 16 | # To run from /home/bitcoin/bitcoin-core-makefile for example 17 | 18 | # --login is important here. It forces read ~/.bash_profile file before each execution of make command in rules 19 | SHELL := /bin/bash --login 20 | 21 | # The option --no-check-certificate needs because old systems doesn't check correct some certificates (Let's Encrypt for example) 22 | # In anyway we check md5 / sha256 sums 23 | WGET := wget --no-check-certificate 24 | 25 | # The base directory of all packages. It's home directory now but in a future it can be used for common directory in OS, for example /opt/ 26 | BASE_INSTALL_DIR := $(HOME) 27 | 28 | # Here will be some password files and etc. for authorization of services 29 | CREDENTIALS_DIR := $(HOME)/credentials 30 | 31 | # This hash will be used when defining the network configuration (as cache ID) 32 | HASH_NETWORK_CONFIG := $(shell echo `uname -a` `/sbin/ifconfig | grep 'inet '|sed -r -e 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/'|grep -vE '^127\.'`|md5sum|awk '{print $$1}') 33 | 34 | # commit/tag of LND for installation - the current master branch (the lnd v0.18.5-beta) 35 | LND_ACTUAL_COMMIT := 4ccf4fc24c750d098cf24566ef4bbc0311c7d476 36 | 37 | # Should be updated in PATH of golang_envs.sh too! 38 | GOLANG_VER := 1.22.11 39 | 40 | # Go now is $(GOLANG_VER) (to see file mk/golang.mk) 41 | CURRENT_GOLANG_TARGET := $(BASE_INSTALL_DIR)/go$(GOLANG_VER)/bin/go 42 | 43 | # This is macro for version compareof software (for example gnu, python, pkg-config) 44 | # $(eval $(call COMPARE_VERSIONS,command_for_version,required_version,result_variable_name)) 45 | # Example: $(eval $(call COMPARE_VERSIONS,gcc -dumpversion,5.0.0,GCC_5_0_0)) after will be 'OK' or 'FAIL' 46 | COMPARE_VERSIONS = $(4) = $$(shell ./test_ver.sh $(1) $(2) $(3)) 47 | 48 | $(eval $(call COMPARE_VERSIONS,1,'m4 --version',1.4.17,M4_MIN)) 49 | $(eval $(call COMPARE_VERSIONS,1,'automake --version',1.15,AUTOMAKE_MIN)) 50 | $(eval $(call COMPARE_VERSIONS,1,'autoconf --version',2.69,AUTOCONF_MIN)) 51 | $(eval $(call COMPARE_VERSIONS,1,'libtoolize --version',2.4.6,LIBTOOL_MIN)) 52 | $(eval $(call COMPARE_VERSIONS,1,'pkg-config --version',0.29,PKG_CONFIG_MIN)) 53 | $(eval $(call COMPARE_VERSIONS,1,'ld --version',2.37,BINUTILS_MIN)) 54 | $(eval $(call COMPARE_VERSIONS,2,'gcc -dumpversion',11.2.0,GCC_MIN)) 55 | 56 | ifneq ($(MAKECMDGOALS),rsync) 57 | ifneq ($(MAKECMDGOALS),clean) 58 | ifneq ($(MAKECMDGOALS),help) 59 | ifneq ($(MAKECMDGOALS),help-more) 60 | ifneq ($(MAKECMDGOALS),) 61 | 62 | NETWORK_MK_FILE := network_$(HASH_NETWORK_CONFIG).mk 63 | NETWORK_SHELL_FILE := network_$(HASH_NETWORK_CONFIG).sh 64 | 65 | ifneq ($(wildcard $(NETWORK_MK_FILE)),$(NETWORK_MK_FILE)) 66 | $(shell mkdir -p $(CREDENTIALS_DIR) && ./define_all_ipaddresses.sh $(NETWORK_MK_FILE) $(NETWORK_SHELL_FILE) $(CREDENTIALS_DIR)/network-summary.txt) 67 | endif 68 | 69 | include $(NETWORK_MK_FILE) 70 | 71 | endif 72 | endif 73 | endif 74 | endif 75 | endif 76 | 77 | PROFILE_FILE := $(shell if [ -f $(HOME)/.bash_profile ]; then \ 78 | echo $(HOME)/.bash_profile; \ 79 | elif [ -f $(HOME)/.bash_login ]; then \ 80 | echo $(HOME)/.bash_login; \ 81 | else \ 82 | echo $(HOME)/.profile; \ 83 | fi ) 84 | 85 | # For aliases 86 | BASHRC_FILE := $(HOME)/.bashrc 87 | 88 | # MAKE_COMPILE: make or make -jN, where N = amount processors in system - 1 89 | MAKE_COMPILE := $(MAKE) $(shell nproc=$$((`cat /proc/cpuinfo|grep processor|wc -l`-1));nproc=$$(($$nproc<=1?0:$$nproc));if [ $$nproc -le 0 ] ; then echo -n '' ; else echo "-j$$nproc" ; fi) 90 | 91 | # For configure script: make variables for implicit rules 92 | CONFIGURE_VARS += LDFLAGS="$(patsubst %,-L%,$(subst :, ,$(shell bash -c '. bitcoin_envs.sh; echo $$LD_LIBRARY_PATH')))" 93 | CONFIGURE_VARS += CPPFLAGS="$(patsubst %,-isystem %,$(subst :, ,$(shell bash -c '. bitcoin_envs.sh; echo $$CPATH')))" 94 | 95 | .PHONY: help help-more 96 | 97 | help: 98 | @cat Usage_Brief.txt 99 | 100 | help-more: 101 | @cat Usage_More.txt 102 | 103 | bitcoind-start: 104 | nice -n 20 bitcoind -daemon -upnp=0 -maxconnections=500 -maxmempool=100 -mempoolexpiry=24 105 | @echo "The bitcoind started" 106 | 107 | bitcoind-stop: 108 | bitcoin-cli stop 109 | @echo "The bitcoind stoped" 110 | 111 | bitcoind-restart: 112 | sleep 5 && $(MAKE) stop && sleep 5 && $(MAKE) start 113 | @echo "The bitcoind restarted" 114 | 115 | # developer target - to test version of software 116 | test-versions: 117 | echo $(M4_MIN) 118 | echo $(AUTOMAKE_MIN) 119 | echo $(AUTOCONF_MIN) 120 | echo $(LIBTOOL_MIN) 121 | echo $(PKG_CONFIG_MIN) 122 | echo $(BINUTILS_MIN) 123 | echo $(GCC_MIN) 124 | 125 | .PHONY: start stop restart 126 | 127 | include mk/common.mk 128 | include mk/autotools.mk 129 | include mk/gcc.mk 130 | include mk/libs.mk 131 | include mk/tor.mk 132 | include mk/bitcoind.mk 133 | include mk/electrumx.mk 134 | include mk/python3.mk 135 | include mk/python2.mk 136 | include mk/sqlite3.mk 137 | include mk/binutils.mk 138 | include mk/nodejs.mk 139 | include mk/golang.mk 140 | include mk/lnd.mk 141 | include mk/lncli-web.mk 142 | include mk/iptables.mk 143 | include mk/zeromq.mk 144 | include mk/miniupnp.mk 145 | include mk/i-want-lightning.mk 146 | include mk/rsync.mk 147 | include mk/git.mk 148 | include mk/inotify.mk 149 | include mk/cmake.mk 150 | include mk/rust.mk 151 | include mk/finally.mk 152 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Makefile for compiling Full Lightning Node 2 | 3 | The local-user compiling if *Bitcoin Core*, *Lightning* in CentOS 6.x and other *nix. 4 | 5 | ## License 6 | 7 | This Makefile is released under the terms of the MIT license. See COPYING for 8 | more information or see https://opensource.org/licenses/MIT. 9 | 10 | ## What is this? 11 | 12 | ### Brief: 13 | 14 | **`make i-want-lightning`** and you will have compiled bitcoind with lnd daemons with preconfigured files. 15 | 16 | **`make set-up-lightning-mainnet`** and you will be ready to run immediately the 17 | **lnd** and **bitcoind** daemons in mainnet. 18 | 19 | **`make set-up-lightning-testnet`** and you will be ready to run immediately the 20 | **lnd** and **bitcoind** daemons in testnet. 21 | 22 | **You can use together mainnet & testnet** services in single host. 23 | **UPnP is supported** auto by scripts from this repositary! 24 | 25 | ### More info: 26 | 27 | This is the Makefile for building from sources the software for the Bitcoin: 28 | 29 | 1. [Bitcoin Core][bitcoin-core] 30 | 2. [LND][lnd] 31 | 3. [Lncli-Web][lncli-web] (web interface to *lnd*) 32 | 33 | This makefile was written for the CentOS 6.x because this OS very conservative 34 | for new libraries and tools. There are many dependencies which should have new 35 | versions (gcc, autotools, libtools, pkg-config, gcc, boost, binutils, python 2.x, 36 | python 3.x, nodeJS, Golang and etc etc etc...). But you can use this makefile 37 | packet for any *nix i think. 38 | 39 | [bitcoin-core]: https://github.com/bitcoin/bitcoin "Bitcoin Core full-node" 40 | [lnd]: https://github.com/lightningnetwork/lnd "Lightning node from Lightning Labs" 41 | [electrumx]: https://github.com/kyuupichan/electrumx "Alternative Electrum server" 42 | [lncli-web]: https://github.com/mably/lncli-web 43 | 44 | This compiling and installing doesn't affect to Unix system because all binaries 45 | and libraries installed to $HOME directory (for example to home of 'bitcoin' 46 | user). 47 | 48 | The **install process is maximally secure** for installation. Wherever possible 49 | **MD5/SHA256** checksums or **GPG signatures** are checked before compilation and 50 | installing. The *git sources* are secured by commit ID checkout. 51 | 52 | If you have old this repositary installed in your system you can easy upgrade up to fresh Bitcoin Core & LND. [Please to see below upgrade section](#upgrade-lnd-bitcoin-core) 53 | 54 | ## How to install the Bitcoin Core + LND: 55 | 56 | 1. First, you need to do by hands the prepare process: 57 | 58 | For CentOS 6.* (there are old autotoolsm, gcc and etc... So we will install only this minimal packages) 59 | 60 | ``` 61 | sudo yum -y install git make coreutils screen gettext 62 | ``` 63 | 64 | For Ubuntu/Mint/Debian Linux: 65 | 66 | ``` 67 | sudo apt install git build-essential screen gettext 68 | 69 | ``` 70 | 71 | For Raspberry Pi (Raspbian OS) you need to install some requires 72 | (because a compiling from sources will take many more time and memory resources): 73 | 74 | ``` 75 | sudo apt install gcc build-essential screen git m4 automake autoconf libtool pkg-config binutils 76 | # And you need to increase a swap up to ~1Gb 77 | # (else you will have 'no virtual memory' error) by following commands: 78 | sudo dd if=/dev/zero of=/swapfile bs=1M count=1000 79 | sudo mkswap /swapfile 80 | sudo swapon /swapfile 81 | # optional: to add line '/swapfile none swap sw 0 0' to /etc/fstab (sudo vi /etc/fstab) 82 | ``` 83 | 84 | And then next (and for a rest OSes may be): 85 | 86 | ``` 87 | sudo adduser bitcoin 88 | ``` 89 | 90 | 2. To login under *bitcoin* user by following ways: 91 | 92 | ``` 93 | screen -S bitcoin-kit 94 | sudo su -l bitcoin 95 | ``` 96 | 97 | OR 98 | 99 | ``` 100 | ssh bitcoin@your-host.com 101 | screen -S bitcoin-kit 102 | ``` 103 | 104 | And to do the next: 105 | 106 | ``` 107 | git clone --recursive https://github.com/Perlover/bitcoin-kit-makefile.git 108 | cd bitcoin-kit-makefile 109 | make i-want-lightning |& tee -a my_make_output.txt 110 | ``` 111 | 112 | wait, wait, wait... 113 | 114 | You can logout from 'screen' by 'Ctrl-A' -> 'd' and login to again by: 115 | 116 | ``` 117 | screen -r bitcoin-kit 118 | ``` 119 | 120 | OR (if you logged through ssh under 'bitcoin' user) 121 | 122 | ``` 123 | screen -r bitcoin-kit 124 | ``` 125 | 126 | 3. After you need to create lnd's wallet: 127 | 128 | ``` 129 | make set-up-lightning-mainnet 130 | ``` 131 | 132 | OR 133 | 134 | ``` 135 | make set-up-lightning-testnet 136 | ``` 137 | 138 | 4. To logout from terminal/shell and login again. After you will have all environment variables for normal work. 139 | 140 | And you will have scripts in `$PATH` for starting/stopping: 141 | 142 | * `[mainnet|testnet]-lightning-[start|stop]` 143 | * `[mainnet|testnet]-bitcoind-[start|stop]` 144 | * `[mainnet|testnet]-lnd-[start|stop]` 145 | * `[mainnet|testnet]-lncli-web-[start|stop]` 146 | 147 | 5. You can start bitcoin & lnd daemons as: 148 | 149 | 1. First time after installation: 150 | 151 | ``` 152 | mainnet-bitcoind-start 153 | # ... wait some minutes ... 154 | mainnet-lnd-start 155 | ``` 156 | 157 | 2. Next time starting: 158 | 159 | ``` 160 | mainnet-bitcoind-start 161 | # ... wait some seconds... 162 | mainnet-lnd-start 163 | ``` 164 | 165 | 3. Stopping: 166 | 167 | ``` 168 | mainnet-lnd-stop 169 | mainnet-bitcoind-stop 170 | ``` 171 | 172 | 4. If you want to use `lncli-web` you can start same way: 173 | 174 | ``` 175 | mainnet-lightning-start 176 | ``` 177 | 178 | Stop daemon: 179 | 180 | ``` 181 | mainnet-lightning-stop 182 | ``` 183 | 184 | But first time run after installation i recommend to run as described in #5.1 185 | 186 | You can work with node same way: `https://your_listen_ip_address:[8280|8281]/` 187 | The passwords can be found in ~/credentials directory, 8280 - for mainnet, 8281 - for testnet 188 | 189 | 6. If you want to change password of wallet you can do it by following commands: 190 | 191 | ``` 192 | mainnet-lnd-stop 193 | mainnet-lnd-start changepassword 194 | ``` 195 | 196 | You must to enter the old password and the new one. The seed password is kept old (it cannot be changed). 197 | 198 | 7. For the `abandonchannel` command of lnd you need the debug lnd binary. You can start the LND in debug mode by same way: 199 | 200 | ``` 201 | mainnet-lnd-stop 202 | mainnet-lnd-debug-start 203 | ``` 204 | 205 | Then you can run lncli with `abandonchannel` command: 206 | 207 | ``` 208 | l abandonchannel ... 209 | ``` 210 | 211 | When you finished we recommend to return to non-debug mode: 212 | 213 | ``` 214 | mainnet-lnd-stop 215 | mainnet-lnd-start 216 | ``` 217 | 218 | 8. After setup you have easy bash aliases and functions: 219 | 220 | `l` - the mainnet lncli command 221 | 222 | `lt` - the testnet lncli command 223 | 224 | `loc` - connect & open channel to mainnet node of format `pubkey@host:port` as: 225 | 226 | loc 227 | 228 | `ltoc` - same as `loc` only for testnet network 229 | 230 | 231 | 9. **RECOMMENDATION** If your OS has firewall rules - **DON'T FORGET TO OPEN the 8333 TCP PORT** 232 | 233 | This Makefile has helpers: 234 | 235 | **a)** If your OS doesn't have firewall rules but you want to have you can (if 236 | eth0 is WAN interface): 237 | From root from current repositary directory to do: 238 | 239 | # make iptables_install 240 | 241 | It will install my default suggested iptable rules for CentOS (but 242 | without bitcoin TCP port) For bitcoin rules to do next step: 243 | 244 | **b)** To install addition line for iptable rules (to my based example) to do by root: 245 | 246 | # make bitcoin_iptables_install 247 | 248 | Please ATTENTION! Both make targets requires some actions from root user: 249 | twice pressing of ENTER (to check internet activity after firewall 250 | applying and if it's not - an auto resetting to all) 251 | 252 | ## Upgrade LND & Bitcoin Core 253 | 254 | If you have installed old LND and/or Bitcoin Core by this repository this makefile gives easy targets to update. The LND update makes TAR archive before upgrading by request (to see `LND_BACKUP` below). For upgrade: 255 | 256 | 1. To checkout to master branch and to pull fresh repositary: 257 | 258 | ``` 259 | cd ~/bitcoin-kit-makefile 260 | git checkout master 261 | git pull 262 | ``` 263 | 264 | 3. To stop bitcoind and/or LND, for example for mainnet: 265 | 266 | ``` 267 | mainnet-lnd-stop 268 | mainnet-bitcoind-stop 269 | ``` 270 | 271 | 4. Then, if you want to upgrade Bitcoin Core: 272 | 273 | ``` 274 | make prepare-bitcoin-core-update 275 | make bitcoin-core-update 276 | ``` 277 | 278 | If upgrade LND for mainnet: 279 | 280 | ``` 281 | make prepare-lnd-update 282 | # without a LND backup 283 | make lnd-update-mainnet 284 | # OR for backup of LND before: 285 | LND_BACKUP=1 make lnd-update-mainnet 286 | ``` 287 | Or upgrade LND for testnet: 288 | 289 | ``` 290 | make prepare-lnd-update 291 | make lnd-update-testnet 292 | ``` 293 | 294 | Or to upgrade both: 295 | 296 | ``` 297 | make prepare-bitcoin-core-update prepare-lnd-update 298 | LND_BACKUP=1 make bitcoin-core-update lnd-update-mainnet 299 | ``` 300 | 301 | In home directory you will see lnd tar archive before upgrade (if you used `LND_BACKUP` as above): 302 | 303 | ``` 304 | lnd-backup-UUUUUUU-YYYY-MM-DD.tgz 305 | ``` 306 | 307 | Where: UUUUUU - seconds from computer epoch (1970-01-01), YYYY - a year, MM - a month and DD - a day. 308 | 309 | Upgrade corrects LND config files and move *macaroon* files to standard for v0.5.* lnd directories. 310 | 311 | 5. After upgrade and before start please logout from terminal and login again. The upgrade process corrects `$PATH` after upgrade of *golang* 312 | 313 | 6. **ONLY TESTNET!** After upgrade for testnet (if you use testnet network daemon) you may be needed to make reindex in bitcoind [to see details here why](https://bitcoin.stackexchange.com/questions/79662/solving-bitcoin-cores-activatebestchain-failed). You need to make once after upgrade: 314 | 315 | ``` 316 | bitcoind -conf=$HOME/.bitcoin/bitcoin-testnet.conf -reindex 317 | ``` 318 | 319 | When reindexing will be finished (you can check in logs by `tail -f ~/.bitcoin/testnet3/debug.log`) you can stop and start again the *bitcoind* (optionally) 320 | 321 | 7. To start bitcoind and/or LND again, for example for mainnet: 322 | 323 | ``` 324 | mainnet-bitcoind-start 325 | mainnet-lnd-start 326 | ``` 327 | 328 | Have a nice day ;-) 329 | 330 | *Perlover* 331 | -------------------------------------------------------------------------------- /TODO.txt: -------------------------------------------------------------------------------- 1 | * 24 words seed of lnd can be stored through GnuPG by using key of user under ~/credentials 2 | 3 | * All git repos under this Makefile can be described as git's submodules 4 | -------------------------------------------------------------------------------- /Usage_Brief.txt: -------------------------------------------------------------------------------- 1 | ******************************************************************************* 2 | * * 3 | * Usage * 4 | * * 5 | ******************************************************************************* 6 | 7 | HELP: 8 | 9 | make [help] 10 | this help 11 | 12 | make help-more 13 | Show more targets 14 | 15 | EASY INSTALLATION, LIGHTNING: 16 | 17 | After installation you will get compiled from sources and installed under $HOME: 18 | 19 | THE MOST FRESH: bitoind + lnd + lncli-web programs 20 | 21 | And the necessary fresh accompanying equipment for compilation before (will be 22 | compiled from sources too): 23 | 24 | gcc 7.1, python 2 & python3, required fresh some libs (libevent, openssl, boost, sqlite3, zeromq), 25 | golang, nodeJS 26 | 27 | This makefile also additionally contains some targets but are yet not documented: ElectrumX server 28 | 29 | Stage 1 (The process takes about 1-2 hours, better to use 'screen'): 30 | make i-want-lightning 31 | My recommended installation: bitcoin core v0.16.0 + lnd + lncli-web 32 | At the beginning you will be asked about surrent network IP addresses (listen and public). 33 | In many cases these ip addresses will be defined automatically. 34 | 35 | Stage 2 (It's very fast process but is interactive one): 36 | make [ set-up-lightning-mainnet | set-up-lightning-testnet ] 37 | This will configure lnd's wallet. 38 | You will need to come up with a password and to write 24 words of wallet. 39 | It's interactive stage so there will be better if you will run when you will be near from terminal. 40 | 41 | Stage 3: 42 | To logout from terminal/shell and login again. After you will have all environment variables for normal work. 43 | And you will have scripts in $PATH for starting/stopping: 44 | 45 | Start & stop bitcoind + lnd + lncli-web: 46 | 47 | [mainnet|testnet]-lightning-[start|stop] 48 | 49 | OR 50 | 51 | [mainnet|testnet]-bitcoind-[start|stop] 52 | [mainnet|testnet]-lnd-[start|stop] 53 | [mainnet|testnet]-lncli-web-[start|stop] 54 | 55 | You can work with node same way: https://your_listen_ip_address:[8280|8281]/ 56 | The passwords can be found in ~/credentials directory, 8280 - for mainnet, 8281 - for testnet 57 | 58 | After installation to see ~/credentials/* files. After you can remove theirs. 59 | -------------------------------------------------------------------------------- /Usage_More.txt: -------------------------------------------------------------------------------- 1 | ******************************************************************************* 2 | * * 3 | * Usage * 4 | * * 5 | ******************************************************************************* 6 | 7 | MORE TARGETS: 8 | 9 | make bitcoin-core-install 10 | The official bitcoin-core install 11 | Version: v0.16.0 12 | 13 | make btcd-install 14 | The official bitcoin-core install 15 | Version: v0.16.0 16 | 17 | make lnd-install 18 | The lnd daemon install 19 | Version: $(LND_ACTUAL_COMMIT) 20 | 21 | make lnd-update 22 | To update already installed LND 23 | Version: $(LND_ACTUAL_COMMIT) 24 | 25 | make lncli-web-install 26 | The lncli-web install 27 | Version: current master branch 28 | 29 | make lncli-web-update 30 | The lncli-web update 31 | Version: current master branch 32 | 33 | make lnd-bitcoin-core-bundle-install 34 | The bundle of: lnd + bitcoin-core install 35 | Same as: make bitcoin-core-install lnd-install 36 | 37 | make lnd-btcd-bundle-install 38 | The bundle of: lnd + btcd install () 39 | Same as: make lnd-install btcd-install 40 | 41 | make bitcoin-core-update 42 | Update up to current bitcoin core version 43 | Version: master beanch at github.com 44 | 45 | make electrumx-install 46 | 47 | ------------------------------------------------------------------------------- 48 | -------------------------------------------------------------------------------- /bitcoin_envs.sh: -------------------------------------------------------------------------------- 1 | export PATH=$HOME/.npm-global/bin:$HOME/bin:$PATH 2 | 3 | # man ld.so(8) - run time execution (not link time) 4 | export LD_LIBRARY_PATH="$HOME/lib:$HOME/lib64:/usr/local/lib64:/lib64:/usr/lib64" 5 | 6 | # ld uses it in link time 7 | export LD_RUN_PATH=$LD_LIBRARY_PATH 8 | 9 | # man gcc(1) 10 | export LIBRARY_PATH=$LD_LIBRARY_PATH 11 | export CPATH="$HOME/include" 12 | 13 | export MANPATH="$HOME/share/man:$MANPATH" 14 | export PKG_CONFIG_PATH="$HOME/lib/pkgconfig:$HOME/lib64/pkgconfig" 15 | 16 | # TODEL these are only make variable 17 | # export CPPFLAGS="-I$HOME/include" 18 | # export LDFLAGS="-L$HOME/lib -L$HOME/lib64 -L/lib64 -L/usr/lib64 -L/usr/local/lib64" 19 | 20 | if [ -f /etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt ]; then 21 | export SSL_CERT_FILE=/etc/pki/ca-trust/extracted/openssl/ca-bundle.trust.crt 22 | elif [ -f /etc/ssl/certs/ca-certificates.crt ]; then 23 | export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt 24 | fi 25 | -------------------------------------------------------------------------------- /configs/aliases.sh: -------------------------------------------------------------------------------- 1 | alias testnet-lncli="lncli --macaroonpath $HOME/.lnd/data/chain/bitcoin/testnet/admin.macaroon --rpcserver localhost:10010" 2 | alias mainnet-lncli="lncli --macaroonpath $HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon --rpcserver localhost:10009" 3 | alias l="mainnet-lncli" 4 | alias lt="testnet-lncli" 5 | 6 | # loc - mainnet 7 | # ltoc - testnet 8 | # Here is universal function 9 | # loc_or_ltoc other_parameters... 10 | function loc_or_ltoc () { 11 | host_port=${3//*@} 12 | pubkey=${3//@*} 13 | 14 | if [[ "$host_port" == "" ]]; then 15 | echo "$1: please use the following format: $1 pubkey@host:port amount" 16 | return 1 17 | fi 18 | if [[ "$pubkey" == "" ]]; then 19 | echo "$1: please use the following format: $1 pubkey@host:port amount" 20 | return 1 21 | fi 22 | if [[ "$4" == "" ]]; then 23 | echo "$1: please use the following format: $1 pubkey@host:port amount" 24 | return 1 25 | fi 26 | # test pubkey before - if we already have an openned channel or pending one - don't open a channel 27 | if l pendingchannels|grep $pubkey &>/dev/null; then 28 | echo "$1: the node $pubkey already has a pending channel - ignoring" 29 | return 1 30 | fi 31 | if l listchannels|grep $pubkey &>/dev/null; then 32 | echo "$1: the node $pubkey already has a openning channel - ignoring" 33 | return 1 34 | fi 35 | $2 openchannel --connect $host_port $pubkey $4 36 | } 37 | 38 | function loc () { 39 | loc_or_ltoc loc "lncli --macaroonpath $HOME/.lnd/data/chain/bitcoin/mainnet/admin.macaroon --rpcserver localhost:10009" $* 40 | } 41 | 42 | function ltoc () { 43 | loc_or_ltoc ltoc "lncli --macaroonpath $HOME/.lnd/data/chain/bitcoin/testnet/admin.macaroon --rpcserver localhost:10010" $* 44 | } 45 | -------------------------------------------------------------------------------- /configs/bin/bitcoind/mainnet-bitcoind-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=bitcoind 6 | bitcoin_network=mainnet 7 | tcp_port=8333 8 | 9 | bitcoind -conf=$HOME/.bitcoin/bitcoin-${bitcoin_network}.conf && echo "OK - ${service_name} (${bitcoin_network}) started" && 10 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 11 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 12 | { 13 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 14 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 15 | fi 16 | -------------------------------------------------------------------------------- /configs/bin/bitcoind/mainnet-bitcoind-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=bitcoind 6 | bitcoin_network=mainnet 7 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 8 | tcp_port=8333 9 | 10 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 11 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 12 | { 13 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 14 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 15 | fi 16 | 17 | pid=`cat $pid_file` 18 | 19 | bitcoin-cli -conf=$HOME/.bitcoin/bitcoin-${bitcoin_network}.conf stop 20 | 21 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 22 | for i in {1..20}; do 23 | kill -0 $pid &>/dev/null || break 24 | echo -n '.' 25 | sleep 1 26 | done 27 | kill -0 $pid &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 28 | echo " OK" 29 | -------------------------------------------------------------------------------- /configs/bin/bitcoind/testnet-bitcoind-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=bitcoind 6 | bitcoin_network=testnet 7 | tcp_port=18333 8 | 9 | bitcoind -conf=$HOME/.bitcoin/bitcoin-${bitcoin_network}.conf && echo "OK - ${service_name} (${bitcoin_network}) started" && 10 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 11 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 12 | { 13 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 14 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 15 | fi 16 | -------------------------------------------------------------------------------- /configs/bin/bitcoind/testnet-bitcoind-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=bitcoind 6 | bitcoin_network=testnet 7 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 8 | tcp_port=18333 9 | 10 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 11 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 12 | { 13 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 14 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 15 | fi 16 | 17 | pid=`cat $pid_file` 18 | 19 | bitcoin-cli -conf=$HOME/.bitcoin/bitcoin-${bitcoin_network}.conf stop 20 | 21 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 22 | for i in {1..20}; do 23 | kill -0 $pid &>/dev/null || break 24 | echo -n '.' 25 | sleep 1 26 | done 27 | kill -0 $pid &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 28 | echo " OK" 29 | -------------------------------------------------------------------------------- /configs/bin/lightning/mainnet-lightning-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bitcoin_network=mainnet 4 | 5 | ${bitcoin_network}-bitcoind-start && 6 | echo -n "wait 15 sec for normal starting the lnd after the bitcoind "; for i in {1..15}; do echo -n '.'; sleep 1; done; echo && 7 | ${bitcoin_network}-lnd-start && 8 | echo "All services of bitcoin lightning (${bitcoin_network}) are started!" 9 | -------------------------------------------------------------------------------- /configs/bin/lightning/mainnet-lightning-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bitcoin_network=mainnet 4 | 5 | ${bitcoin_network}-lnd-stop && 6 | ${bitcoin_network}-bitcoind-stop && 7 | 8 | echo "All services of bitcoin lightning (${bitcoin_network}) are stopped!" 9 | -------------------------------------------------------------------------------- /configs/bin/lightning/testnet-lightning-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bitcoin_network=testnet 4 | 5 | ${bitcoin_network}-bitcoind-start && 6 | echo -n "wait 15 sec for normal starting the lnd after the bitcoind "; for i in {1..15}; do echo -n '.'; sleep 1; done; echo && 7 | ${bitcoin_network}-lnd-start && 8 | echo "All services of bitcoin lightning (${bitcoin_network}) are started!" 9 | -------------------------------------------------------------------------------- /configs/bin/lightning/testnet-lightning-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | bitcoin_network=testnet 4 | 5 | ${bitcoin_network}-lnd-stop && 6 | ${bitcoin_network}-bitcoind-stop && 7 | 8 | echo "All services of bitcoin lightning (${bitcoin_network}) are stopped!" 9 | -------------------------------------------------------------------------------- /configs/bin/lncli-web/mainnet-lncli-web-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=lncli-web 6 | bitcoin_network=mainnet 7 | tcp_port=8280 8 | grpc_port=10009 9 | web_admin_pass=$$LNCLI_WEB_MAINNET_ADMIN_PASS$$ 10 | web_limit_pass=$$LNCLI_WEB_MAINNET_LIMIT_PASS$$ 11 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 12 | macaroon_path=$HOME/opt/lncli-web/admin-mainnet.macaroon 13 | 14 | cd $HOME/opt/lncli-web && 15 | if [ ! -f $pid_file ] || ! kill -0 `cat $pid_file` &>/dev/null; then 16 | echo -n "The ${service_name} (${bitcoin_network}) starting..." 17 | nohup node server --macaroon-path ${macaroon_path} --lndhost localhost:${grpc_port} --serverport ${tcp_port} --usetls ssl --user admin --pwd ${web_admin_pass} --limituser limit --limitpwd ${web_limit_pass} --serverhost $$BITCOIN_KIT_LOCAL_IP$$ &>/dev/null & 18 | echo $! >$pid_file 19 | echo " OK" 20 | else 21 | echo "${service_name} (${bitcoin_network}) is already run (pid: '`cat $pid_file`')" 22 | fi && 23 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 24 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 25 | { 26 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 27 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 28 | fi 29 | -------------------------------------------------------------------------------- /configs/bin/lncli-web/mainnet-lncli-web-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | bitcoin_network=mainnet 6 | tcp_port=8280 7 | service_name=lncli-web 8 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 9 | 10 | if [ ! -f $pid_file ]; then 11 | echo "ERROR: The ${service_name} (${bitcoin_network}) not run!" 12 | exit 1 13 | fi 14 | 15 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 16 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 17 | { 18 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 19 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 20 | fi 21 | 22 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 23 | kill `cat $pid_file` &>/dev/null 24 | for i in {1..5}; do 25 | kill -0 `cat $pid_file` &>/dev/null || break 26 | echo -n '.' 27 | sleep 1 28 | done 29 | kill -0 `cat $pid_file` &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 30 | echo " OK" 31 | rm -f $pid_file 32 | -------------------------------------------------------------------------------- /configs/bin/lncli-web/testnet-lncli-web-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | service_name=lncli-web 6 | bitcoin_network=testnet 7 | tcp_port=8281 8 | grpc_port=10010 9 | web_admin_pass=$$LNCLI_WEB_TESTNET_ADMIN_PASS$$ 10 | web_limit_pass=$$LNCLI_WEB_TESTNET_LIMIT_PASS$$ 11 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 12 | macaroon_path=$HOME/opt/lncli-web/admin-testnet.macaroon 13 | 14 | cd $HOME/opt/lncli-web && 15 | if [ ! -f $pid_file ] || ! kill -0 `cat $pid_file` &>/dev/null; then 16 | echo -n "The ${service_name} (${bitcoin_network}) starting..." 17 | nohup node server --macaroon-path ${macaroon_path} --lndhost localhost:${grpc_port} --serverport ${tcp_port} --usetls ssl --user admin --pwd ${web_admin_pass} --limituser limit --limitpwd ${web_limit_pass} --serverhost $$BITCOIN_KIT_LOCAL_IP$$ &>/dev/null & 18 | echo $! >$pid_file 19 | echo " OK" 20 | else 21 | echo "${service_name} (${bitcoin_network}) is already run (pid: '`cat $pid_file`')" 22 | fi && 23 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 24 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 25 | { 26 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 27 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 28 | fi 29 | -------------------------------------------------------------------------------- /configs/bin/lncli-web/testnet-lncli-web-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | 5 | bitcoin_network=testnet 6 | tcp_port=8281 7 | service_name=lncli-web 8 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 9 | 10 | if [ ! -f $pid_file ]; then 11 | echo "ERROR: The ${service_name} (${bitcoin_network}) not run!" 12 | exit 1 13 | fi 14 | 15 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 16 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 17 | { 18 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 19 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 20 | fi 21 | 22 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 23 | kill `cat $pid_file` &>/dev/null 24 | for i in {1..5}; do 25 | kill -0 `cat $pid_file` &>/dev/null || break 26 | echo -n '.' 27 | sleep 1 28 | done 29 | kill -0 `cat $pid_file` &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 30 | echo " OK" 31 | rm -f $pid_file 32 | -------------------------------------------------------------------------------- /configs/bin/lnd/mainnet-lnd-debug-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | service_name=lnd 7 | bitcoin_network=mainnet 8 | tcp_port=9735 9 | grpc_port=10009 10 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 11 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 12 | 13 | strstr() { 14 | [ "${1#*$2*}" = "$1" ] && return 1 15 | return 0 16 | } 17 | 18 | if [[ -f $pid_file ]] && kill -0 `cat $pid_file` &>/dev/null; then 19 | echo "The lnd is already running, pid="`cat $pid_file` 20 | echo -n "Do you want to try unlock wallet? y/n [n]" 21 | read answer; echo " $answer" 22 | if strstr $"nN" "$answer" || [ "$answer" = "" ]; then 23 | exit 2 24 | fi 25 | else 26 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 27 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 28 | { 29 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 30 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 31 | fi 32 | 33 | { 34 | nohup $GOPATH/src/github.com/lightningnetwork/lnd/lnd-debug --configfile=$HOME/.lnd/${service_name}-${bitcoin_network}.conf &>>$HOME/.lnd/${bitcoin_network}-${service_name}-run.log & 35 | echo $! > $pid_file 36 | } &>/dev/null 37 | sleep 1 38 | fi 39 | 40 | echo $'\n\n\n******************************************************************\n\nPlease '"${1:-unlock} ${service_name} (${bitcoin_network})"$' daemon\n\n******************************************************************\nEnter password: '; 41 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} ${1:-unlock} 42 | 43 | sleep 2 44 | 45 | # Now we check again lnd process (sometime it dies after this with "rewind block" reason) 46 | kill -0 `cat $pid_file` &>/dev/null || { echo "The lnd not started, please try run '${bitcoin_network}-lnd-start' again!"; exit 1; } 47 | -------------------------------------------------------------------------------- /configs/bin/lnd/mainnet-lnd-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | service_name=lnd 7 | bitcoin_network=mainnet 8 | tcp_port=9735 9 | grpc_port=10009 10 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 11 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 12 | 13 | # Function to wait for a specific string in a file 14 | wait_for_string() { 15 | local file_to_watch="$1" # File to monitor 16 | local search_string="$2" # String to wait for 17 | local timeout_seconds="$3" # Timeout in seconds 18 | 19 | # Function to display progress dots 20 | show_progress() { 21 | while true; do 22 | echo -n "." 23 | sleep 1 24 | done 25 | } 26 | 27 | # Start displaying progress dots in the background 28 | show_progress & 29 | local progress_pid=$! 30 | 31 | # Use timeout to limit the waiting time and suppress grep output 32 | timeout "$timeout_seconds" tail -f "$file_to_watch" | grep --line-buffered -m 1 "$search_string" >/dev/null 2>&1 33 | local pipe_status=("${PIPESTATUS[@]}") # Capture exit codes of commands in the pipeline 34 | 35 | # Stop the background process for progress dots 36 | kill "$progress_pid" 2>/dev/null 37 | wait "$progress_pid" 2>/dev/null 38 | 39 | # Add a newline after progress dots 40 | echo "" 41 | 42 | # Check the exit code of timeout and grep 43 | if [ "${pipe_status[0]}" -eq 124 ]; then 44 | return 1 # Timeout expired 45 | elif [ "${pipe_status[1]}" -eq 0 ]; then 46 | return 0 # String found 47 | else 48 | return 2 # An error occurred 49 | fi 50 | } 51 | 52 | strstr() { 53 | [ "${1#*$2*}" = "$1" ] && return 1 54 | return 0 55 | } 56 | 57 | if [[ -f $pid_file ]] && kill -0 `cat $pid_file` &>/dev/null; then 58 | echo "The lnd is already running, pid="`cat $pid_file` 59 | echo -n "Do you want to try unlock wallet? y/n [n]" 60 | read answer; echo " $answer" 61 | if strstr $"nN" "$answer" || [ "$answer" = "" ]; then 62 | exit 2 63 | fi 64 | else 65 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 66 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 67 | { 68 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 69 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 70 | fi 71 | 72 | { 73 | ulimit -n 4096 74 | nohup lnd --configfile=$HOME/.lnd/${service_name}-${bitcoin_network}.conf &>>$HOME/.lnd/${bitcoin_network}-${service_name}-run.log & 75 | echo $! > $pid_file 76 | } &>/dev/null 77 | sleep 1 78 | fi 79 | 80 | echo -n "Waiting for LND to request the wallet unlock password (up to 15 minutes) " 81 | 82 | wait_for_string "$HOME/.lnd/${bitcoin_network}-${service_name}-run.log" "Waiting for wallet encryption password." 900 83 | 84 | echo $'\n\n\n******************************************************************\n\nPlease '"${1:-unlock} ${service_name} (${bitcoin_network})"$' daemon\n\n******************************************************************\nEnter password: '; 85 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} ${1:-unlock} 86 | 87 | sleep 2 88 | 89 | # Now we check again lnd process (sometime it dies after this with "rewind block" reason) 90 | kill -0 `cat $pid_file` &>/dev/null || { echo "The lnd not started, please try run '${bitcoin_network}-lnd-start' again!"; exit 1; } 91 | -------------------------------------------------------------------------------- /configs/bin/lnd/mainnet-lnd-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | bitcoin_network=mainnet 7 | tcp_port=9735 8 | service_name=lnd 9 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 10 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 11 | grpc_port=10009 12 | 13 | if [ ! -f $pid_file ]; then 14 | echo "ERROR: The ${service_name} (${bitcoin_network}) not run!" 15 | exit 1 16 | fi 17 | 18 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 19 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 20 | { 21 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 22 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 23 | fi 24 | 25 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 26 | 27 | # First way - to try stop through `lncli stop` command but sometime it hangs up a long time 28 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} stop & 29 | lncli_pid=$! 30 | 31 | for i in {1..60}; do 32 | kill -0 `cat $pid_file` &>/dev/null || break 33 | echo -n '.' 34 | sleep 1 35 | done 36 | 37 | if kill -0 `cat $pid_file` &>/dev/null; then 38 | # If we here - the lnd works... 39 | kill $lncli_pid &>/dev/null 40 | kill `cat $pid_file` &>/dev/null 41 | for i in {1..5}; do 42 | kill -0 `cat $pid_file` &>/dev/null || break 43 | echo -n '.' 44 | sleep 1 45 | done 46 | kill -0 `cat $pid_file` &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 47 | fi 48 | 49 | echo " OK" 50 | rm -f $pid_file 51 | -------------------------------------------------------------------------------- /configs/bin/lnd/testnet-lnd-debug-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | service_name=lnd 7 | bitcoin_network=testnet 8 | tcp_port=9736 9 | grpc_port=10010 10 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 11 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 12 | 13 | strstr() { 14 | [ "${1#*$2*}" = "$1" ] && return 1 15 | return 0 16 | } 17 | 18 | if [[ -f $pid_file ]] && kill -0 `cat $pid_file` &>/dev/null; then 19 | echo "The lnd is already running, pid="`cat $pid_file` 20 | echo -n "Do you want to try unlock wallet? y/n [n]" 21 | read answer; echo " $answer" 22 | if strstr $"nN" "$answer" || [ "$answer" = "" ]; then 23 | exit 2 24 | fi 25 | else 26 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 27 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 28 | { 29 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 30 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 31 | fi 32 | 33 | { 34 | nohup $GOPATH/src/github.com/lightningnetwork/lnd/lnd-debug --configfile=$HOME/.lnd/${service_name}-${bitcoin_network}.conf &>>$HOME/.lnd/${bitcoin_network}-${service_name}-run.log & 35 | echo $! > $pid_file 36 | } &>/dev/null 37 | sleep 1 38 | fi 39 | 40 | echo $'\n\n\n******************************************************************\n\nPlease '"${1:-unlock} ${service_name} (${bitcoin_network})"$' daemon\n\n******************************************************************\nEnter password: '; 41 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} ${1:-unlock} 42 | 43 | sleep 2 44 | 45 | # Now we check again lnd process (sometime it dies after this with "rewind block" reason) 46 | kill -0 `cat $pid_file` &>/dev/null || { echo "The lnd not started, please try run '${bitcoin_network}-lnd-start' again!"; exit 1; } 47 | -------------------------------------------------------------------------------- /configs/bin/lnd/testnet-lnd-start: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | service_name=lnd 7 | bitcoin_network=testnet 8 | tcp_port=9736 9 | grpc_port=10010 10 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 11 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 12 | 13 | # Function to wait for a specific string in a file 14 | wait_for_string() { 15 | local file_to_watch="$1" # File to monitor 16 | local search_string="$2" # String to wait for 17 | local timeout_seconds="$3" # Timeout in seconds 18 | 19 | # Function to display progress dots 20 | show_progress() { 21 | while true; do 22 | echo -n "." 23 | sleep 1 24 | done 25 | } 26 | 27 | # Start displaying progress dots in the background 28 | show_progress & 29 | local progress_pid=$! 30 | 31 | # Use timeout to limit the waiting time and suppress grep output 32 | timeout "$timeout_seconds" tail -f "$file_to_watch" | grep --line-buffered -m 1 "$search_string" >/dev/null 2>&1 33 | local pipe_status=("${PIPESTATUS[@]}") # Capture exit codes of commands in the pipeline 34 | 35 | # Stop the background process for progress dots 36 | kill "$progress_pid" 2>/dev/null 37 | wait "$progress_pid" 2>/dev/null 38 | 39 | # Add a newline after progress dots 40 | echo "" 41 | 42 | # Check the exit code of timeout and grep 43 | if [ "${pipe_status[0]}" -eq 124 ]; then 44 | return 1 # Timeout expired 45 | elif [ "${pipe_status[1]}" -eq 0 ]; then 46 | return 0 # String found 47 | else 48 | return 2 # An error occurred 49 | fi 50 | } 51 | 52 | strstr() { 53 | [ "${1#*$2*}" = "$1" ] && return 1 54 | return 0 55 | } 56 | 57 | if [[ -f $pid_file ]] && kill -0 `cat $pid_file` &>/dev/null; then 58 | echo "The lnd is already running, pid="`cat $pid_file` 59 | echo -n "Do you want to try unlock wallet? y/n [n]" 60 | read answer; echo " $answer" 61 | if strstr $"nN" "$answer" || [ "$answer" = "" ]; then 62 | exit 2 63 | fi 64 | else 65 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 66 | echo -n "UPnP On (${service_name}/${bitcoin_network}) ..." 67 | { 68 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -e "The ${service_name} (${bitcoin_network})" -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp 69 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot add port redirection [$?] (upnpc -a $$BITCOIN_KIT_LOCAL_IP$$ ${tcp_port} ${tcp_port} tcp)" 70 | fi 71 | 72 | { 73 | ulimit -n 4096 74 | nohup lnd --configfile=$HOME/.lnd/${service_name}-${bitcoin_network}.conf &>>$HOME/.lnd/${bitcoin_network}-${service_name}-run.log & 75 | echo $! > $pid_file 76 | } &>/dev/null 77 | sleep 1 78 | fi 79 | 80 | echo -n "Waiting for LND to request the wallet unlock password (up to 15 minutes) " 81 | 82 | wait_for_string "$HOME/.lnd/${bitcoin_network}-${service_name}-run.log" "Waiting for wallet encryption password." 900 83 | 84 | echo $'\n\n\n******************************************************************\n\nPlease '"${1:-unlock} ${service_name} (${bitcoin_network})"$' daemon\n\n******************************************************************\nEnter password: '; 85 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} ${1:-unlock} 86 | 87 | sleep 2 88 | 89 | # Now we check again lnd process (sometime it dies after this with "rewind block" reason) 90 | kill -0 `cat $pid_file` &>/dev/null || { echo "The lnd not started, please try run '${bitcoin_network}-lnd-start' again!"; exit 1; } 91 | -------------------------------------------------------------------------------- /configs/bin/lnd/testnet-lnd-stop: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | . $HOME/.bitcoin_envs 4 | . $HOME/.golang_envs 5 | 6 | bitcoin_network=testnet 7 | tcp_port=9736 8 | service_name=lnd 9 | pid_file=$HOME/.${bitcoin_network}-${service_name}.pid 10 | macaroon_path=$HOME/.lnd/data/chain/bitcoin/${bitcoin_network}/admin.macaroon 11 | grpc_port=10010 12 | 13 | if [ ! -f $pid_file ]; then 14 | echo "ERROR: The ${service_name} (${bitcoin_network}) not run!" 15 | exit 1 16 | fi 17 | 18 | if [ "$$BITCOIN_KIT_UPNP_SUPPORT$$" == "Yes" ]; then 19 | echo -n "UPnP Off (${service_name}/${bitcoin_network}) ..." 20 | { 21 | upnpc -m $$BITCOIN_KIT_LOCAL_IP$$ -d ${tcp_port} tcp 22 | } &> /dev/null && echo " OK" || echo " ERROR: i cannot delete port redirection [$?] (upnpc -d ${tcp_port} tcp)" 23 | fi 24 | 25 | echo -n "The ${service_name} (${bitcoin_network}) terminating ..." 26 | 27 | # First way - to try stop through `lncli stop` command but sometime it hangs up a long time 28 | lncli --macaroonpath ${macaroon_path} --rpcserver localhost:${grpc_port} stop & 29 | lncli_pid=$! 30 | 31 | for i in {1..60}; do 32 | kill -0 `cat $pid_file` &>/dev/null || break 33 | echo -n '.' 34 | sleep 1 35 | done 36 | 37 | if kill -0 `cat $pid_file` &>/dev/null; then 38 | # If we here - the lnd works... 39 | kill $lncli_pid &>/dev/null 40 | kill `cat $pid_file` &>/dev/null 41 | for i in {1..5}; do 42 | kill -0 `cat $pid_file` &>/dev/null || break 43 | echo -n '.' 44 | sleep 1 45 | done 46 | kill -0 `cat $pid_file` &>/dev/null && echo "I cannot terminate ${service_name} (${bitcoin_network})" && exit 2 47 | fi 48 | 49 | echo " OK" 50 | rm -f $pid_file 51 | -------------------------------------------------------------------------------- /configs/bitcoind/bitcoin-mainnet.conf: -------------------------------------------------------------------------------- 1 | minrelaytxfee=0.000009 2 | maxmempool=450 3 | 4 | limitancestorcount=100 5 | limitancestorsize=404 6 | limitdescendantcount=100 7 | limitdescendantsize=404 8 | 9 | txindex=1 10 | server=1 11 | daemon=1 12 | 13 | # Please uncomment it if you use local the Bisq for example. This option is critical for the Bisq but is disabled by default in the Bitcoin Core 0.19.* 14 | # peerbloomfilters=1 15 | 16 | pid=$$HOME$$/.mainnet-bitcoind.pid 17 | 18 | # Will beother upnp support - through 'upnpc' utility 19 | upnp=0 20 | 21 | # ZMQ for lnd... 22 | zmqpubrawblock=tcp://127.0.0.1:28332 23 | zmqpubrawtx=tcp://127.0.0.1:28333 24 | 25 | # Auth key for lnd 26 | $$LND_RPC_PASS$$ 27 | 28 | $$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET$$ 29 | -------------------------------------------------------------------------------- /configs/bitcoind/bitcoin-testnet.conf: -------------------------------------------------------------------------------- 1 | # TESTNET! 2 | testnet=1 3 | 4 | txindex=1 5 | server=1 6 | daemon=1 7 | 8 | # Please uncomment it if you use local the Bisq for example. This option is critical for the Bisq but is disabled by default in the Bitcoin Core 0.19.* 9 | # peerbloomfilters=1 10 | 11 | pid=$$HOME$$/.testnet-bitcoind.pid 12 | 13 | # Will beother upnp support - through 'upnpc' utility 14 | 15 | upnp=0 16 | 17 | # ZMQ for lnd... 18 | zmqpubrawblock=tcp://127.0.0.1:28334 19 | zmqpubrawtx=tcp://127.0.0.1:28335 20 | 21 | $$LND_RPC_PASS$$ 22 | 23 | $$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET$$ 24 | -------------------------------------------------------------------------------- /configs/electrumx/env.sh: -------------------------------------------------------------------------------- 1 | export COIN=BitcoinMixin 2 | export DB_DIRECTORY= 3 | export DAEMON_URL= 4 | export NET=mainnet 5 | export HOST= 6 | export TCP_PORT= 7 | export SSL_PORT= 8 | 9 | # 10 | # export DONATION_ADDRESS= 11 | -------------------------------------------------------------------------------- /configs/lnd/bitcoind/lnd-mainnet.conf: -------------------------------------------------------------------------------- 1 | [Application Options] 2 | 3 | rpclisten=localhost:10009 4 | # If you want listen other interface - you can add second and so on a command like this: 5 | # rpclisten=host:10009 6 | restlisten=localhost:8080 7 | 8 | debuglevel=info 9 | # .. or ... 10 | # CNCT, CRTR and HSWV provide channel-related logs, while NTFN provides chain-related logs. RPCS will provide you with RPC-related logs. 11 | # debuglevel=CNCT=debug,CRTR=debug,HSWC=debug,NTFN=debug,RPCS=debug 12 | 13 | autopilot.active=1 14 | autopilot.maxchannels=2048 15 | autopilot.allocation=0.9 16 | $$BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET$$listen=$$BITCOIN_KIT_LOCAL_IP$$:9735 17 | alias=BITCOIN-KIT [lnd/mainnet] 18 | 19 | gc-canceled-invoices-on-startup=true 20 | gc-canceled-invoices-on-the-fly=true 21 | coin-selection-strategy=random 22 | enable-upfront-shutdown=true 23 | 24 | db.bolt.auto-compact=true 25 | db.bolt.auto-compact-min-age=72h 26 | 27 | # routing.strictgraphpruning=true 28 | # 29 | # From reccomendations (https://docs.lightning.engineering/lightning-network-tools/lnd/optimal-configuration-of-a-routing-node) 30 | # 31 | # debuglevel=CNCT=debug,CRTR=debug,HSWC=debug,NTFN=debug,RPCS=debug 32 | # 33 | 34 | # If routing: 35 | # ignore-historical-gossip-filters=true 36 | 37 | maxpendingchannels=10 38 | bitcoin.defaultchanconfs=2 39 | protocol.wumbo-channels=true 40 | # max-cltv-expiry=5000 41 | 42 | minchansize=100000 43 | # We can set the maximum amount of fees in a channel here as a percentage of individual channel capacity. The setting allows for one decimal place and defaults to 0.5 44 | max-channel-fee-allocation=1.0 45 | 46 | datadir=$$HOME$$/.lnd/data/ 47 | adminmacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/mainnet/admin.macaroon 48 | readonlymacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/mainnet/readonly.macaroon 49 | invoicemacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/mainnet/invoice.macaroon 50 | 51 | # Tor 52 | # tor.active=true 53 | # tor.v3=true 54 | # listen=localhost 55 | # If you prefer to make your node available through the Tor network, set these lines in your configuration 56 | # sync-freelist=1 57 | # stagger-initial-reconnect=1 58 | 59 | [Bitcoin] 60 | bitcoin.mainnet=1 61 | bitcoin.active=1 62 | bitcoin.node=bitcoind 63 | 64 | bitcoin.minhtlc=1 65 | 66 | # Your fee is here... It's only example 67 | bitcoin.basefee=1 68 | bitcoin.feerate=1000 69 | # bitcoin.timelockdelta=30 70 | 71 | [Bitcoind] 72 | bitcoind.rpcuser=lnd 73 | bitcoind.rpcpass=$$RPC_PASS$$ 74 | bitcoind.zmqpubrawblock=tcp://127.0.0.1:28332 75 | bitcoind.zmqpubrawtx=tcp://127.0.0.1:28333 76 | -------------------------------------------------------------------------------- /configs/lnd/bitcoind/lnd-testnet.conf: -------------------------------------------------------------------------------- 1 | [Application Options] 2 | rpclisten=localhost:10010 3 | restlisten=localhost:8081 4 | debuglevel=info 5 | autopilot.active=1 6 | autopilot.maxchannels=1024 7 | autopilot.allocation=1.0 8 | $$BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET$$listen=$$BITCOIN_KIT_LOCAL_IP$$:9736 9 | alias=BITCOIN-KIT [lnd/testnet] 10 | 11 | datadir=$$HOME$$/.lnd/data/ 12 | adminmacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/testnet/admin.macaroon 13 | readonlymacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/testnet/readonly.macaroon 14 | invoicemacaroonpath=$$HOME$$/.lnd/data/chain/bitcoin/testnet/invoice.macaroon 15 | 16 | [Bitcoin] 17 | bitcoin.testnet=1 18 | bitcoin.active=1 19 | bitcoin.node=bitocoind 20 | # Setup here is your fee. Here is example as: baseline 1 satoshi + 0.01% (as 100/1000000) 21 | #bitcoin.feerate=100 22 | #bitcoin.basefee=1000 23 | 24 | [Bitcoind] 25 | bitcoind.rpcuser=lnd 26 | bitcoind.rpcpass=$$RPC_PASS$$ 27 | bitcoind.zmqpubrawblock=tcp://127.0.0.1:28334 28 | bitcoind.zmqpubrawtx=tcp://127.0.0.1:28335 29 | -------------------------------------------------------------------------------- /define_all_ipaddresses.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | make_cwd=`pwd` 4 | 5 | if [ ! -d ./upnp ]; then 6 | mkdir ./upnp 7 | fi 8 | 9 | if [ ! -f ./upnp/bin/upnpc ]; then 10 | cd ./upnp && cwd=`pwd` && cd .. && 11 | cd external/miniupnp/miniupnpc && { 12 | INSTALLPREFIX=$cwd make install && make clean && echo "miniUPnP client FOR THIS MAKE was installed - OK"; \ 13 | } &> make_out.txt 14 | fi 15 | 16 | cd $make_cwd 17 | 18 | { 19 | echo -n $' 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | PLEASE TURN OFF some OpenVPN/VPN services if you have! 30 | It will help to define correct network configuration. 31 | 32 | Now your IP addresses will be defined. UPnP support will be tested. Your real 33 | public and router IP addresses will be defined. 34 | 35 | Are you ready? 36 | 37 | Please press ENTER when you will be ready! Waiting your answer..... '; read -s; echo " OK" 38 | 39 | UPNPC_RUN=${UPNPC_RUN:-LD_LIBRARY_PATH=./upnp/lib ./upnp/bin/upnpc} 40 | 41 | # LOCAL LISTEN IP ADDRESS 42 | if [ `/sbin/ifconfig | grep 'inet '|sed -r -e 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/'|grep -vE '^127\.'|wc -l` -gt 1 ]; then /sbin/ifconfig | grep 'inet '|sed -r -e 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/'|grep -vE '^127\.'|awk 'BEGIN{a=1}{print a") "$1; a++}' > $$.tmp; echo $'\n\nYou have some network interfaces not one.\nPlease choose your local IP address of interface for future bitcoin services: \n\n'; cat $$.tmp; echo -n 'Your choose? [1, 2, ...] '; read number; listen_ip=`grep $number') ' $$.tmp|sed -e 's#'$number') ##'`; rm -f $$.tmp; else listen_ip=`/sbin/ifconfig | grep 'inet '|sed -r -e 's/[^0-9]+([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+).*/\1/'|grep -vE '^127\.'`; fi 43 | 44 | BITCOIN_KIT_LOCAL_IP=$listen_ip 45 | 46 | UPNPC_RUN="${UPNPC_RUN} -m $listen_ip" 47 | 48 | echo -n $'\nPlease wait ...' 49 | 50 | { 51 | upnp_public_ip=$(eval $UPNPC_RUN -s|grep 'ExternalIPAddress = '|sed -e 's#ExternalIPAddress = ##') 52 | } &>/dev/null 53 | 54 | echo 55 | 56 | [ "x$upnp_public_ip" != "x" ] && BITCOIN_KIT_UPNP_SUPPORT='Yes' || BITCOIN_KIT_UPNP_SUPPORT='No' 57 | 58 | [ "x$BITCOIN_KIT_UPNP_SUPPORT" == "xYes" ] && BITCOIN_KIT_EXTERNAL_ROUTER_IP=$upnp_public_ip || BITCOIN_KIT_EXTERNAL_ROUTER_IP='Unknown' 59 | 60 | # REAL PUBLIC IP address through ipinfo.io site 61 | public_ip=`wget http://ipinfo.io/ip -qO -` 62 | 63 | BITCOIN_KIT_REAL_PUBLIC_IP=$public_ip 64 | 65 | if [ "x$upnp_public_ip" != "x" -a "$upnp_public_ip" != $public_ip ]; then 66 | public_ip=0.0.0.0 67 | elif [ "x$upnp_public_ip" == "x" -o "x$upnp_public_ip" != "x$public_ip" ]; then 68 | public_ip=0.0.0.0 69 | fi 70 | 71 | [ $listen_ip == $public_ip ] && BITCOIN_KIT_BEHIND_ROUTER='No' || BITCOIN_KIT_BEHIND_ROUTER='Yes' 72 | 73 | BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING='No' 74 | 75 | [ $BITCOIN_KIT_BEHIND_ROUTER == 'No' ] && BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS='Yes' 76 | 77 | [ $BITCOIN_KIT_BEHIND_ROUTER == 'Yes' \ 78 | -a \ 79 | $BITCOIN_KIT_UPNP_SUPPORT == 'Yes' \ 80 | -a \ 81 | $BITCOIN_KIT_EXTERNAL_ROUTER_IP == $BITCOIN_KIT_REAL_PUBLIC_IP \ 82 | ] && { BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS='Yes'; BITCOIN_KIT_NOTICES=$BITCOIN_KIT_NOTICES$'* Incoming connections will be available by auto\n through UPnP service of your router\n'; } 83 | 84 | [ $BITCOIN_KIT_BEHIND_ROUTER == 'Yes' \ 85 | -a \ 86 | $BITCOIN_KIT_UPNP_SUPPORT == 'Yes' \ 87 | -a \ 88 | $BITCOIN_KIT_EXTERNAL_ROUTER_IP != $BITCOIN_KIT_REAL_PUBLIC_IP \ 89 | ] && BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS='No' 90 | 91 | [ $BITCOIN_KIT_BEHIND_ROUTER == 'Yes' \ 92 | -a \ 93 | $BITCOIN_KIT_UPNP_SUPPORT == 'No' \ 94 | ] && { \ 95 | BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS="Maybe"; \ 96 | BITCOIN_KIT_NOTICES=$BITCOIN_KIT_NOTICES$'* Incoming connections may be available\n if external IP of router is '$BITCOIN_KIT_REAL_PUBLIC_IP$'\n and you can configure it for port forwarding to '$BITCOIN_KIT_LOCAL_IP$'\n'; \ 97 | BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING='Maybe'; \ 98 | } 99 | 100 | { 101 | echo " 102 | Summary table: 103 | 104 | UPnP support at router ............................: $BITCOIN_KIT_UPNP_SUPPORT 105 | Local IP address ..................................: $BITCOIN_KIT_LOCAL_IP 106 | Real public IP address ............................: $BITCOIN_KIT_REAL_PUBLIC_IP 107 | External router IP address ........................: $BITCOIN_KIT_EXTERNAL_ROUTER_IP 108 | To be behind router ...............................: $BITCOIN_KIT_BEHIND_ROUTER 109 | Possible incoming connections .....................: $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS 110 | Should you configure router for port forwarding? ..: $BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING 111 | 112 | Recomendations: 113 | 114 | $BITCOIN_KIT_NOTICES" 115 | 116 | } > $3 117 | 118 | cat $3 119 | 120 | # makefile variables 121 | { 122 | echo "\ 123 | BITCOIN_KIT_UPNP_SUPPORT := $BITCOIN_KIT_UPNP_SUPPORT 124 | BITCOIN_KIT_LOCAL_IP := $BITCOIN_KIT_LOCAL_IP 125 | BITCOIN_KIT_REAL_PUBLIC_IP := $BITCOIN_KIT_REAL_PUBLIC_IP 126 | BITCOIN_KIT_EXTERNAL_ROUTER_IP := $BITCOIN_KIT_EXTERNAL_ROUTER_IP 127 | BITCOIN_KIT_BEHIND_ROUTER := $BITCOIN_KIT_BEHIND_ROUTER 128 | BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS := $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS 129 | BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING := $BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING\ 130 | " 131 | if [ $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS == 'Yes' ]; then 132 | echo "\ 133 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET := externalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9735\\n 134 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET := externalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9736\\n 135 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET := externalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n 136 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET := externalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\ 137 | " 138 | elif [ $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS == 'Maybe' ]; then 139 | echo "\ 140 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET := \\\\\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9735\\n 141 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET := \\\\\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9736\\n 142 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET := \\\\\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n 143 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET := \\\\\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\ 144 | " 145 | else 146 | echo "\ 147 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET := 148 | BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET := 149 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET := 150 | BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET :=\ 151 | " 152 | fi 153 | 154 | } > $1 155 | 156 | # bash environments, now it's not used, may be removed 157 | { 158 | echo "\ 159 | export BITCOIN_KIT_UPNP_SUPPORT=\"$BITCOIN_KIT_UPNP_SUPPORT\" 160 | export BITCOIN_KIT_LOCAL_IP=\"$BITCOIN_KIT_LOCAL_IP\" 161 | export BITCOIN_KIT_REAL_PUBLIC_IP=\"$BITCOIN_KIT_REAL_PUBLIC_IP\" 162 | export BITCOIN_KIT_EXTERNAL_ROUTER_IP=\"$BITCOIN_KIT_EXTERNAL_ROUTER_IP\" 163 | export BITCOIN_KIT_BEHIND_ROUTER=\"$BITCOIN_KIT_BEHIND_ROUTER\" 164 | export BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS=\"$BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS\" 165 | export BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING=\"$BITCOIN_KIT_SHOULD_CONFIGURE_ROUTER_PORT_FORWARDING\"\ 166 | " 167 | if [ $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS == 'Yes' ]; then 168 | echo "\ 169 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET=\"externalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9735\\n\" 170 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET=\"externalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9736\\n\" 171 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET=\"externalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\" 172 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET=\"externalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\"\ 173 | " 174 | elif [ $BITCOIN_KIT_POSSIBLE_INCOMING_CONNECTIONS == 'Maybe' ]; then 175 | echo "\ 176 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET=\"\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9735\\n\" 177 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET=\"\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP:9736\\n\" 178 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET=\"\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\" 179 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET=\"\\# You need configure router for port forwarding\\nexternalip=$BITCOIN_KIT_REAL_PUBLIC_IP\\n\"\ 180 | " 181 | else 182 | echo "\ 183 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET= 184 | export BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET= 185 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET= 186 | export BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET=\ 187 | " 188 | fi 189 | 190 | } > $2 191 | 192 | } >&2 193 | -------------------------------------------------------------------------------- /golang_envs.sh: -------------------------------------------------------------------------------- 1 | export PATH=$HOME/go/bin:$HOME/go$$GOLANG_VER$$/bin:$HOME/go$$GOLANG_VER_STAGE_3$$/bin:$HOME/go$$GOLANG_VER_STAGE_2$$/bin:$PATH 2 | export GOPATH=$HOME/go 3 | -------------------------------------------------------------------------------- /iptables.template: -------------------------------------------------------------------------------- 1 | # My example of iptable files 2 | # Here: eth0 - WAN interface (world) 3 | # eth1 - LAN (intranet for example) 4 | # This firewall works in my production 5 | # It has anti-DDoS settings. 6 | *filter 7 | :INPUT ACCEPT [0:0] 8 | :FORWARD ACCEPT [0:0] 9 | :OUTPUT ACCEPT [0:0] 10 | :RH-Firewall-1-INPUT - [0:0] 11 | -A INPUT -j RH-Firewall-1-INPUT 12 | -A FORWARD -i tun+ -j ACCEPT 13 | -A FORWARD -o tun+ -j ACCEPT 14 | -A FORWARD -j RH-Firewall-1-INPUT 15 | -A RH-Firewall-1-INPUT -i lo -j ACCEPT 16 | -A RH-Firewall-1-INPUT -i eth1 -j ACCEPT 17 | -A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT 18 | -A RH-Firewall-1-INPUT -p 50 -j ACCEPT 19 | -A RH-Firewall-1-INPUT -p 51 -j ACCEPT 20 | -A RH-Firewall-1-INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 21 | -A RH-Firewall-1-INPUT -p udp -m udp --dport 53 -j ACCEPT 22 | -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT 23 | -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 24 | -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT 25 | -A RH-Firewall-1-INPUT -m tcp -p tcp --syn -j REJECT --reject-with tcp-reset 26 | -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited 27 | COMMIT 28 | -------------------------------------------------------------------------------- /mk/autotools.mk: -------------------------------------------------------------------------------- 1 | ################### autoconf... 2 | autoconf-2.69.tar.gz: |\ 3 | $(HOME)/.bitcoin_envs\ 4 | m4_install 5 | $(WGET) 'http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz' 6 | echo '82d05e03b93e45f5a39b828dc9c6c29b autoconf-2.69.tar.gz'|md5sum --check - || \ 7 | { \ 8 | mv autoconf-2.69.tar.gz autoconf-2.69.bad.tar.gz &&\ 9 | echo "Bad autoconf md5 sum"; false;\ 10 | } 11 | 12 | ifeq ($(AUTOCONF_MIN),FAIL) 13 | autoconf_install: |\ 14 | $(HOME)/.bitcoin_envs\ 15 | autoconf-2.69.tar.gz 16 | tar xzf autoconf-2.69.tar.gz 17 | cd autoconf-2.69 && { \ 18 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "Autoconf was installed - OK"; \ 19 | } &> make_out.txt && tail make_out.txt 20 | @touch $@ 21 | else 22 | autoconf_install: |\ 23 | $(HOME)/.bitcoin_envs 24 | @touch $@ 25 | endif 26 | 27 | ####################################### 28 | 29 | autotools_install: |\ 30 | autoconf_install\ 31 | automake_install\ 32 | libtool_install 33 | @touch $@ 34 | 35 | ###################################### 36 | 37 | # automake 38 | automake-1.16.1.tar.gz: 39 | $(WGET) 'http://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz' 40 | echo '83cc2463a4080efd46a72ba2c9f6b8f5 automake-1.16.1.tar.gz'|md5sum --check - || \ 41 | { \ 42 | mv automake-1.16.1.tar.gz automake-1.16.1.bad.tar.gz &&\ 43 | echo "Bad automake md5 sum"; false;\ 44 | } 45 | 46 | 47 | ifeq ($(AUTOMAKE_MIN),FAIL) 48 | automake_install: |\ 49 | $(HOME)/.bitcoin_envs\ 50 | autoconf_install \ 51 | automake-1.16.1.tar.gz 52 | tar xzf automake-1.16.1.tar.gz 53 | cd automake-1.16.1 && { \ 54 | PERL=/usr/bin/perl ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE) && $(MAKE) install && echo "The automake was installed - OK"; \ 55 | } &> make_out.txt && tail make_out.txt 56 | @touch $@ 57 | else 58 | automake_install: |\ 59 | $(HOME)/.bitcoin_envs\ 60 | autoconf_install 61 | @touch $@ 62 | endif 63 | 64 | ##################################### 65 | 66 | # libtool 67 | libtool-2.4.6.tar.gz: 68 | $(WGET) 'ftp://ftp.gnu.org/gnu/libtool/libtool-2.4.6.tar.gz' 69 | echo 'addf44b646ddb4e3919805aa88fa7c5e libtool-2.4.6.tar.gz'|md5sum --check - || \ 70 | { \ 71 | mv libtool-2.4.6.tar.gz libtool-2.4.6.bad.tar.gz &&\ 72 | echo "Bad libtool md5 sum"; false;\ 73 | } 74 | 75 | ifeq ($(LIBTOOL_MIN),FAIL) 76 | libtool_install: |\ 77 | $(HOME)/.bitcoin_envs\ 78 | libtool-2.4.6.tar.gz 79 | tar xzf libtool-2.4.6.tar.gz 80 | cd libtool-2.4.6 && { \ 81 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "Libtool was installed - OK"; \ 82 | } &> make_out.txt && tail make_out.txt 83 | @touch $@ 84 | else 85 | libtool_install: |\ 86 | $(HOME)/.bitcoin_envs 87 | @touch $@ 88 | endif 89 | 90 | #################################### 91 | 92 | ifeq ($(PKG_CONFIG_MIN),FAIL) 93 | pkg-config_install: |\ 94 | $(HOME)/.bitcoin_envs\ 95 | autotools_install 96 | cd external/pkg-config && { \ 97 | ./autogen.sh --with-internal-glib --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "pkg-config was installed - OK"; \ 98 | } &> make_out.txt && tail make_out.txt 99 | @touch $@ 100 | else 101 | pkg-config_install: |\ 102 | $(HOME)/.bitcoin_envs\ 103 | autotools_install 104 | @touch $@ 105 | endif 106 | 107 | ################################### 108 | 109 | # m4 110 | m4-1.4.18.tar.gz: 111 | $(WGET) 'http://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz' 112 | echo 'a077779db287adf4e12a035029002d28 m4-1.4.18.tar.gz'|md5sum --check - || \ 113 | { \ 114 | mv m4-1.4.18.tar.gz m4-1.4.18.bad.tar.gz &&\ 115 | echo "Bad m4 md5 sum"; false;\ 116 | } 117 | 118 | 119 | ifeq ($(M4_MIN),FAIL) 120 | m4_install: |\ 121 | $(HOME)/.bitcoin_envs\ 122 | m4-1.4.18.tar.gz 123 | tar xzf m4-1.4.18.tar.gz 124 | cd m4-1.4.18 && { \ 125 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The m4 was installed - OK"; \ 126 | } &> make_out.txt && tail make_out.txt 127 | @touch $@ 128 | else 129 | m4_install: |\ 130 | $(HOME)/.bitcoin_envs 131 | @touch $@ 132 | endif 133 | -------------------------------------------------------------------------------- /mk/binutils.mk: -------------------------------------------------------------------------------- 1 | binutils-2.37.tar.gz: 2 | gpg --keyserver keyserver.ubuntu.com --recv-key DD9E3C4F 3 | $(WGET) 'https://ftp.gnu.org/gnu/binutils/$@' && $(WGET) 'https://ftp.gnu.org/gnu/binutils/$@.sig' &&\ 4 | gpg $@.sig || { echo "Bad sign of $@"; false; } 5 | 6 | ifeq ($(BINUTILS_MIN),FAIL) 7 | binutils_install: |\ 8 | required_for_configure_install\ 9 | binutils-2.37.tar.gz 10 | tar xzf binutils-2.37.tar.gz 11 | cd binutils-2.37 && { \ 12 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The bintuils was installed - OK"; \ 13 | } &> make_out.txt && tail make_out.txt 14 | @touch $@ 15 | else 16 | binutils_install: |\ 17 | required_for_configure_install 18 | @touch $@ 19 | endif 20 | -------------------------------------------------------------------------------- /mk/bitcoind.mk: -------------------------------------------------------------------------------- 1 | bitcoin-core_install: |\ 2 | required_for_configure_install\ 3 | gcc_install_11_2_0_min\ 4 | binutils_install\ 5 | boost_install\ 6 | openssl_install\ 7 | libevent_install\ 8 | zlib_install\ 9 | zeromq_install\ 10 | python39_install\ 11 | miniupnpc_install 12 | cd external/bitcoin-core && git checkout -f && git clean -fdx && { \ 13 | ./autogen.sh && \ 14 | ./configure LIBS=-lrt --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) --with-incompatible-bdb --disable-wallet --without-gui --with-boost=$(BASE_INSTALL_DIR) --with-boost-libdir=$(BASE_INSTALL_DIR)/lib && $(MAKE) -j4 && $(MAKE) install && echo "The bitcoin-core was installed - OK"; \ 15 | } &> make_out.txt && tail make_out.txt 16 | @touch $@ 17 | 18 | MAKE_DIRS += $(CREDENTIALS_DIR) 19 | 20 | $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt\ 21 | $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt: |\ 22 | bitcoin-core_install\ 23 | $(CREDENTIALS_DIR) 24 | cd external/bitcoin-core && umask 077 && LANG=C ./share/rpcauth/rpcauth.py lnd >$@ 25 | 26 | prepare-bitcoin-core-update: this_repo_update 27 | -rm -f bitcoin-core_install zeromq_install openssl_install libevent_install binutils_install boost_install 28 | 29 | bitcoin-core-update: 30 | $(MAKE) bitcoin-core_install 31 | 32 | bitcoin_iptables_install: 33 | if [ `grep -c -- '-dport 8333' /etc/sysconfig/iptables` -le 0 ]; then \ 34 | sed -ri -e 's#^.*--reject-with tcp-reset#-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 8333 -j ACCEPT\n&#' /etc/sysconfig/iptables; \ 35 | fi 36 | $(reloadIPTables) 37 | @touch $@ 38 | 39 | ####################### CONFIGS ################################### 40 | 41 | MAKE_DIRS += build/bitcoind 42 | MAKE_DIRS += $(HOME)/.bitcoin 43 | 44 | $(HOME)/.bitcoin/bitcoin-testnet.conf: build/bitcoind/bitcoin-testnet.conf | $(HOME)/.bitcoin 45 | umask 077 && \ 46 | if [ -f $@ ]; then \ 47 | cp -f $< $@.new.conf && \ 48 | touch $@; \ 49 | else \ 50 | cp -f $< $@; \ 51 | fi 52 | 53 | $(HOME)/.bitcoin/bitcoin-mainnet.conf: build/bitcoind/bitcoin-mainnet.conf | $(HOME)/.bitcoin 54 | umask 077 && \ 55 | if [ -f $@ ]; then \ 56 | cp -f $< $@.new.conf && \ 57 | touch $@; \ 58 | else \ 59 | cp -f $< $@; \ 60 | fi 61 | 62 | build/bitcoind/bitcoin-testnet.conf :\ 63 | $(NETWORK_MK_FILE)\ 64 | configs/bitcoind/bitcoin-testnet.conf\ 65 | $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt\ 66 | |\ 67 | build/bitcoind 68 | cp -f configs/bitcoind/bitcoin-testnet.conf $@ &&\ 69 | LND_RPC_PASS=`awk '/String to be appended to bitcoin.conf:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt` && \ 70 | sed -ri \ 71 | -e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \ 72 | -e 's#\$$\$$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET\$$\$$#$(BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_TESTNET)#g' \ 73 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 74 | -e 's#\$$\$$LND_RPC_PASS\$$\$$#'$$LND_RPC_PASS'#g' \ 75 | $@ 76 | 77 | 78 | build/bitcoind/bitcoin-mainnet.conf :\ 79 | $(NETWORK_MK_FILE)\ 80 | configs/bitcoind/bitcoin-mainnet.conf\ 81 | $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt\ 82 | |\ 83 | build/bitcoind 84 | cp -f configs/bitcoind/bitcoin-mainnet.conf $@ &&\ 85 | LND_RPC_PASS=`awk '/String to be appended to bitcoin.conf:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt` && \ 86 | sed -ri \ 87 | -e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \ 88 | -e 's#\$$\$$BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET\$$\$$#$(BITCOIN_KIT_BITCOIND_CONFIG_EXTERNALIP_MAINNET)#g' \ 89 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 90 | -e 's#\$$\$$LND_RPC_PASS\$$\$$#'$$LND_RPC_PASS'#g' \ 91 | $@ 92 | 93 | bitcoind_configs_install: |\ 94 | $(HOME)/.bitcoin/bitcoin-testnet.conf\ 95 | $(HOME)/.bitcoin/bitcoin-mainnet.conf 96 | @touch $@ 97 | 98 | MAKE_DIRS += build/bin/bitcoind 99 | 100 | build/bin/bitcoind/mainnet-bitcoind-start: \ 101 | $(NETWORK_MK_FILE)\ 102 | configs/bin/bitcoind/mainnet-bitcoind-start\ 103 | |\ 104 | bitcoin-core_install\ 105 | bitcoind_configs_install\ 106 | build/bin/bitcoind 107 | cp -f configs/bin/bitcoind/mainnet-bitcoind-start $@ && \ 108 | sed -ri \ 109 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 110 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 111 | chmod 755 $@ 112 | 113 | build/bin/bitcoind/testnet-bitcoind-start: \ 114 | $(NETWORK_MK_FILE)\ 115 | configs/bin/bitcoind/testnet-bitcoind-start\ 116 | |\ 117 | bitcoin-core_install\ 118 | bitcoind_configs_install\ 119 | build/bin/bitcoind 120 | cp -f configs/bin/bitcoind/testnet-bitcoind-start $@ && \ 121 | sed -ri \ 122 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 123 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 124 | chmod 755 $@ 125 | 126 | build/bin/bitcoind/mainnet-bitcoind-stop: \ 127 | $(NETWORK_MK_FILE)\ 128 | configs/bin/bitcoind/mainnet-bitcoind-stop\ 129 | |\ 130 | bitcoin-core_install\ 131 | bitcoind_configs_install\ 132 | build/bin/bitcoind 133 | cp -f configs/bin/bitcoind/mainnet-bitcoind-stop $@ && \ 134 | sed -ri \ 135 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 136 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 137 | chmod 755 $@ 138 | 139 | build/bin/bitcoind/testnet-bitcoind-stop: \ 140 | $(NETWORK_MK_FILE)\ 141 | configs/bin/bitcoind/testnet-bitcoind-stop\ 142 | |\ 143 | bitcoin-core_install\ 144 | bitcoind_configs_install\ 145 | build/bin/bitcoind 146 | cp -f configs/bin/bitcoind/testnet-bitcoind-stop $@ && \ 147 | sed -ri \ 148 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 149 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 150 | chmod 755 $@ 151 | 152 | $(HOME)/bin/mainnet-bitcoind-start: build/bin/bitcoind/mainnet-bitcoind-start | miniupnpc_install $(HOME)/bin 153 | umask 077 && cp -f $< $@ 154 | 155 | $(HOME)/bin/testnet-bitcoind-start: build/bin/bitcoind/testnet-bitcoind-start | miniupnpc_install $(HOME)/bin 156 | umask 077 && cp -f $< $@ 157 | 158 | $(HOME)/bin/mainnet-bitcoind-stop: build/bin/bitcoind/mainnet-bitcoind-stop | miniupnpc_install $(HOME)/bin 159 | umask 077 && cp -f $< $@ 160 | 161 | $(HOME)/bin/testnet-bitcoind-stop: build/bin/bitcoind/testnet-bitcoind-stop | miniupnpc_install $(HOME)/bin 162 | umask 077 && cp -f $< $@ 163 | -------------------------------------------------------------------------------- /mk/cmake.mk: -------------------------------------------------------------------------------- 1 | cmake-3.17.3.tar.gz: 2 | $(WGET) 'https://github.com/Kitware/CMake/releases/download/v3.17.3/cmake-3.17.3.tar.gz' 3 | echo 'd47f23a9781b68014e77717f8e291bb7 cmake-3.17.3.tar.gz'|md5sum --check - || \ 4 | { \ 5 | mv cmake-3.17.3.tar.gz cmake-3.17.3.bad.tar.gz &&\ 6 | echo "Bad cmake md5 sum"; false;\ 7 | } 8 | 9 | cmake_install: |\ 10 | required_for_configure_install\ 11 | binutils_install\ 12 | cmake-3.17.3.tar.gz 13 | tar xzf cmake-3.17.3.tar.gz 14 | cd cmake-3.17.3 && { \ 15 | ./bootstrap --parallel=4 --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "The cmake was installed - OK"; \ 16 | } &> make_out.txt && tail make_out.txt 17 | @touch $@ 18 | 19 | make-4.3.tar.gz: 20 | $(WGET) 'http://ftp.gnu.org/gnu/make/$@' &&\ 21 | echo 'e05fdde47c5f7ca45cb697e973894ff4f5d79e13b750ed57d7b66d8defc78e19 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 22 | 23 | 24 | gmake_install: |\ 25 | required_for_configure_install\ 26 | make-4.3.tar.gz 27 | tar xzf make-4.3.tar.gz 28 | cd make-4.3 && { \ 29 | ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "The gmake was installed - OK" && ln -s $(BASE_INSTALL_DIR)/bin/make $(BASE_INSTALL_DIR)/bin/gmake; \ 30 | } &> make_out.txt && tail make_out.txt 31 | @touch $@ 32 | -------------------------------------------------------------------------------- /mk/common.mk: -------------------------------------------------------------------------------- 1 | # ~/.bash_profile of .profile patch... 2 | $(HOME)/.bitcoin_envs: bitcoin_envs.sh 3 | cp -f $< $@ 4 | if [ "x`grep '$(HOME)/.bitcoin_envs' $(PROFILE_FILE)`" = "x" ]; then echo $$'\n. $(HOME)/.bitcoin_envs' >> $(PROFILE_FILE); fi 5 | 6 | # ~/.bash_profile of .profile patch... 7 | $(HOME)/.bitcoin_aliases: configs/aliases.sh 8 | cp -f $< $@ 9 | if [ "x`grep '$(HOME)/.bitcoin_aliases' $(BASHRC_FILE)`" = "x" ]; then echo $$'\n. $(HOME)/.bitcoin_aliases' >> $(BASHRC_FILE); fi 10 | 11 | git_submodule_install: .gitmodules 12 | git submodule deinit -f --all 13 | git submodule update --init --recursive 14 | @touch $@ 15 | 16 | this_repo_update: 17 | git pull 18 | git submodule deinit -f --all 19 | git submodule foreach --recursive 'git reset --hard HEAD && git clean -fdx' 20 | git submodule sync --recursive 21 | git submodule update --init --recursive --force 22 | git clean -fd && git clean -fd 23 | 24 | .PHONY: this_repo_update 25 | 26 | MAKE_DIRS += $(HOME)/bin 27 | 28 | required_for_configure_install: |\ 29 | $(HOME)/.bitcoin_envs\ 30 | autotools_install\ 31 | autoconf_install\ 32 | pkg-config_install 33 | @touch $@ 34 | 35 | clean: 36 | rm -rf build network_* 37 | 38 | GENERATE_PASSWORD = $(shell cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w $(1) | head -n 1) 39 | -------------------------------------------------------------------------------- /mk/electrumx.mk: -------------------------------------------------------------------------------- 1 | # The ElectrumX now uses the BitcoinSV as main blockchain (v0.15.0) but the Bitcoin was moved to "altcoin" branch (It's about killing a project in one day.) 2 | # So i decided to stopped to support it and will add other Electrum server to this repo 3 | # P.S. I added this server some years ago before Segwit fork... 4 | electrumx_related_pips_install: | python39_install 5 | pip3 install aiohttp cchardet aiodns pylru plyvel x11_hash 6 | @touch $@ 7 | 8 | MAKE_DIRS += $(HOME)/.electrumx 9 | 10 | electrumx_install: | electrumx_related_pips_install $(HOME)/.electrumx 11 | git clone 'https://github.com/kyuupichan/electrumx.git' 12 | cd electrumx && git checkout 1.15.0 && { \ 13 | python3 setup.py install && echo "ElectrumX was installed - OK"; \ 14 | } &> make_out.txt && tail make_out.txt 15 | @touch $@ 16 | 17 | MAKE_DIRS += build/electrumx 18 | MAKE_DIRS += build/electrumx/ssl 19 | MAKE_DIRS += $(HOME)/.electrumx/ssl 20 | 21 | electrumx_certs_install: |\ 22 | openssl_install\ 23 | build/electrumx/ssl\ 24 | $(HOME)/.electrumx/ssl 25 | cd build/electrumx/ssl && \ 26 | openssl ecparam -genkey -name prime256v1 -out tls.key && \ 27 | openssl req -new -sha256 -key tls.key -out csr.csr -subj '/CN=localhost/O=electrumx' && \ 28 | openssl req -x509 -sha256 -days 36500 -key tls.key -in csr.csr -out tls.cert && \ 29 | rm csr.csr && \ 30 | cp -f * $(HOME)/.electrumx/ssl 31 | @touch $@ 32 | 33 | build/electrumx/env.sh: \ 34 | $(NETWORK_MK_FILE)\ 35 | configs/electrumx/env.sh\ 36 | |\ 37 | build/electrumx 38 | -------------------------------------------------------------------------------- /mk/finally.mk: -------------------------------------------------------------------------------- 1 | # To make here directories 2 | $(MAKE_DIRS) : 3 | mkdir -p $@ 4 | -------------------------------------------------------------------------------- /mk/gcc.mk: -------------------------------------------------------------------------------- 1 | ifeq ($(GCC_MIN),FAIL) 2 | gcc_install_11_2_0_min: |\ 3 | $(HOME)/.bitcoin_envs\ 4 | autotools_install\ 5 | gmp_6_1_2_install\ 6 | mpfr_4_1_0_install\ 7 | mpc_1_1_0_install\ 8 | isl_0_18_install\ 9 | gcc-11.2.0.tar.gz 10 | tar xvzf gcc-11.2.0.tar.gz 11 | cd gcc-11.2.0 && { \ 12 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) --disable-multilib && $(MAKE_COMPILE) && $(MAKE) install && echo "The gcc was installed - OK"; \ 13 | } &> make_out.txt && tail make_out.txt 14 | -rm -f $(BASE_INSTALL_DIR)/bin/cc 15 | ln -s $(BASE_INSTALL_DIR)/bin/gcc $(BASE_INSTALL_DIR)/bin/cc 16 | @touch $@ 17 | else 18 | gcc_install_11_2_0_min: |\ 19 | $(HOME)/.bitcoin_envs\ 20 | autotools_install\ 21 | gmp_6_1_2_install\ 22 | mpfr_4_1_0_install\ 23 | mpc_1_1_0_install\ 24 | isl_0_18_install 25 | @touch $@ 26 | endif 27 | 28 | # gcc 29 | gcc-11.2.0.tar.gz: 30 | $(WGET) http://ftp.gnu.org/gnu/gcc/gcc-11.2.0/$@ 31 | echo 'dc6886bd44bb49e2d3d662aed9729278 $@'|md5sum --check - || \ 32 | { \ 33 | mv $@ $@.bad.tar.gz &&\ 34 | echo "Bad gcc md5 sum"; false;\ 35 | } 36 | 37 | # gmp 38 | gmp-6.1.2.tar.bz2: 39 | $(WGET) 'https://gmplib.org/download/gmp/gmp-6.1.2.tar.bz2' 40 | echo '8ddbb26dc3bd4e2302984debba1406a5 gmp-6.1.2.tar.bz2'|md5sum --check - || \ 41 | { \ 42 | mv gmp-6.1.2.tar.bz2 gmp-6.1.2.bad.tar.bz2 &&\ 43 | echo "Bad gmp md5 sum"; false;\ 44 | } 45 | 46 | ifeq ($(GCC_MIN),FAIL) 47 | gmp_6_1_2_install: |\ 48 | $(HOME)/.bitcoin_envs\ 49 | autotools_install\ 50 | gmp-6.1.2.tar.bz2 51 | bzip2 -cd gmp-6.1.2.tar.bz2|tar xvf - 52 | cd gmp-6.1.2 && { \ 53 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) check && $(MAKE) install && echo "The gmp was installed - OK"; \ 54 | } &> make_out.txt && tail make_out.txt 55 | @touch $@ 56 | else 57 | gmp_6_1_2_install: |\ 58 | $(HOME)/.bitcoin_envs 59 | @touch $@ 60 | endif 61 | 62 | # mpfr 63 | mpfr-4.1.0.tar.gz: 64 | $(WGET) https://www.mpfr.org/mpfr-4.1.0/$@ 65 | echo '81a97a9ba03590f83a30d26d4400ce39 $@'|md5sum --check - || \ 66 | { \ 67 | mv $@ $@.bad.tar.gz &&\ 68 | echo "Bad mpfr md5 sum"; false;\ 69 | } 70 | 71 | ifeq ($(GCC_MIN),FAIL) 72 | mpfr_4_1_0_install: |\ 73 | $(HOME)/.bitcoin_envs\ 74 | gmp_6_1_2_install\ 75 | autotools_install\ 76 | mpfr-4.1.0.tar.gz 77 | tar xvzf mpfr-4.1.0.tar.gz 78 | cd mpfr-4.1.0 && { \ 79 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The mpfr was installed - OK"; \ 80 | } &> make_out.txt && tail make_out.txt 81 | @touch $@ 82 | else 83 | mpfr_4_1_0_install: |\ 84 | $(HOME)/.bitcoin_envs 85 | @touch $@ 86 | endif 87 | 88 | # mpc 89 | mpc-1.1.0.tar.gz: 90 | $(WGET) ftp://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz 91 | echo '4125404e41e482ec68282a2e687f6c73 mpc-1.1.0.tar.gz'|md5sum --check - || \ 92 | { \ 93 | mv mpc-1.1.0.tar.gz mpc-1.1.0.bad.tar.gz &&\ 94 | echo "Bad mpc md5 sum"; false;\ 95 | } 96 | 97 | ifeq ($(GCC_MIN),FAIL) 98 | mpc_1_1_0_install: |\ 99 | $(HOME)/.bitcoin_envs\ 100 | gmp_6_1_2_install\ 101 | mpfr_4_1_0_install\ 102 | autotools_install\ 103 | mpc-1.1.0.tar.gz 104 | tar xzf mpc-1.1.0.tar.gz 105 | cd mpc-1.1.0 && { \ 106 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The mpc was installed - OK"; \ 107 | } &> make_out.txt && tail make_out.txt 108 | @touch $@ 109 | else 110 | mpc_1_1_0_install: |\ 111 | $(HOME)/.bitcoin_envs 112 | @touch $@ 113 | endif 114 | 115 | # mpc 116 | isl-0.18.tar.gz: 117 | $(WGET) https://versaweb.dl.sourceforge.net/project/libisl/isl-0.18.tar.gz 118 | echo '076c69f81067f2f5b908c099f445a338 isl-0.18.tar.gz'|md5sum --check - || \ 119 | { \ 120 | mv isl-0.18.tar.gz isl-0.18.bad.tar.gz &&\ 121 | echo "Bad isl md5 sum"; false;\ 122 | } 123 | 124 | ifeq ($(GCC_MIN),FAIL) 125 | isl_0_18_install: |\ 126 | $(HOME)/.bitcoin_envs\ 127 | autotools_install\ 128 | isl-0.18.tar.gz 129 | tar xzf isl-0.18.tar.gz 130 | cd isl-0.18 && { \ 131 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The isl was installed - OK"; \ 132 | } &> make_out.txt && tail make_out.txt 133 | @touch $@ 134 | else 135 | isl_0_18_install: |\ 136 | $(HOME)/.bitcoin_envs 137 | @touch $@ 138 | endif 139 | -------------------------------------------------------------------------------- /mk/git.mk: -------------------------------------------------------------------------------- 1 | new_git_install: |\ 2 | required_for_configure_install\ 3 | new_curl_install\ 4 | git-2.20.1.tar.gz 5 | tar xvzf git-2.20.1.tar.gz 6 | cd git-2.20.1 && $(MAKE) configure && ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) all && $(MAKE) install 7 | @touch $@ 8 | 9 | curl-7.63.0.tar.gz: 10 | $(WGET) 'https://curl.haxx.se/download/curl-7.63.0.tar.gz' 11 | echo '6121427a7199cd6094fc48c9e31e8992 curl-7.63.0.tar.gz'|md5sum --check - || \ 12 | { \ 13 | mv curl-7.63.0.tar.gz curl-7.63.0.bad.tar.gz &&\ 14 | echo "Bad curl md5 sum"; false;\ 15 | } 16 | 17 | new_curl_install: |\ 18 | required_for_configure_install\ 19 | curl-7.63.0.tar.gz 20 | tar xzf curl-7.63.0.tar.gz 21 | cd curl-7.63.0 && { \ 22 | ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "Curl was installed - OK"; \ 23 | } &> make_out.txt && tail make_out.txt 24 | @touch $@ 25 | 26 | git-2.20.1.tar.gz: 27 | $(WGET) 'https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.20.1.tar.gz' 28 | echo '7a7769e5c957364ed0aed89e6e67c254 git-2.20.1.tar.gz'|md5sum --check - || \ 29 | { \ 30 | mv git-2.20.1.tar.gz git-2.20.1.bad.tar.gz &&\ 31 | echo "Bad curl md5 sum"; false;\ 32 | } 33 | -------------------------------------------------------------------------------- /mk/golang.mk: -------------------------------------------------------------------------------- 1 | # https://lore.kernel.org/buildroot/CA+h8R2rtcynkCBsz=_9yANOEguyPCOcQDj8_ns+cv8RS8+8t9A@mail.gmail.com/T/ 2 | # New 1.22.3 requires 4-stage process :( 3 | 4 | GOLANG_VER_STAGE_1 := 1.4 5 | GOLANG_VER_STAGE_2 := 1.19.5 6 | GOLANG_VER_STAGE_3 := 1.20.3 7 | GOLANG_VER_STAGE_4 := $(GOLANG_VER) 8 | 9 | GOLANG_TARGET_STAGE_2 := $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_2)/bin/go 10 | GOLANG_TARGET_STAGE_3 := $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_3)/bin/go 11 | 12 | golang_pre_install_$(GOLANG_VER_STAGE_1): |\ 13 | required_for_configure_install\ 14 | binutils_install\ 15 | new_git_install\ 16 | $(HOME)/.golang_envs 17 | -rm -rf $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) 18 | cd $(BASE_INSTALL_DIR) && git clone -b release-branch.go$(GOLANG_VER_STAGE_1) 'https://go.googlesource.com/go' go$(GOLANG_VER_STAGE_1) && cd go$(GOLANG_VER_STAGE_1)/src && ./make.bash 19 | @touch $@ 20 | 21 | $(GOLANG_TARGET_STAGE_2): | golang_pre_install_$(GOLANG_VER_STAGE_1) 22 | cd $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) && git fetch origin 23 | -rm -rf $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_2) 24 | cd $(BASE_INSTALL_DIR) && git clone --local $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) go$(GOLANG_VER_STAGE_2) && cd go$(GOLANG_VER_STAGE_2) && git checkout go$(GOLANG_VER_STAGE_2) && cd src && ulimit -u `ulimit -H -u` && GOROOT_BOOTSTRAP=$(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) ./make.bash 25 | 26 | $(GOLANG_TARGET_STAGE_3): | $(GOLANG_TARGET_STAGE_2) 27 | cd $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) && git fetch origin 28 | -rm -rf $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_3) 29 | cd $(BASE_INSTALL_DIR) && git clone --local $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) go$(GOLANG_VER_STAGE_3) && cd go$(GOLANG_VER_STAGE_3) && git checkout go$(GOLANG_VER_STAGE_3) && cd src && ulimit -u `ulimit -H -u` && GOROOT_BOOTSTRAP=$(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_2) ./make.bash 30 | 31 | $(CURRENT_GOLANG_TARGET): | $(GOLANG_TARGET_STAGE_3) 32 | cd $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) && git fetch origin 33 | -rm -rf $(BASE_INSTALL_DIR)/go$(GOLANG_VER) 34 | cd $(BASE_INSTALL_DIR) && git clone --local $(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_1) go$(GOLANG_VER) && cd go$(GOLANG_VER) && git checkout go$(GOLANG_VER) && cd src && ulimit -u `ulimit -H -u` && GOROOT_BOOTSTRAP=$(BASE_INSTALL_DIR)/go$(GOLANG_VER_STAGE_3) ./make.bash 35 | 36 | golang_envs-$(GOLANG_VER).sh: golang_envs.sh 37 | cp -f $< $@ 38 | sed -ri -e 's#\$$\$$GOLANG_VER\$$\$$#$(GOLANG_VER)#g' $@ 39 | sed -ri -e 's#\$$\$$GOLANG_VER_STAGE_2\$$\$$#$(GOLANG_VER_STAGE_2)#g' $@ 40 | sed -ri -e 's#\$$\$$GOLANG_VER_STAGE_3\$$\$$#$(GOLANG_VER_STAGE_3)#g' $@ 41 | mkdir -p $(BASE_INSTALL_DIR)/go 42 | 43 | # ~/.bash_profile patch... 44 | $(HOME)/.golang_envs: golang_envs-$(GOLANG_VER).sh 45 | cp -f $< $@ 46 | # This is a fix for multiple duplication of rows from previous updates 47 | grep -v '. $(HOME)/.golang_envs' $(PROFILE_FILE) >$(PROFILE_FILE).$$$$.~ &&\ 48 | echo $$'\n. $(HOME)/.golang_envs' >> $(PROFILE_FILE).$$$$.~ &&\ 49 | cat $(PROFILE_FILE).$$$$.~ >$(PROFILE_FILE) && rm -f $(PROFILE_FILE).$$$$.~ 50 | -------------------------------------------------------------------------------- /mk/i-want-lightning.mk: -------------------------------------------------------------------------------- 1 | i-want-lightning: |\ 2 | bitcoin-core_install\ 3 | lnd_install\ 4 | bitcoind_configs_install\ 5 | lnd_configs_bitcoind_bundle_install 6 | @touch $@ 7 | 8 | set-up-lightning: |\ 9 | i-want-lightning\ 10 | $(HOME)/bin/$(BITCOIN_NETWORK)-bitcoind-start\ 11 | $(HOME)/bin/$(BITCOIN_NETWORK)-bitcoind-stop\ 12 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-start\ 13 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-debug-start\ 14 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-stop\ 15 | $(HOME)/bin/$(BITCOIN_NETWORK)-lightning-start\ 16 | $(HOME)/bin/$(BITCOIN_NETWORK)-lightning-stop\ 17 | $(HOME)/.bitcoin_aliases\ 18 | $(HOME)/.lnd/tls.cert\ 19 | $(HOME)/.lnd/tls.key\ 20 | $(HOME)/.lnd/data/chain/bitcoin/$(BITCOIN_NETWORK)/wallet.db\ 21 | $(HOME)/.lnd/data/chain/bitcoin/$(BITCOIN_NETWORK)/admin.macaroon 22 | 23 | $(HOME)/.lnd/tls.cert $(HOME)/.lnd/tls.key: | $(HOME)/.lnd/data/chain/bitcoin/$(BITCOIN_NETWORK)/wallet.db 24 | 25 | $(HOME)/bin/$(BITCOIN_NETWORK)-lightning-start: configs/bin/lightning/$(BITCOIN_NETWORK)-lightning-start | \ 26 | $(HOME)/bin\ 27 | $(HOME)/bin/$(BITCOIN_NETWORK)-bitcoind-start\ 28 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-start\ 29 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-debug-start 30 | cp -f $< $@ && chmod 755 $@ 31 | 32 | $(HOME)/bin/$(BITCOIN_NETWORK)-lightning-stop: configs/bin/lightning/$(BITCOIN_NETWORK)-lightning-stop | \ 33 | $(HOME)/bin\ 34 | $(HOME)/bin/$(BITCOIN_NETWORK)-bitcoind-stop\ 35 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-stop 36 | cp -f $< $@ && chmod 755 $@ 37 | 38 | export BITCOIN_KIT_LOCAL_IP PUBLIC_IP_ADDRESS 39 | 40 | set-up-lightning-testnet: 41 | $(MAKE) set-up-lightning BITCOIN_NETWORK=testnet 42 | 43 | set-up-lightning-mainnet: 44 | $(MAKE) set-up-lightning BITCOIN_NETWORK=mainnet 45 | 46 | unexport 47 | -------------------------------------------------------------------------------- /mk/inotify.mk: -------------------------------------------------------------------------------- 1 | inotify_install: |\ 2 | required_for_configure_install 3 | cd external/inotify-tools && { \ 4 | ./autogen.sh && ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "inotify-tools was installed - OK"; \ 5 | } &> make_out.txt && tail make_out.txt 6 | @touch $@ 7 | -------------------------------------------------------------------------------- /mk/iptables.mk: -------------------------------------------------------------------------------- 1 | define reloadIPTables 2 | @ echo -n $$'***************************************************************\n***************************************************************\n\nPress now enter and then press enter too (firewall settings)'; read waiting 3 | @ { sleep 60 && service iptables stop >/dev/null & } &> /dev/null;\ 4 | service iptables restart; backgroup_pid=$$! ; strstr() { [ "$${1#*$$2*}" = "$$1" ] && return 1; return 0; }; \ 5 | echo -n "To kill sleep ? (Y)es/(N)o [Y] "; read answer; echo $$answer; \ 6 | if strstr $$"yY" "$$answer" || [ "$$answer" = "" ] ; then kill $$backgroup_pid; echo "All is OK" ; else echo 'ATTENTION! Firewall will be flushed!' ; fi 7 | endef 8 | 9 | iptables_install: /etc/sysconfig/iptables reload_iptables startup_iptables 10 | echo $$'If you see this message through ssh - your network works fine ;-)' 11 | 12 | /etc/sysconfig/iptables: 13 | cat iptables.template >$@ 14 | 15 | reload_iptables : 16 | $(reloadIPTables) 17 | @touch $@ 18 | 19 | startup_iptables : 20 | chkconfig iptables reset 21 | service iptables start 22 | @touch $@ 23 | 24 | -------------------------------------------------------------------------------- /mk/libs.mk: -------------------------------------------------------------------------------- 1 | # $(MAKE) test was failed - test/recipes/90-test_shlibload.t It's test for perl shared loading - i skip here $(MAKE) test 2 | openssl_install: |\ 3 | required_for_configure_install 4 | cd external/openssl && { \ 5 | $(MAKE) clean; ./config --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "OpenSSL was installed - OK"; \ 6 | } &> make_out.txt && tail make_out.txt 7 | @touch $@ 8 | 9 | boost_install: |\ 10 | required_for_configure_install 11 | cd external/boost && { \ 12 | ./bootstrap.sh --prefix=$(BASE_INSTALL_DIR) && ./b2 install; \ 13 | if [ -d $(BASE_INSTALL_DIR)/include/boost -a `ls -1 $(BASE_INSTALL_DIR)/lib/libboost_*|wc -l` -gt 0 ]; then echo "Boost was installed - OK"; else false; fi \ 14 | } &> make_out.txt && tail make_out.txt 15 | @touch $@ 16 | 17 | libevent_install: |\ 18 | required_for_configure_install 19 | cd external/libevent && { \ 20 | $(MAKE) clean; ./autogen.sh && ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "Libevent was installed - OK"; \ 21 | } &> make_out.txt && tail make_out.txt 22 | @touch $@ 23 | 24 | zlib-1.2.13.tar.gz: 25 | $(WGET) 'https://github.com/madler/zlib/releases/download/v1.2.13/$@' &&\ 26 | echo 'b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 27 | 28 | zlib_install: |\ 29 | required_for_configure_install\ 30 | zlib-1.2.13.tar.gz 31 | tar xzf zlib-1.2.13.tar.gz 32 | cd zlib-1.2.13 && { \ 33 | ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) test && $(MAKE) install && echo "The zlib was installed - OK"; \ 34 | } &> make_out.txt && tail make_out.txt 35 | @touch $@ 36 | 37 | glibc-2.34.tar.gz: 38 | $(WGET) 'http://ftp.gnu.org/gnu/glibc/$@' &&\ 39 | echo '255b7632746b5fdd478cb7b36bebd1ec1f92c2b552ee364c940f48eb38d07f62 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 40 | 41 | glibc_install: |\ 42 | required_for_configure_install\ 43 | bison_install\ 44 | gmake_install\ 45 | glibc-2.34.tar.gz 46 | tar xzf glibc-2.34.tar.gz 47 | cd glibc-2.34 && { \ 48 | rm -rf build; mkdir build && cd build && \ 49 | ../configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) test && $(MAKE) install && echo "The glib was installed - OK"; \ 50 | } &> make_out.txt && tail make_out.txt 51 | @touch $@ 52 | 53 | 54 | bison-3.8.tar.gz: 55 | $(WGET) 'http://ftp.gnu.org/gnu/bison/$@' &&\ 56 | echo 'd5d184d421aee15603939973a6b0f372f908edfb24c5bc740697497021ad9458 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 57 | 58 | bison_install: |\ 59 | required_for_configure_install\ 60 | bison-3.8.tar.gz 61 | tar xzf bison-3.8.tar.gz 62 | cd bison-3.8 && { \ 63 | ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "The bison was installed - OK"; \ 64 | } &> make_out.txt && tail make_out.txt 65 | @touch $@ 66 | 67 | basez_1.6.2.orig.tar.gz: 68 | $(WGET) 'http://deb.debian.org/debian/pool/main/b/basez/$@' &&\ 69 | echo '2a9f821488791c2763ef0120c75c43dc83dd16567b7c416f30331889fd598937 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 70 | 71 | # To be needed for base64pem utility for example (tor service configuring) 72 | basez_install: |\ 73 | required_for_configure_install\ 74 | basez_1.6.2.orig.tar.gz 75 | tar xzf basez_1.6.2.orig.tar.gz 76 | cd basez-1.6.2 && { \ 77 | ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "The basez utils were installed - OK"; \ 78 | } &> make_out.txt && tail make_out.txt 79 | @touch $@ 80 | -------------------------------------------------------------------------------- /mk/lncli-web.mk: -------------------------------------------------------------------------------- 1 | MAKE_DIRS += $(HOME)/opt 2 | 3 | LNCLI_WEB_COMMIT := fe7f8879ec48994367866c25daf8be39ca19ca50 4 | 5 | $(HOME)/opt/lncli-web: |\ 6 | $(HOME)/opt 7 | cd $(HOME)/opt && git clone https://github.com/mably/lncli-web.git && cd $(HOME)/opt/lncli-web && git checkout $(LNCLI_WEB_COMMIT) 8 | 9 | lncli-web_install: |\ 10 | nodejs_install\ 11 | openssl_install\ 12 | $(HOME)/opt/lncli-web 13 | cd $(HOME)/opt/lncli-web && { \ 14 | npm install && echo "lncli-web for lnd was installed - OK"; \ 15 | } &> make_out.txt && tail make_out.txt 16 | @touch $@ 17 | 18 | 19 | .PHONY: lncli-web-install 20 | 21 | lncli-web-install: lncli-web_install 22 | @echo "The lncli-web was installed!" 23 | 24 | .PHONY: lncli-web-update 25 | 26 | # git remote set-url ... here is because my first installation was used my repo instead of author's (was fix patch) so it's fix 27 | lncli-web-update: lncli-web_install\ 28 | $(HOME)/bin/mainnet-lncli-web-start\ 29 | $(HOME)/bin/mainnet-lncli-web-stop\ 30 | $(HOME)/bin/testnet-lncli-web-start\ 31 | $(HOME)/bin/testnet-lncli-web-stop 32 | cd $(HOME)/opt/lncli-web && git remote set-url origin https://github.com/mably/lncli-web.git && git checkout $(LNCLI_WEB_COMMIT) && git pull && { \ 33 | npm install && echo "lncli-web for lnd was updated - OK"; \ 34 | } &> make_out.txt && tail make_out.txt 35 | @echo $$'*****************************************************\n\nThe lncli-web was updated to current commit\n\n' &&\ 36 | echo "To run \`mainnet-lncli-web-stop && mainnet-lncli-web-start\` or \`testnet-lncli-web-stop && testnet-lncli-web-start\`" &&\ 37 | echo $$'\n\n*****************************************************' 38 | 39 | MAKE_DIRS += build/lnd/lncli-web 40 | 41 | $(HOME)/opt/lncli-web/lnd.cert: $(HOME)/.lnd/tls.cert | $(HOME)/opt/lncli-web 42 | ln -s $< $@ 43 | 44 | MAKE_DIRS += build/lnd/lncli-web/ssl 45 | 46 | # To make tls keys for lncli-web 47 | $(HOME)/opt/lncli-web/ssl: |\ 48 | $(HOME)/opt/lncli-web\ 49 | build/lnd/lncli-web/ssl 50 | cd build/lnd/lncli-web/ssl && \ 51 | openssl req \ 52 | -x509 \ 53 | -newkey \ 54 | rsa:2048 \ 55 | -keyout key.pem \ 56 | -out cert.pem \ 57 | -days 36500 \ 58 | -nodes \ 59 | -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=$(BITCOIN_KIT_REAL_PUBLIC_IP)" && \ 60 | mkdir -p $@ && mv -f * $@ 61 | 62 | lncli-web_configs_install: |\ 63 | $(HOME)/opt/lncli-web/lnd.cert\ 64 | $(HOME)/opt/lncli-web/ssl 65 | @touch $@ 66 | 67 | $(CREDENTIALS_DIR)/lncli-web-mainnet-passwords.txt: |\ 68 | $(CREDENTIALS_DIR) 69 | @umask 077 && echo $$'URL: https://$(BITCOIN_KIT_LOCAL_IP):8280/\n\nAdmin auth:\nUser: admin\nPassword: $(call GENERATE_PASSWORD,16)\n\nLimited user auth:\nUser: limit\nPassword: $(call GENERATE_PASSWORD,16)' >$@ 70 | 71 | $(CREDENTIALS_DIR)/lncli-web-testnet-passwords.txt: |\ 72 | $(CREDENTIALS_DIR) 73 | @umask 077 && echo $$'URL: https://$(BITCOIN_KIT_LOCAL_IP):8281/\n\nAdmin auth:\nUser: admin\nPassword: $(call GENERATE_PASSWORD,16)\n\nLimited user auth:\nUser: limit\nPassword: $(call GENERATE_PASSWORD,16)' >$@ 74 | 75 | MAKE_DIRS += build/bin/lncli-web 76 | 77 | build/bin/lncli-web/mainnet-lncli-web-start: \ 78 | $(NETWORK_MK_FILE)\ 79 | $(CREDENTIALS_DIR)/lncli-web-mainnet-passwords.txt\ 80 | configs/bin/lncli-web/mainnet-lncli-web-start\ 81 | |\ 82 | build/bin/lncli-web 83 | cp -f configs/bin/lncli-web/mainnet-lncli-web-start $@ &&\ 84 | LNCLI_WEB_MAINNET_ADMIN_PASS=`awk '/User: admin/{getline; print}' $(CREDENTIALS_DIR)/lncli-web-mainnet-passwords.txt|sed -e 's#Password: ##'` && \ 85 | LNCLI_WEB_MAINNET_LIMIT_PASS=`awk '/User: limit/{getline; print}' $(CREDENTIALS_DIR)/lncli-web-mainnet-passwords.txt|sed -e 's#Password: ##'` && \ 86 | sed -ri \ 87 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 88 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 89 | -e 's#\$$\$$LNCLI_WEB_MAINNET_ADMIN_PASS\$$\$$#'$$LNCLI_WEB_MAINNET_ADMIN_PASS'#g' \ 90 | -e 's#\$$\$$LNCLI_WEB_MAINNET_LIMIT_PASS\$$\$$#'$$LNCLI_WEB_MAINNET_LIMIT_PASS'#g' \ 91 | $@ && \ 92 | chmod 755 $@ 93 | 94 | build/bin/lncli-web/testnet-lncli-web-start: \ 95 | $(NETWORK_MK_FILE)\ 96 | $(CREDENTIALS_DIR)/lncli-web-testnet-passwords.txt\ 97 | configs/bin/lncli-web/testnet-lncli-web-start\ 98 | |\ 99 | build/bin/lncli-web 100 | cp -f configs/bin/lncli-web/testnet-lncli-web-start $@ &&\ 101 | LNCLI_WEB_TESTNET_ADMIN_PASS=`awk '/User: admin/{getline; print}' $(CREDENTIALS_DIR)/lncli-web-testnet-passwords.txt|sed -e 's#Password: ##'` && \ 102 | LNCLI_WEB_TESTNET_LIMIT_PASS=`awk '/User: limit/{getline; print}' $(CREDENTIALS_DIR)/lncli-web-testnet-passwords.txt|sed -e 's#Password: ##'` && \ 103 | sed -ri \ 104 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 105 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 106 | -e 's#\$$\$$LNCLI_WEB_TESTNET_ADMIN_PASS\$$\$$#'$$LNCLI_WEB_TESTNET_ADMIN_PASS'#g' \ 107 | -e 's#\$$\$$LNCLI_WEB_TESTNET_LIMIT_PASS\$$\$$#'$$LNCLI_WEB_TESTNET_LIMIT_PASS'#g' \ 108 | $@ && \ 109 | chmod 755 $@ 110 | 111 | build/bin/lncli-web/mainnet-lncli-web-stop: \ 112 | $(NETWORK_MK_FILE)\ 113 | configs/bin/lncli-web/mainnet-lncli-web-stop\ 114 | |\ 115 | build/bin/lncli-web 116 | cp -f configs/bin/lncli-web/mainnet-lncli-web-stop $@ &&\ 117 | sed -ri \ 118 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 119 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 120 | $@ && \ 121 | chmod 755 $@ 122 | 123 | build/bin/lncli-web/testnet-lncli-web-stop: \ 124 | $(NETWORK_MK_FILE)\ 125 | configs/bin/lncli-web/testnet-lncli-web-stop\ 126 | |\ 127 | build/bin/lncli-web 128 | cp -f configs/bin/lncli-web/testnet-lncli-web-stop $@ &&\ 129 | sed -ri \ 130 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 131 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 132 | $@ && \ 133 | chmod 755 $@ 134 | 135 | $(HOME)/bin/mainnet-lncli-web-start: build/bin/lncli-web/mainnet-lncli-web-start | $(HOME)/bin miniupnpc_install $(HOME)/opt/lncli-web/admin-mainnet.macaroon 136 | umask 077 && cp -f $< $@ 137 | 138 | $(HOME)/bin/testnet-lncli-web-start: build/bin/lncli-web/testnet-lncli-web-start | $(HOME)/bin miniupnpc_install $(HOME)/opt/lncli-web/admin-testnet.macaroon 139 | umask 077 && cp -f $< $@ 140 | 141 | $(HOME)/bin/mainnet-lncli-web-stop: build/bin/lncli-web/mainnet-lncli-web-stop | $(HOME)/bin miniupnpc_install 142 | umask 077 && cp -f $< $@ 143 | 144 | $(HOME)/bin/testnet-lncli-web-stop: build/bin/lncli-web/testnet-lncli-web-stop | $(HOME)/bin miniupnpc_install 145 | umask 077 && cp -f $< $@ 146 | -------------------------------------------------------------------------------- /mk/lnd.mk: -------------------------------------------------------------------------------- 1 | lnd_install: |\ 2 | new_git_install\ 3 | $(CURRENT_GOLANG_TARGET)\ 4 | inotify_install 5 | -mkdir -p $$GOPATH/src/github.com/lightningnetwork 6 | -rm -rf $$GOPATH/src/github.com/lightningnetwork/lnd 7 | cd $$GOPATH/src/github.com/lightningnetwork &&\ 8 | git clone https://github.com/lightningnetwork/lnd &&\ 9 | cd lnd &&\ 10 | git fetch -f --tags origin && git checkout $(LND_ACTUAL_COMMIT) &&\ 11 | $(MAKE) && $(MAKE) install tags="autopilotrpc signrpc walletrpc chainrpc invoicesrpc routerrpc watchtowerrpc wtclientrpc monitoring peersrpc" 12 | @touch $@ 13 | 14 | .PHONY: lnd-install 15 | 16 | lnd-install: lnd_install 17 | @echo "LND was installed!" 18 | 19 | .PHONY: lnd-install 20 | 21 | prepare-lnd-update: this_repo_update 22 | -rm -f lnd-bin-update lnd-update 23 | 24 | lnd-update-testnet: 25 | $(MAKE) lnd-update BITCOIN_NETWORK=testnet 26 | 27 | lnd-update-mainnet: 28 | $(MAKE) lnd-update BITCOIN_NETWORK=mainnet 29 | 30 | lnd-update:\ 31 | lnd-bin-update\ 32 | $(HOME)/.bitcoin_aliases\ 33 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-start\ 34 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-debug-start\ 35 | $(HOME)/bin/$(BITCOIN_NETWORK)-lnd-stop 36 | if [[ -f $(HOME)/.testnet-lnd.pid ]]; then\ 37 | kill -0 `cat $(HOME)/.testnet-lnd.pid` &>/dev/null &&\ 38 | echo "You must to stop testnet lnd before update!" &&\ 39 | exit 1;\ 40 | fi 41 | if [[ -f $(HOME)/.mainnet-lnd.pid ]]; then\ 42 | kill -0 `cat $(HOME)/.mainnet-lnd.pid` &>/dev/null &&\ 43 | echo "You must to stop mainnet lnd before update!" &&\ 44 | exit 2;\ 45 | fi 46 | if [[ -f $(HOME)/.testnet-lncli-web.pid ]]; then\ 47 | kill -0 `cat $(HOME)/.testnet-lncli-web.pid` &>/dev/null &&\ 48 | echo "You must to stop testnet lncli-web before update!" &&\ 49 | exit 1;\ 50 | fi 51 | if [[ -f $(HOME)/.mainnet-lncli-web.pid ]]; then\ 52 | kill -0 `cat $(HOME)/.mainnet-lncli-web.pid` &>/dev/null &&\ 53 | echo "You must to stop mainnet lncli-web before update!" &&\ 54 | exit 2;\ 55 | fi 56 | if [ "x${LND_BACKUP}" != "x" ]; then umask 077 && cd $(HOME) && tar czf lnd-backup-`date +%s-%Y-%m-%d`.tgz .lnd && echo $$'**********\n\nWe did backup of LND in home dir!\n\n**********'; fi 57 | ./update_wallet_macaroon_files_to_standard_dir.sh 58 | ./update_lnd_cert_to_standard_cert.sh 59 | @echo $$'*****************************************************\n\nLND was updated to commit/tag: $(LND_ACTUAL_COMMIT)\n\n' &&\ 60 | echo "To run \`mainnet-lightning-start\` or \`testnet-lightning-start\`" &&\ 61 | echo $$'\n\n*****************************************************' 62 | @touch $@ 63 | 64 | lnd-bin-update: |\ 65 | new_git_install\ 66 | lnd_install 67 | rm -rf $$GOPATH/pkg/dep 68 | -mkdir -p $$GOPATH/src/github.com/lightningnetwork 69 | -rm -rf $$GOPATH/src/github.com/lightningnetwork/lnd 70 | cd $$GOPATH/src/github.com/lightningnetwork &&\ 71 | git clone https://github.com/lightningnetwork/lnd &&\ 72 | cd lnd &&\ 73 | git fetch -f --tags origin && git checkout $(LND_ACTUAL_COMMIT) &&\ 74 | $(MAKE) clean && $(MAKE) && $(MAKE) install tags="autopilotrpc signrpc walletrpc chainrpc invoicesrpc routerrpc watchtowerrpc wtclientrpc monitoring peersrpc" 75 | @touch lnd_install 76 | @touch $@ 77 | 78 | btcd_install: |\ 79 | lnd_install 80 | cd $$GOPATH/src/github.com/lightningnetwork/lnd &&\ 81 | make btcd 82 | @touch $@ 83 | 84 | ####################### CONFIGS ################################### 85 | 86 | MAKE_DIRS += build/lnd/bitcoind 87 | MAKE_DIRS += $(HOME)/.lnd 88 | 89 | $(HOME)/.lnd/lnd-testnet.conf: build/lnd/bitcoind/lnd-testnet.conf | $(HOME)/.lnd 90 | umask 077 && \ 91 | if [ -f $@ ]; then \ 92 | cp -f $< $@.new.conf && \ 93 | touch $@; \ 94 | else \ 95 | cp -f $< $@; \ 96 | fi 97 | 98 | $(HOME)/.lnd/lnd-mainnet.conf: build/lnd/bitcoind/lnd-mainnet.conf | $(HOME)/.lnd 99 | umask 077 && \ 100 | if [ -f $@ ]; then \ 101 | cp -f $< $@.new.conf && \ 102 | touch $@; \ 103 | else \ 104 | cp -f $< $@; \ 105 | fi 106 | 107 | build/lnd/bitcoind/lnd-testnet.conf :\ 108 | $(NETWORK_MK_FILE)\ 109 | $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt\ 110 | |\ 111 | configs/lnd/bitcoind/lnd-testnet.conf\ 112 | build/lnd/bitcoind 113 | cp -f configs/lnd/bitcoind/lnd-testnet.conf $@ &&\ 114 | RPC_PASS=`awk '/Your password:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-testnet-auth.txt` && sed -ri \ 115 | -e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \ 116 | -e 's#\$$\$$BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET\$$\$$#$(BITCOIN_KIT_LND_CONFIG_EXTERNALIP_TESTNET)#g' \ 117 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 118 | -e 's#\$$\$$RPC_PASS\$$\$$#'$$RPC_PASS'#g' \ 119 | $@ 120 | 121 | build/lnd/bitcoind/lnd-mainnet.conf :\ 122 | $(NETWORK_MK_FILE)\ 123 | $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt\ 124 | |\ 125 | configs/lnd/bitcoind/lnd-mainnet.conf\ 126 | build/lnd/bitcoind 127 | cp -f configs/lnd/bitcoind/lnd-mainnet.conf $@ &&\ 128 | RPC_PASS=`awk '/Your password:/{getline; print}' $(CREDENTIALS_DIR)/bitcoind-lnd-mainnet-auth.txt` && sed -ri \ 129 | -e 's#\$$\$$HOME\$$\$$#$(HOME)#g' \ 130 | -e 's#\$$\$$BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET\$$\$$#$(BITCOIN_KIT_LND_CONFIG_EXTERNALIP_MAINNET)#g' \ 131 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' \ 132 | -e 's#\$$\$$RPC_PASS\$$\$$#'$$RPC_PASS'#g' \ 133 | $@ 134 | 135 | lnd_configs_bitcoind_bundle_install: |\ 136 | bitcoind_configs_install\ 137 | $(HOME)/.lnd/lnd-testnet.conf\ 138 | $(HOME)/.lnd/lnd-mainnet.conf 139 | @touch $@ 140 | 141 | MAKE_DIRS += build/bin/lnd 142 | 143 | build/bin/lnd/mainnet-lnd-start: \ 144 | $(NETWORK_MK_FILE)\ 145 | configs/bin/lnd/mainnet-lnd-start\ 146 | |\ 147 | lnd_install\ 148 | lnd_configs_bitcoind_bundle_install\ 149 | build/bin/lnd 150 | cp -f configs/bin/lnd/mainnet-lnd-start $@ && \ 151 | sed -ri \ 152 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 153 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 154 | chmod 755 $@ 155 | 156 | build/bin/lnd/mainnet-lnd-debug-start: \ 157 | $(NETWORK_MK_FILE)\ 158 | configs/bin/lnd/mainnet-lnd-debug-start\ 159 | |\ 160 | lnd_install\ 161 | lnd_configs_bitcoind_bundle_install\ 162 | build/bin/lnd 163 | cp -f configs/bin/lnd/mainnet-lnd-debug-start $@ && \ 164 | sed -ri \ 165 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 166 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 167 | chmod 755 $@ 168 | 169 | build/bin/lnd/testnet-lnd-start: \ 170 | $(NETWORK_MK_FILE)\ 171 | configs/bin/lnd/testnet-lnd-start\ 172 | |\ 173 | lnd_install\ 174 | lnd_configs_bitcoind_bundle_install\ 175 | build/bin/lnd 176 | cp -f configs/bin/lnd/testnet-lnd-start $@ && \ 177 | sed -ri \ 178 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 179 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 180 | chmod 755 $@ 181 | 182 | build/bin/lnd/testnet-lnd-debug-start: \ 183 | $(NETWORK_MK_FILE)\ 184 | configs/bin/lnd/testnet-lnd-debug-start\ 185 | |\ 186 | lnd_install\ 187 | lnd_configs_bitcoind_bundle_install\ 188 | build/bin/lnd 189 | cp -f configs/bin/lnd/testnet-lnd-debug-start $@ && \ 190 | sed -ri \ 191 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 192 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 193 | chmod 755 $@ 194 | 195 | build/bin/lnd/mainnet-lnd-stop: \ 196 | $(NETWORK_MK_FILE)\ 197 | configs/bin/lnd/mainnet-lnd-stop\ 198 | |\ 199 | lnd_install\ 200 | lnd_configs_bitcoind_bundle_install\ 201 | build/bin/lnd 202 | cp -f configs/bin/lnd/mainnet-lnd-stop $@ && \ 203 | sed -ri \ 204 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 205 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 206 | chmod 755 $@ 207 | 208 | build/bin/lnd/testnet-lnd-stop: \ 209 | $(NETWORK_MK_FILE)\ 210 | configs/bin/lnd/testnet-lnd-stop\ 211 | |\ 212 | lnd_install\ 213 | lnd_configs_bitcoind_bundle_install\ 214 | build/bin/lnd 215 | cp -f configs/bin/lnd/testnet-lnd-stop $@ && \ 216 | sed -ri \ 217 | -e 's#\$$\$$BITCOIN_KIT_UPNP_SUPPORT\$$\$$#$(BITCOIN_KIT_UPNP_SUPPORT)#g' \ 218 | -e 's#\$$\$$BITCOIN_KIT_LOCAL_IP\$$\$$#$(BITCOIN_KIT_LOCAL_IP)#g' $@ && \ 219 | chmod 755 $@ 220 | 221 | BITCOIN_NETWORK ?= mainnet 222 | 223 | $(HOME)/.lnd/data/chain/bitcoin/mainnet/wallet.db: override CREATE_WALLET_LOCK := .create_wallet_mainnet_lock 224 | $(HOME)/.lnd/data/chain/bitcoin/mainnet/wallet.db: 225 | umask 077 && nohup lnd --configfile=$(HOME)/.lnd/lnd-mainnet.conf &>$(CREATE_WALLET_LOCK).out.txt & echo $$! >$(CREATE_WALLET_LOCK).pid.txt 226 | echo $$'********************************************************************************\n\n\nNow the "lncli create" command will be run (creation of wallet). It'\'$$'s important! Please write passwords & seed of lnd!\n\n\n********************************************************************************\n\n' 227 | echo 'Please press ENTER to next step:'; read 228 | lncli --macaroonpath $(HOME)/.lnd/data/chain/bitcoin/mainnet/admin.macaroon --rpcserver localhost:10009 create 229 | -@kill `cat $(CREATE_WALLET_LOCK).pid.txt` &>/dev/null; rm -f $(CREATE_WALLET_LOCK).pid.txt $(CREATE_WALLET_LOCK).out.txt 230 | 231 | $(HOME)/.lnd/data/chain/bitcoin/mainnet/admin.macaroon: | $(HOME)/.lnd/lnd-mainnet.conf $(HOME)/.lnd/data/chain/bitcoin/mainnet/wallet.db 232 | if [ -f $(HOME)/.lnd/admin-mainnet.macaroon ]; then echo $$'**************\n\nYou need stop LNDs; $(MAKE) lnd-update; and to run LND again\n\n**************'; false; fi 233 | for i in {1..30}; do [ -f $@ ] && break; sleep 1; done 234 | [ -f $@ ] 235 | 236 | $(HOME)/opt/lncli-web/admin-mainnet.macaroon: $(HOME)/.lnd/data/chain/bitcoin/mainnet/admin.macaroon 237 | cp -f $< $@ 238 | 239 | $(HOME)/.lnd/data/chain/bitcoin/testnet/wallet.db: override CREATE_WALLET_LOCK := .create_wallet_testnet_lock 240 | $(HOME)/.lnd/data/chain/bitcoin/testnet/wallet.db: 241 | umask 077 && nohup lnd --configfile=$(HOME)/.lnd/lnd-testnet.conf &>$(CREATE_WALLET_LOCK).out.txt & echo $$! >$(CREATE_WALLET_LOCK).pid.txt 242 | echo $$'********************************************************************************\n\n\nNow the "lncli create" command will be run (creation of wallet). It'\'$$'s important! Please write passwords & seed of lnd!\n\n\n********************************************************************************\n\n' 243 | echo '!!! THIS IS TESTNODE WALLET! Please press ENTER to next step:'; read 244 | lncli --macaroonpath $(HOME)/.lnd/data/chain/bitcoin/testnet/admin.macaroon --rpcserver localhost:10010 create 245 | -@kill `cat $(CREATE_WALLET_LOCK).pid.txt` &>/dev/null; rm -f $(CREATE_WALLET_LOCK).pid.txt $(CREATE_WALLET_LOCK).out.txt 246 | 247 | $(HOME)/.lnd/data/chain/bitcoin/testnet/admin.macaroon: | $(HOME)/.lnd/lnd-testnet.conf $(HOME)/.lnd/data/chain/bitcoin/testnet/wallet.db 248 | if [ -f $(HOME)/.lnd/admin-testnet.macaroon ]; then echo $$'**************\n\nYou need stop LNDs; $(MAKE) lnd-update; and to run LND again\n\n**************'; false; fi 249 | for i in {1..30}; do [ -f $@ ] && break; sleep 1; done 250 | [ -f $@ ] 251 | 252 | $(HOME)/opt/lncli-web/admin-testnet.macaroon: $(HOME)/.lnd/data/chain/bitcoin/testnet/admin.macaroon 253 | cp -f $< $@ 254 | 255 | $(HOME)/bin/mainnet-lnd-start: build/bin/lnd/mainnet-lnd-start | $(HOME)/bin miniupnpc_install 256 | umask 077 && cp -f $< $@ 257 | 258 | $(HOME)/bin/mainnet-lnd-debug-start: build/bin/lnd/mainnet-lnd-debug-start | $(HOME)/bin miniupnpc_install 259 | umask 077 && cp -f $< $@ 260 | 261 | $(HOME)/bin/testnet-lnd-start: build/bin/lnd/testnet-lnd-start | $(HOME)/bin miniupnpc_install 262 | umask 077 && cp -f $< $@ 263 | 264 | $(HOME)/bin/testnet-lnd-debug-start: build/bin/lnd/testnet-lnd-debug-start | $(HOME)/bin miniupnpc_install 265 | umask 077 && cp -f $< $@ 266 | 267 | $(HOME)/bin/mainnet-lnd-stop: build/bin/lnd/mainnet-lnd-stop | $(HOME)/bin miniupnpc_install 268 | umask 077 && cp -f $< $@ 269 | 270 | $(HOME)/bin/testnet-lnd-stop: build/bin/lnd/testnet-lnd-stop | $(HOME)/bin miniupnpc_install 271 | umask 077 && cp -f $< $@ 272 | -------------------------------------------------------------------------------- /mk/miniupnp.mk: -------------------------------------------------------------------------------- 1 | MAKE_DIRS += ./upnp 2 | 3 | miniupnpc_install: |\ 4 | required_for_configure_install 5 | cd external/miniupnp/miniupnpc && { \ 6 | INSTALLPREFIX=$(BASE_INSTALL_DIR) $(MAKE) install && $(MAKE) clean && echo "miniUPnP Client was installed - OK"; \ 7 | } &> make_out.txt && tail make_out.txt 8 | @touch $@ 9 | -------------------------------------------------------------------------------- /mk/nodejs.mk: -------------------------------------------------------------------------------- 1 | node-v10.1.0.tar.gz: 2 | gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D 3 | $(WGET) 'https://nodejs.org/dist/v10.1.0/$@' && $(WGET) -O $@-SHASUMS256.txt.asc 'https://nodejs.org/dist/v10.1.0/SHASUMS256.txt.asc' &&\ 4 | grep $@ $@-SHASUMS256.txt.asc | sha256sum -c - || { echo "Bad sign of $@"; false; } 5 | 6 | # LANG=C ./configure... for correct version of assembler 7 | nodejs_pre_install: |\ 8 | required_for_configure_install\ 9 | binutils_install\ 10 | python2_install\ 11 | node-v10.1.0.tar.gz 12 | tar xzf node-v10.1.0.tar.gz 13 | cd node-v10.1.0 && { \ 14 | LANG=C ./configure --prefix=$(BASE_INSTALL_DIR) && $(MAKE_COMPILE) && $(MAKE) install && echo "The node.js was installed - OK"; \ 15 | } &> make_out.txt && tail make_out.txt 16 | @touch $@ 17 | 18 | nodejs_install: |\ 19 | nodejs_pre_install\ 20 | nodejs_global_in_home_install\ 21 | npm_update 22 | @touch $@ 23 | 24 | nodejs_global_in_home_install: 25 | -mkdir $(HOME)/.npm-global 26 | npm config set prefix '~/.npm-global' 27 | @touch $@ 28 | 29 | npm_update: |\ 30 | nodejs_pre_install\ 31 | nodejs_global_in_home_install 32 | npm install npm@latest -g 33 | @touch $@ 34 | -------------------------------------------------------------------------------- /mk/python2.mk: -------------------------------------------------------------------------------- 1 | Python-2.7.15.tgz: 2 | $(WGET) 'https://www.python.org/ftp/python/2.7.15/Python-2.7.15.tgz' 3 | echo '045fb3440219a1f6923fefdabde63342 Python-2.7.15.tgz'|md5sum --check - || \ 4 | { \ 5 | mv Python-2.7.15.tgz Python-2.7.15.bad.tgz &&\ 6 | echo "Bad python2 md5 sum"; false;\ 7 | } 8 | 9 | python2_install: |\ 10 | required_for_configure_install\ 11 | zlib_install\ 12 | Python-2.7.15.tgz 13 | tar xzf Python-2.7.15.tgz 14 | cd Python-2.7.15 && { \ 15 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The python2 was installed - OK"; \ 16 | } &> make_out.txt && tail make_out.txt 17 | @touch $@ 18 | -------------------------------------------------------------------------------- /mk/python3.mk: -------------------------------------------------------------------------------- 1 | Python-3.9.9.tgz: 2 | $(WGET) 'https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz' 3 | echo 'a2da2a456c078db131734ff62de10ed5 Python-3.9.9.tgz'|md5sum --check - || \ 4 | { \ 5 | mv Python-3.9.9.tgz Python-3.9.9.bad.tgz &&\ 6 | echo "Bad python3 md5 sum"; false;\ 7 | } 8 | 9 | python39_install: |\ 10 | required_for_configure_install\ 11 | openssl_install\ 12 | libevent_install\ 13 | zlib_install\ 14 | zeromq_install\ 15 | Python-3.9.9.tgz 16 | tar xzf Python-3.9.9.tgz 17 | cd Python-3.9.9 && { \ 18 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The python3 was installed - OK"; \ 19 | } &> make_out.txt && tail make_out.txt 20 | @touch $@ 21 | -------------------------------------------------------------------------------- /mk/rsync.mk: -------------------------------------------------------------------------------- 1 | # It's targets for development rsync for testing 2 | rsync_main_repo: 3 | git ls-files|rsync -dlptgoDvz --files-from=- . $(BITCOIN_TOOLS_RSYNC_SERVER_AND_PATH) 4 | RETCODE=$$?; echo $$RETCODE;\ 5 | if [ $$RETCODE -eq 0 -o $$RETCODE -eq 23 ]; then true; else false; fi 6 | 7 | rsync_submodules: 8 | cwd=`pwd`; git submodule --quiet foreach --recursive 'git ls-files|''awk '\''{print "'\''$$toplevel/$$path'\''/"$$1}'\' | awk 'BEGIN{l=length("'$$cwd'")} {print substr($$0,l+1)}' | rsync -dlptgoDvz --files-from=- . $(BITCOIN_TOOLS_RSYNC_SERVER_AND_PATH) 9 | RETCODE=$$?; echo $$RETCODE;\ 10 | if [ $$RETCODE -eq 0 -o $$RETCODE -eq 23 ]; then true; else false; fi 11 | 12 | rsync: rsync_main_repo rsync_submodules 13 | git ls-files|rsync -dlptgoDvz --files-from=- . $(BITCOIN_TOOLS_RSYNC_SERVER_AND_PATH) 14 | RETCODE=$$?; echo $$RETCODE;\ 15 | if [ $$RETCODE -eq 0 -o $$RETCODE -eq 23 ]; then true; else false; fi 16 | 17 | .PHONY: rsync rsync_main_repo rsync_submodules 18 | -------------------------------------------------------------------------------- /mk/rust.mk: -------------------------------------------------------------------------------- 1 | rust_install: |\ 2 | required_for_configure_install\ 3 | binutils_install\ 4 | cmake_install\ 5 | python39_install\ 6 | new_git_install\ 7 | new_curl_install\ 8 | openssl_install 9 | cd external/rust && { \ 10 | cp config.toml.example config.toml && \ 11 | sed -r -i 's/#extended = false/extended = true/' config.toml && \ 12 | sed -r -i 's%#prefix = "/usr/local"%prefix = "$(BASE_INSTALL_DIR)"%' config.toml && \ 13 | sed -r -i 's%#sysconfdir = "/etc"%sysconfdir = "etc"%' config.toml && \ 14 | ./x.py build && ./x.py install && echo "The rust was installed - OK"; \ 15 | } &> make_out.txt && tail make_out.txt 16 | @touch $@ 17 | -------------------------------------------------------------------------------- /mk/sqlite3.mk: -------------------------------------------------------------------------------- 1 | sqlite-autoconf-3230100.tar.gz: 2 | $(WGET) 'https://www.sqlite.org/2018/$@' &&\ 3 | echo '0edbfd75ececb95e8e6448d6ff33df82774c9646 $@'|sha1sum --check - || { echo "Bad checksum"; false; } 4 | 5 | sqlite3_install: |\ 6 | required_for_configure_install\ 7 | sqlite-autoconf-3230100.tar.gz 8 | tar xzf sqlite-autoconf-3230100.tar.gz 9 | cd sqlite-autoconf-3230100 && { \ 10 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The sqlite3 was installed - OK"; \ 11 | } &> make_out.txt && tail make_out.txt 12 | @touch $@ 13 | -------------------------------------------------------------------------------- /mk/tor.mk: -------------------------------------------------------------------------------- 1 | TOR_VERSION := 0.4.8.5 2 | TOR_BASE_NAME := tor-$(TOR_VERSION) 3 | 4 | $(TOR_BASE_NAME).tar.gz: 5 | $(WGET) 'https://dist.torproject.org/$@' &&\ 6 | echo '6957cfd14a29eee7555c52f8387a46f2ce2f5fe7dadf93547f1bc74b1657e119 $@'|sha256sum --check - || { echo "Bad checksum"; false; } 7 | 8 | tor_install: |\ 9 | $(TOR_BASE_NAME).tar.gz\ 10 | required_for_configure_install\ 11 | gcc_install_11_2_0_min\ 12 | binutils_install\ 13 | openssl_install\ 14 | libevent_install\ 15 | $(HOME)/.bitcoin_envs\ 16 | autotools_install\ 17 | miniupnpc_install 18 | tar xvzf $(TOR_BASE_NAME).tar.gz 19 | cd $(TOR_BASE_NAME) && { \ 20 | ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "The tor was installed - OK"; \ 21 | } &> make_out.txt && tail make_out.txt 22 | @touch $@ 23 | -------------------------------------------------------------------------------- /mk/zeromq.mk: -------------------------------------------------------------------------------- 1 | # In CentOS 6.x `make check` has 3 fail tests... I decided to remove make check 2 | zeromq_install: |\ 3 | required_for_configure_install 4 | cd external/libzmq && { \ 5 | $(MAKE) clean; ./autogen.sh && ./configure --prefix=$(BASE_INSTALL_DIR) $(CONFIGURE_VARS) && $(MAKE_COMPILE) && $(MAKE) install && echo "ZeroMQ was installed - OK"; \ 6 | } &> make_out.txt && tail make_out.txt 7 | @touch $@ 8 | -------------------------------------------------------------------------------- /test_ver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ "$1" = "1" ]; then 4 | { ver=$($2|head -1|sed -r -e 's#.* ([0-9]+\.[0-9a-z]+(\.[0-9a-z]+)?).*#\1#'); } &>/dev/null 5 | [ "x${ver}" = "x" ] && ver="0.0.0" 6 | elif [ "$1" = "2" ]; then 7 | { ver=$($2); } &>/dev/null 8 | [ "x${ver}" = "x" ] && ver="0.0.0" 9 | fi 10 | 11 | if [ "$(printf '%s\n' "$3" "$ver" | sort -V | head -n1)" = "$3" ]; then echo OK; else echo FAIL; fi 12 | -------------------------------------------------------------------------------- /update_lnd_cert_to_standard_cert.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The lnd v0.5.1 has other locations for wallet & macaroon files. Before it has these files not related with chain directory. 4 | # This update unifies locations because some third-party utilities (ln-rebalance for examnple and lnwallet use standard paths) 5 | 6 | set -e 7 | 8 | LND_DIR=$HOME/.lnd 9 | 10 | [[ -f $HOME/.testnet-lnd.pid ]] && kill -0 `cat $HOME/.testnet-lnd.pid` &>/dev/null && echo "You must to stop testnet lnd before update!" && exit 1 11 | [[ -f $HOME/.mainnet-lnd.pid ]] && kill -0 `cat $HOME/.mainnet-lnd.pid` &>/dev/null && echo "You must to stop mainnet lnd before update!" && exit 2 12 | [[ -f $HOME/.testnet-lncli-web.pid ]] && kill -0 `cat $HOME/.testnet-lncli-web.pid` &>/dev/null && echo "You must to stop testnet lncli-web before update!" && exit 1 13 | [[ -f $HOME/.mainnet-lncli-web.pid ]] && kill -0 `cat $HOME/.mainnet-lncli-web.pid` &>/dev/null && echo "You must to stop mainnet lncli-web before update!" && exit 2 14 | 15 | if [[ `openssl x509 -in $LND_DIR/tls.cert -text -noout |grep 'lnd autogenerated cert'` == "" ]]; then 16 | # Need to update! 17 | rm -f $LND_DIR/tls.cert 18 | rm -f $LND_DIR/tls.key 19 | if [[ -d $HOME/opt/lncli-web && -f $HOME/opt/lncli-web/lnd.cert ]]; then 20 | rm -f $HOME/opt/lncli-web/lnd.cert 21 | # Now tls.cert file doesn't exist but it will be recreated after lnd start 22 | ln -s $LND_DIR/tls.cert $HOME/opt/lncli-web/lnd.cert 23 | fi 24 | fi 25 | -------------------------------------------------------------------------------- /update_wallet_macaroon_files_to_standard_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # The lnd v0.5.1 has other locations for wallet & macaroon files. Before it has these files not related with chain directory. 4 | # This update unifies locations because some third-party utilities (ln-rebalance for examnple and lnwallet use standard paths) 5 | 6 | set -e 7 | 8 | LND_DIR=$HOME/.lnd 9 | 10 | [[ -f $HOME/.testnet-lnd.pid ]] && kill -0 `cat $HOME/.testnet-lnd.pid` &>/dev/null && echo "You must to stop testnet lnd before update!" && exit 1 11 | [[ -f $HOME/.mainnet-lnd.pid ]] && kill -0 `cat $HOME/.mainnet-lnd.pid` &>/dev/null && echo "You must to stop mainnet lnd before update!" && exit 2 12 | 13 | # $1 - mainnet|testnet 14 | update_network () { 15 | local network=$1 16 | 17 | rsync -a $LND_DIR/data-${network}/* $LND_DIR/data/ && sed -ri -e 's#/data-'${network}'/#/data/#g' $LND_DIR/lnd-${network}.conf 18 | if [ -f $LND_DIR/data/macaroons.db ]; then mv $LND_DIR/data/macaroons.db $LND_DIR/data/chain/bitcoin/${network}/; fi 19 | [ -f $LND_DIR/admin-${network}.macaroon ] && 20 | mv $LND_DIR/admin-${network}.macaroon $LND_DIR/data/chain/bitcoin/${network}/admin.macaroon &&\ 21 | sed -ri -e 's#admin-'${network}'\.macaroon#data/chain/bitcoin/'${network}'/admin.macaroon#g' $LND_DIR/lnd-${network}.conf 22 | [ -f $LND_DIR/invoice-${network}.macaroon ] && 23 | mv $LND_DIR/invoice-${network}.macaroon $LND_DIR/data/chain/bitcoin/${network}/invoice.macaroon && 24 | sed -ri -e 's#invoice-'${network}'\.macaroon#data/chain/bitcoin/'${network}'/invoice.macaroon#g' $LND_DIR/lnd-${network}.conf 25 | [ -f $LND_DIR/readonly-${network}.macaroon ] && 26 | mv $LND_DIR/readonly-${network}.macaroon $LND_DIR/data/chain/bitcoin/${network}/readonly.macaroon && 27 | sed -ri -e 's#readonly-'${network}'\.macaroon#data/chain/bitcoin/'${network}'/readonly.macaroon#g' $LND_DIR/lnd-${network}.conf 28 | if [ "${network}" == "mainnet" ]; then 29 | sed -ri -e 's#debughtlc=true#debughtlc=false#g' $LND_DIR/lnd-${network}.conf 30 | fi 31 | if grep -q zmqpath $LND_DIR/lnd-${network}.conf; then 32 | sed -ri -e $'/bitcoind\\.zmqpath/d' $LND_DIR/lnd-${network}.conf 33 | grep zmq configs/lnd/bitcoind/lnd-${network}.conf >>$LND_DIR/lnd-${network}.conf 34 | fi 35 | } 36 | 37 | if [ ! -d $LND_DIR/data ]; then 38 | # No data dir - we use old version of bitcoin-ket-makefile 39 | mkdir -p $LND_DIR/data 40 | if [ -d $LND_DIR/data-mainnet ]; then 41 | update_network mainnet 42 | rm -rf $LND_DIR/data-mainnet 43 | fi 44 | if [ -d $LND_DIR/data-testnet ]; then 45 | update_network testnet 46 | rm -rf $LND_DIR/data-testnet 47 | fi 48 | else 49 | echo "No update of macaroon files to be needed!" 50 | fi 51 | --------------------------------------------------------------------------------