2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
23 ## bitcoin disabled. fees too high
25 if [[ $HOSTNAME == frodo
]]; then
28 if [[ `debian-archive` == testing
]]; then
29 # has no unstable dependencies
31 src
=/a
/opt
/bitcoin
/contrib
/init
/bitcoind.service
32 s
cp $src /etc
/systemd
/system
33 p
=/etc
/bitcoin
/bitcoin
34 dst
=/etc
/systemd
/system
/bitcoinjm.service
36 $sed -r "/^\s*ExecStart/s,${p}.conf,${p}jm.conf," $src \
37 >/etc
/systemd
/system
/bitcoinjm.service
39 d
=jm
; jm
=d
# being clever for succinctness
41 s
$sed -ri "/^\s*\[Unit\]/a Conflicts=bitcoin${!s}.service" \
42 /etc
/systemd
/system
/bitcoin
${s}.service
49 s chown
-R bitcoin
:bitcoin
$dir
52 s chown
-R root
:bitcoin
$dir
55 # pruning decreases the bitcoin dir to 2 gb, keeps
56 # just the recent blocks. can\'t do a few things like
57 # import a wallet dump.
58 # pruning works, but people had to do
59 # some manual stuff in joinmarket. I dun need the
60 # disk space, so not bothering yet, maybe in a year or so.
61 # https://github.com/JoinMarket-Org/joinmarket/issues/431
62 #https://bitcoin.org/en/release/v0.12.0#wallet-pruning
68 # necessary for joinmarket, not bad in general
69 rpcpassword=$(openssl rand -base64 32)
70 rpcuser=$(openssl rand -base64 32)
73 # dunno about sharing a wallet between multiple instances
74 # manually did, wallet.dat symlinked in /nocow/.bitcoin
78 # other distros unknown
83 ## disabling joinmarket, its too expensive
84 ### begin joinmarket setup ###
89 f2
=$dir/bitcoinjm.conf
91 s
tee -a $f2 >/dev
/null
<<EOF
93 walletnotify=curl -sI --connect-timeout 1 http://localhost:62602/walletnotify?%s
94 alertnotify=curl -sI --connect-timeout 1 http://localhost:62602/alertnotify?%s
99 # other distros unknown
102 pi libsodium-dev python-pip
104 # using develop branch, as it seems to be mostly bug fixes,
105 # and this is quite new software.
106 # note: python3 does not work.
107 # has seg fault error due to some bug, but it still works
108 pip
install -r requirements.txt ||
[[ $?
== 139 ]]
109 # note, the target must exist ahead of time, or bitcoin
110 # just overwrites the link, and it\'s not happy with an empty file,
111 # so we have to create the wallet, then move and link it.
112 s lnf
-T /q
/bitcoin
/wallet.dat
/nocow
/.bitcoin
/wallet.dat
113 s lnf
-T /q
/bitcoin
/joinmarket.dat
/nocow
/.bitcoin
/joinmarket.dat
114 # not technically needed, but seems cleaner not to have
115 # symlinks be root owned unlike everything else
116 s chown
-h bitcoin
:bitcoin
/nocow
/.bitcoin
/*
118 for var
in rpcuser rpcpassword
; do
119 u
="$(s sed -rn "s
/^
$var=(.
*)/\
1/p
" /etc/bitcoin/bitcoin.conf)"
121 u
="${u//\\/\\\\\\\\}"
124 sed -ri "s,^(rpc_${var#rpc}\s*=).*,\1 $u," joinmarket.cfg
126 sed -ri "s/^\s*(blockchain_source\s*=).*/\1 bitcoin-rpc/" joinmarket.cfg
127 ### end joinmarket setup ###