diff --git a/contrib/README.md b/contrib/README.md index 6f750106e4..34c4cfc55a 100644 --- a/contrib/README.md +++ b/contrib/README.md @@ -1,50 +1,50 @@ Repository Tools --------------------- ### [Developer tools](/contrib/devtools) ### Specific tools for developers working on this repository. Contains the script `github-merge.py` for merging GitHub pull requests securely and signing them using GPG. ### [Verify-Commits](/contrib/verify-commits) ### Tool to verify that every merge commit was signed by a developer using the above `github-merge.py` script. ### [Linearize](/contrib/linearize) ### Construct a linear, no-fork, best version of the blockchain. ### [Qos](/contrib/qos) ### A Linux bash script that will set up traffic control (tc) to limit the outgoing bandwidth for connections to the Bitcoin network. This means one can have an always-on bitcoind instance running, and another local bitcoind/bitcoin-qt instance which connects to this node and receives blocks from it. ### [Seeds](/contrib/seeds) ### Utility to generate the pnSeed[] array that is compiled into the client. Build Tools and Keys --------------------- ### [Debian](/contrib/debian) ### Contains files used to package bitcoind/bitcoin-qt for Debian-based Linux systems. If you compile bitcoind/bitcoin-qt yourself, there are some useful files here. ### [Gitian-descriptors](/contrib/gitian-descriptors) ### Notes on getting Gitian builds up and running using KVM. ### [Gitian-keys](/contrib/gitian-keys) PGP keys used for signing Bitcoin Core [Gitian release](/doc/release-process.md) results. ### [MacDeploy](/contrib/macdeploy) ### Scripts and notes for Mac builds. ### [RPM](/contrib/rpm) ### -RPM spec file for building bitcoin-core on RPM based distributions +RPM spec file for building bitcoin-core on RPM based distributions. ### [Gitian-build](/contrib/gitian-build.sh) ### Script for running full Gitian builds. Test and Verify Tools --------------------- ### [TestGen](/contrib/testgen) ### Utilities to generate test vectors for the data-driven Bitcoin tests. ### [Verify Binaries](/contrib/verifybinaries) ### This script attempts to download and verify the signature file SHA256SUMS.asc from bitcoin.org. diff --git a/contrib/bitcoin-cli.bash-completion b/contrib/bitcoin-cli.bash-completion index 732981fe7c..2113c6b759 100644 --- a/contrib/bitcoin-cli.bash-completion +++ b/contrib/bitcoin-cli.bash-completion @@ -1,154 +1,154 @@ # bash programmable completion for bitcoin-cli(1) # Copyright (c) 2012-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # call $bitcoin-cli for RPC _bitcoin_rpc() { # determine already specified args necessary for RPC local rpcargs=() for i in ${COMP_LINE}; do case "$i" in -conf=*|-datadir=*|-regtest|-rpc*|-testnet) rpcargs=( "${rpcargs[@]}" "$i" ) ;; esac done $bitcoin_cli "${rpcargs[@]}" "$@" } # Add wallet accounts to COMPREPLY _bitcoin_accounts() { local accounts accounts=$(_bitcoin_rpc listaccounts | awk -F '"' '{ print $2 }') COMPREPLY=( "${COMPREPLY[@]}" $( compgen -W "$accounts" -- "$cur" ) ) } _bitcoin_cli() { local cur prev words=() cword local bitcoin_cli # save and use original argument to invoke bitcoin-cli for -help, help and RPC # as bitcoin-cli might not be in $PATH bitcoin_cli="$1" COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword if ((cword > 5)); then case ${words[cword-5]} in sendtoaddress) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 4)); then case ${words[cword-4]} in importaddress|listtransactions|setban) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; signrawtransaction) COMPREPLY=( $( compgen -W "ALL NONE SINGLE ALL|ANYONECANPAY NONE|ANYONECANPAY SINGLE|ANYONECANPAY" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 3)); then case ${words[cword-3]} in addmultisigaddress) _bitcoin_accounts return 0 ;; getbalance|gettxout|importaddress|importpubkey|importprivkey|listreceivedbyaccount|listreceivedbyaddress|listsinceblock) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; esac fi if ((cword > 2)); then case ${words[cword-2]} in addnode) COMPREPLY=( $( compgen -W "add remove onetry" -- "$cur" ) ) return 0 ;; setban) COMPREPLY=( $( compgen -W "add remove" -- "$cur" ) ) return 0 ;; fundrawtransaction|getblock|getblockheader|getmempoolancestors|getmempooldescendants|getrawtransaction|gettransaction|listaccounts|listreceivedbyaccount|listreceivedbyaddress|sendrawtransaction) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; move|setaccount) _bitcoin_accounts return 0 ;; esac fi case "$prev" in backupwallet|dumpwallet|importwallet) _filedir return 0 ;; getaddednodeinfo|getrawmempool|lockunspent|setgenerate) COMPREPLY=( $( compgen -W "true false" -- "$cur" ) ) return 0 ;; getaccountaddress|getaddressesbyaccount|getbalance|getnewaddress|getreceivedbyaccount|listtransactions|move|sendfrom|sendmany) _bitcoin_accounts return 0 ;; esac case "$cur" in -conf=*) cur="${cur#*=}" _filedir return 0 ;; -datadir=*) cur="${cur#*=}" _filedir -d return 0 ;; -*=*) # prevent nonsense completions return 0 ;; *) local helpopts commands - # only parse -help if senseful + # only parse -help if sensible if [[ -z "$cur" || "$cur" =~ ^- ]]; then helpopts=$($bitcoin_cli -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) fi - # only parse help if senseful + # only parse help if sensible if [[ -z "$cur" || "$cur" =~ ^[a-z] ]]; then commands=$(_bitcoin_rpc help 2>/dev/null | awk '$1 ~ /^[a-z]/ { print $1; }') fi COMPREPLY=( $( compgen -W "$helpopts $commands" -- "$cur" ) ) # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace fi return 0 ;; esac } && complete -F _bitcoin_cli bitcoin-cli # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/bitcoind.bash-completion b/contrib/bitcoind.bash-completion index af87e97d80..cccd4bde0d 100644 --- a/contrib/bitcoind.bash-completion +++ b/contrib/bitcoind.bash-completion @@ -1,56 +1,56 @@ # bash programmable completion for bitcoind(1) and bitcoin-qt(1) # Copyright (c) 2012-2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. _bitcoind() { local cur prev words=() cword local bitcoind # save and use original argument to invoke bitcoind for -help # it might not be in $PATH bitcoind="$1" COMPREPLY=() _get_comp_words_by_ref -n = cur prev words cword case "$cur" in -conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*) cur="${cur#*=}" _filedir return 0 ;; -datadir=*) cur="${cur#*=}" _filedir -d return 0 ;; -*=*) # prevent nonsense completions return 0 ;; *) - # only parse -help if senseful + # only parse -help if sensible if [[ -z "$cur" || "$cur" =~ ^- ]]; then local helpopts helpopts=$($bitcoind -help 2>&1 | awk '$1 ~ /^-/ { sub(/=.*/, "="); print $1 }' ) COMPREPLY=( $( compgen -W "$helpopts" -- "$cur" ) ) fi # Prevent space if an argument is desired if [[ $COMPREPLY == *= ]]; then compopt -o nospace fi return 0 ;; esac } && complete -F _bitcoind bitcoind bitcoin-qt # Local variables: # mode: shell-script # sh-basic-offset: 4 # sh-indent-comment: t # indent-tabs-mode: nil # End: # ex: ts=4 sw=4 et filetype=sh diff --git a/contrib/gitian/gitian-build.sh b/contrib/gitian/gitian-build.sh index aff4e19608..89c3388e1b 100755 --- a/contrib/gitian/gitian-build.sh +++ b/contrib/gitian/gitian-build.sh @@ -1,395 +1,395 @@ # Copyright (c) 2016 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # What to do sign=false verify=false build=false setupenv=false # Systems to build linux=true windows=true osx=true # Other Basic variables SIGNER= VERSION= commit=false url=https://github.com/Bitcoin-ABC/bitcoin-abc proc=2 mem=2000 lxc=true osslTarUrl=http://downloads.sourceforge.net/project/osslsigncode/osslsigncode/osslsigncode-1.7.1.tar.gz osslPatchUrl=https://bitcoincore.org/cfields/osslsigncode-Backports-to-1.7.1.patch scriptName=$(basename -- "$0") signProg="gpg --detach-sign" commitFiles=true # Help Message read -d '' usage <<- EOF Usage: $scriptName [-c|u|v|b|s|B|o|h|j|m|] signer version Run this script from the directory containing the bitcoin, gitian-builder, gitian.sigs, and bitcoin-detached-sigs. Arguments: signer GPG signer to sign each build assert file version Version number, commit, or branch to build. If building a commit or branch, the -c option must be specified Options: -c|--commit Indicate that the version argument is for a commit or branch -u|--url Specify the URL of the repository. Default is https://github.com/bitcoin/bitcoin --v|--verify Verify the gitian build --b|--build Do a gitian build +-v|--verify Verify the Gitian build +-b|--build Do a Gitian build -s|--sign Make signed binaries for Windows and Mac OSX -B|--buildsign Build both signed and unsigned binaries -o|--os Specify which Operating Systems the build is for. Default is lwx. l for linux, w for windows, x for osx -j Number of processes to use. Default 2 -m Memory to allocate in MiB. Default 2000 --kvm Use KVM instead of LXC ---setup Setup the gitian building environment. Uses KVM. If you want to use lxc, use the --lxc option. Only works on Debian-based systems (Ubuntu, Debian) +--setup Set up the Gitian building environment. Uses KVM. If you want to use lxc, use the --lxc option. Only works on Debian-based systems (Ubuntu, Debian) --detach-sign Create the assert file for detached signing. Will not commit anything. --no-commit Do not commit anything to git -h|--help Print this help message EOF # Get options and arguments while :; do case $1 in # Verify -v|--verify) verify=true ;; # Build -b|--build) build=true ;; # Sign binaries -s|--sign) sign=true ;; # Build then Sign -B|--buildsign) sign=true build=true ;; # PGP Signer -S|--signer) if [ -n "$2" ] then SIGNER=$2 shift else echo 'Error: "--signer" requires a non-empty argument.' exit 1 fi ;; # Operating Systems -o|--os) if [ -n "$2" ] then linux=false windows=false osx=false if [[ "$2" = *"l"* ]] then linux=true fi if [[ "$2" = *"w"* ]] then windows=true fi if [[ "$2" = *"x"* ]] then osx=true fi shift else echo 'Error: "--os" requires an argument containing an l (for linux), w (for windows), or x (for Mac OSX)\n' exit 1 fi ;; # Help message -h|--help) echo "$usage" exit 0 ;; # Commit or branch -c|--commit) commit=true ;; # Number of Processes -j) if [ -n "$2" ] then proc=$2 shift else echo 'Error: "-j" requires an argument' exit 1 fi ;; # Memory to allocate -m) if [ -n "$2" ] then mem=$2 shift else echo 'Error: "-m" requires an argument' exit 1 fi ;; # URL -u) if [ -n "$2" ] then url=$2 shift else echo 'Error: "-u" requires an argument' exit 1 fi ;; # kvm --kvm) lxc=false ;; # Detach sign --detach-sign) signProg="true" commitFiles=false ;; # Commit files --no-commit) commitFiles=false ;; # Setup --setup) setup=true ;; # Default case: If no more options then break out of the loop. *) break esac shift done # Set up LXC if [[ $lxc = true ]] then export USE_LXC=1 export LXC_BRIDGE=lxcbr0 sudo ifconfig lxcbr0 up 10.0.2.2 fi # Check for OSX SDK if [[ ! -e "gitian-builder/inputs/MacOSX10.11.sdk.tar.gz" && $osx == true ]] then echo "Cannot build for OSX, SDK does not exist. Will build for other OSes" osx=false fi # Get signer if [[ -n"$1" ]] then SIGNER=$1 shift fi # Get version if [[ -n "$1" ]] then VERSION=$1 COMMIT=$VERSION shift fi # Check that a signer is specified if [[ $SIGNER == "" ]] then echo "$scriptName: Missing signer." echo "Try $scriptName --help for more information" exit 1 fi # Check that a version is specified if [[ $VERSION == "" ]] then echo "$scriptName: Missing version." echo "Try $scriptName --help for more information" exit 1 fi # Add a "v" if no -c if [[ $commit = false ]] then COMMIT="v${VERSION}" fi echo ${COMMIT} # Setup build environment if [[ $setup = true ]] then sudo apt-get install ruby apache2 git apt-cacher-ng python-vm-builder qemu-kvm qemu-utils # FIXME: Replace with ABC-equivalent repos #git clone https://github.com/bitcoin-core/gitian.sigs.git #git clone https://github.com/bitcoin-core/bitcoin-detached-sigs.git git clone https://github.com/devrandom/gitian-builder.git pushd ./gitian-builder if [[ -n "$USE_LXC" ]] then sudo apt-get install lxc bin/make-base-vm --suite trusty --arch amd64 --lxc else bin/make-base-vm --suite trusty --arch amd64 fi popd fi # Set up build pushd ./bitcoin git fetch git checkout ${COMMIT} popd # Build if [[ $build = true ]] then # Make output folder mkdir -p ./bitcoin-binaries/${VERSION} # Build Dependencies echo "" echo "Building Dependencies" echo "" pushd ./gitian-builder mkdir -p inputs # FIXME: Pull patches from a trusted source #wget -N -P inputs $osslPatchUrl #wget -N -P inputs $osslTarUrl make -C ../bitcoin/depends download SOURCES_PATH=`pwd`/cache/common # Linux if [[ $linux = true ]] then echo "" echo "Compiling ${VERSION} Linux" echo "" ./bin/gbuild -j ${proc} -m ${mem} --commit bitcoin=${COMMIT} --url bitcoin=${url} ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml ./bin/gsign -p $signProg --signer $SIGNER --release ${VERSION}-linux --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml mv build/out/bitcoin-*.tar.gz build/out/src/bitcoin-*.tar.gz ../bitcoin-binaries/${VERSION} fi # Windows if [[ $windows = true ]] then echo "" echo "Compiling ${VERSION} Windows" echo "" ./bin/gbuild -j ${proc} -m ${mem} --commit bitcoin=${COMMIT} --url bitcoin=${url} ../bitcoin/contrib/gitian-descriptors/gitian-win.yml ./bin/gsign -p $signProg --signer $SIGNER --release ${VERSION}-win-unsigned --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win.yml mv build/out/bitcoin-*-win-unsigned.tar.gz inputs/bitcoin-win-unsigned.tar.gz mv build/out/bitcoin-*.zip build/out/bitcoin-*.exe ../bitcoin-binaries/${VERSION} fi # Mac OSX if [[ $osx = true ]] then echo "" echo "Compiling ${VERSION} Mac OSX" echo "" ./bin/gbuild -j ${proc} -m ${mem} --commit bitcoin=${COMMIT} --url bitcoin=${url} ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml ./bin/gsign -p $signProg --signer $SIGNER --release ${VERSION}-osx-unsigned --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml mv build/out/bitcoin-*-osx-unsigned.tar.gz inputs/bitcoin-osx-unsigned.tar.gz mv build/out/bitcoin-*.tar.gz build/out/bitcoin-*.dmg ../bitcoin-binaries/${VERSION} fi popd if [[ $commitFiles = true ]] then # Commit to gitian.sigs repo echo "" echo "Committing ${VERSION} Unsigned Sigs" echo "" pushd gitian.sigs git add ${VERSION}-linux/${SIGNER} git add ${VERSION}-win-unsigned/${SIGNER} git add ${VERSION}-osx-unsigned/${SIGNER} git commit -a -m "Add ${VERSION} unsigned sigs for ${SIGNER}" popd fi fi # Verify the build if [[ $verify = true ]] then # Linux pushd ./gitian-builder echo "" echo "Verifying v${VERSION} Linux" echo "" ./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-linux ../bitcoin/contrib/gitian-descriptors/gitian-linux.yml # Windows echo "" echo "Verifying v${VERSION} Windows" echo "" ./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-win-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-win.yml # Mac OSX echo "" echo "Verifying v${VERSION} Mac OSX" echo "" ./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-unsigned ../bitcoin/contrib/gitian-descriptors/gitian-osx.yml # Signed Windows echo "" echo "Verifying v${VERSION} Signed Windows" echo "" ./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-signed ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml # Signed Mac OSX echo "" echo "Verifying v${VERSION} Signed Mac OSX" echo "" ./bin/gverify -v -d ../gitian.sigs/ -r ${VERSION}-osx-signed ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml popd fi # Sign binaries if [[ $sign = true ]] then pushd ./gitian-builder # Sign Windows if [[ $windows = true ]] then echo "" echo "Signing ${VERSION} Windows" echo "" ./bin/gbuild -i --commit signature=${COMMIT} ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml ./bin/gsign -p $signProg --signer $SIGNER --release ${VERSION}-win-signed --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-win-signer.yml mv build/out/bitcoin-*win64-setup.exe ../bitcoin-binaries/${VERSION} mv build/out/bitcoin-*win32-setup.exe ../bitcoin-binaries/${VERSION} fi # Sign Mac OSX if [[ $osx = true ]] then echo "" echo "Signing ${VERSION} Mac OSX" echo "" ./bin/gbuild -i --commit signature=${COMMIT} ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml ./bin/gsign -p $signProg --signer $SIGNER --release ${VERSION}-osx-signed --destination ../gitian.sigs/ ../bitcoin/contrib/gitian-descriptors/gitian-osx-signer.yml mv build/out/bitcoin-osx-signed.dmg ../bitcoin-binaries/${VERSION}/bitcoin-${VERSION}-osx.dmg fi popd if [[ $commitFiles = true ]] then # Commit Sigs pushd gitian.sigs echo "" echo "Committing ${VERSION} Signed Sigs" echo "" git add ${VERSION}-win-signed/${SIGNER} git add ${VERSION}-osx-signed/${SIGNER} git commit -a -m "Add ${VERSION} signed binary sigs for ${SIGNER}" popd fi fi diff --git a/contrib/init/bitcoind.conf b/contrib/init/bitcoind.conf index db3dab3513..2aa82e9ecf 100644 --- a/contrib/init/bitcoind.conf +++ b/contrib/init/bitcoind.conf @@ -1,65 +1,65 @@ description "Bitcoin ABC Daemon" start on runlevel [2345] stop on starting rc RUNLEVEL=[016] env BITCOIND_BIN="/usr/bin/bitcoind" env BITCOIND_USER="bitcoin" env BITCOIND_GROUP="bitcoin" env BITCOIND_PIDDIR="/var/run/bitcoind" # upstart can't handle variables constructed with other variables env BITCOIND_PIDFILE="/var/run/bitcoind/bitcoind.pid" env BITCOIND_CONFIGFILE="/etc/bitcoin/bitcoin.conf" env BITCOIND_DATADIR="/var/lib/bitcoind" expect fork respawn respawn limit 5 120 kill timeout 60 pre-start script # this will catch non-existent config files # bitcoind will check and exit with this very warning, but it can do so # long after forking, leaving upstart to think everything started fine. # since this is a commonly encountered case on install, just check and # warn here. if ! grep -qs '^rpcpassword=' "$BITCOIND_CONFIGFILE" ; then echo "ERROR: You must set a secure rpcpassword to run bitcoind." echo "The setting must appear in $BITCOIND_CONFIGFILE" echo echo "This password is security critical to securing wallets " echo "and must not be the same as the rpcuser setting." - echo "You can generate a suitable random password using the following" + echo "You can generate a suitable random password using the following " echo "command from the shell:" echo echo "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" echo - echo "It is also recommended that you also set alertnotify so you are " + echo "It is recommended that you also set alertnotify so you are " echo "notified of problems:" echo echo "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ "admin@foo.com" echo exit 1 fi mkdir -p "$BITCOIND_PIDDIR" chmod 0755 "$BITCOIND_PIDDIR" chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_PIDDIR" chown $BITCOIND_USER:$BITCOIND_GROUP "$BITCOIND_CONFIGFILE" chmod 0660 "$BITCOIND_CONFIGFILE" end script exec start-stop-daemon \ --start \ --pidfile "$BITCOIND_PIDFILE" \ --chuid $BITCOIND_USER:$BITCOIND_GROUP \ --exec "$BITCOIND_BIN" \ -- \ -pid="$BITCOIND_PIDFILE" \ -conf="$BITCOIND_CONFIGFILE" \ -datadir="$BITCOIND_DATADIR" \ -disablewallet \ -daemon diff --git a/contrib/init/bitcoind.openrc b/contrib/init/bitcoind.openrc index 448b9e4fc0..5551d9e1cb 100644 --- a/contrib/init/bitcoind.openrc +++ b/contrib/init/bitcoind.openrc @@ -1,92 +1,92 @@ #!/sbin/runscript # backward compatibility for existing gentoo layout # if [ -d "/var/lib/bitcoin/.bitcoin" ]; then BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoin/.bitcoin" else BITCOIND_DEFAULT_DATADIR="/var/lib/bitcoind" fi BITCOIND_CONFIGFILE=${BITCOIND_CONFIGFILE:-/etc/bitcoin/bitcoin.conf} BITCOIND_PIDDIR=${BITCOIND_PIDDIR:-/var/run/bitcoind} BITCOIND_PIDFILE=${BITCOIND_PIDFILE:-${BITCOIND_PIDDIR}/bitcoind.pid} BITCOIND_DATADIR=${BITCOIND_DATADIR:-${BITCOIND_DEFAULT_DATADIR}} BITCOIND_USER=${BITCOIND_USER:-${BITCOIN_USER:-bitcoin}} BITCOIND_GROUP=${BITCOIND_GROUP:-bitcoin} BITCOIND_BIN=${BITCOIND_BIN:-/usr/bin/bitcoind} BITCOIND_NICE=${BITCOIND_NICE:-${NICELEVEL:-0}} BITCOIND_OPTS="${BITCOIND_OPTS:-${BITCOIN_OPTS}}" name="Bitcoin ABC Daemon" description="Bitcoin cryptocurrency P2P network daemon" command="/usr/bin/bitcoind" command_args="-pid=\"${BITCOIND_PIDFILE}\" \ -conf=\"${BITCOIND_CONFIGFILE}\" \ -datadir=\"${BITCOIND_DATADIR}\" \ -daemon \ ${BITCOIND_OPTS}" required_files="${BITCOIND_CONFIGFILE}" start_stop_daemon_args="-u ${BITCOIND_USER} \ -N ${BITCOIND_NICE} -w 2000" pidfile="${BITCOIND_PIDFILE}" # The retry schedule to use when stopping the daemon. Could be either # a timeout in seconds or multiple signal/timeout pairs (like # "SIGKILL/180 SIGTERM/300") retry="${BITCOIND_SIGTERM_TIMEOUT}" depend() { need localmount net } # verify # 1) that the datadir exists and is writable (or create it) # 2) that a directory for the pid exists and is writable # 3) ownership and permissions on the config file start_pre() { checkpath \ -d \ --mode 0750 \ --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ "${BITCOIND_DATADIR}" checkpath \ -d \ --mode 0755 \ --owner "${BITCOIND_USER}:${BITCOIND_GROUP}" \ "${BITCOIND_PIDDIR}" checkpath -f \ -o ${BITCOIND_USER}:${BITCOIND_GROUP} \ -m 0660 \ ${BITCOIND_CONFIGFILE} checkconfig || return 1 } checkconfig() { if ! grep -qs '^rpcpassword=' "${BITCOIND_CONFIGFILE}" ; then eerror "" eerror "ERROR: You must set a secure rpcpassword to run bitcoind." eerror "The setting must appear in ${BITCOIND_CONFIGFILE}" eerror "" eerror "This password is security critical to securing wallets " eerror "and must not be the same as the rpcuser setting." - eerror "You can generate a suitable random password using the following" + eerror "You can generate a suitable random password using the following " eerror "command from the shell:" eerror "" eerror "bash -c 'tr -dc a-zA-Z0-9 < /dev/urandom | head -c32 && echo'" eerror "" - eerror "It is also recommended that you also set alertnotify so you are " + eerror "It is recommended that you also set alertnotify so you are " eerror "notified of problems:" eerror "" eerror "ie: alertnotify=echo %%s | mail -s \"Bitcoin Alert\"" \ "admin@foo.com" eerror "" return 1 fi } diff --git a/contrib/rpm/README.md b/contrib/rpm/README.md index 4ab2f35680..e1e0745fd6 100644 --- a/contrib/rpm/README.md +++ b/contrib/rpm/README.md @@ -1,185 +1,185 @@ RPM Spec File Notes ------------------- The RPM spec file provided here is for Bitcoin-Core 0.12.0 and builds on CentOS 7 with either the CentOS provided OpenSSL library or with LibreSSL as packaged at [LibreLAMP.com](https://librelamp.com/). It should hopefully not be too difficult to port the RPM spec file to most RPM based Linux distributions. When porting the spec file to build for a particular distribution, there are some important notes. ## Sources It is considered good form for all sources to reference a URL where the source can be downloaded. Sources 0-9 should be reserved for source code tarballs. `Source0` should reference the release tarball available from https://bitcoin.org/bin/ and `Source1` should reference the BerkeleyDB source. Sources 10-99 are for source files that are maintained in the [Bitcoin git repository](https://github.com/bitcoin/bitcoin) but are not part of the release tarball. Most of these will reside in the `contrib` sub-directory. Sources 10-19 should be reserved for miscellaneous configuration files. Currently only `Source10` is used, for the example `bitcoin.conf` file. Sources 20-29 should be reserved for man pages. Currently only `Source20` through `Source23` are used. Sources 30-39 should be reserved for SELinux related files. Currently only `Source30` through `Source32` are used. Until those files are in a tagged release, the full URL specified in the RPM spec file will not work. You can get them from the git repository where you retrieved this file. Sources 100+ are for files that are not source tarballs and are not maintained in the bitcoin git repository. At present only an SVG version of the Bitcoin icon is used. ## Patches In general, patches should be avoided. When a packager feels a patch is necessary, the packager should bring the problem to the attention of the bitcoin developers so that an official fix to the issue can make it into the next release. ### Patch0 bitcoin-0.12.0-libressl.patch This patch is only needed if building against LibreSSL. LibreSSL is not the standard TLS library on most Linux distributions. The patch will likely not be needed when 0.12.1 is released, a proper fix is already in the Bitcoin git master branch. ## BuildRequires The packages specified in the `BuildRequires` are specified according to the package naming convention currently used in CentOS 7 and EPEL for CentOS 7. You may need to change some of the package names for other distributions. This is most likely to be the case with the Qt packages. ## BerkeleyDB The `build-unix.md` file recommends building against BerkeleyDB 4.8.30. Even if that is the version your Linux distribution ships with, it probably is a good idea to build Bitcoin Core against a static version of that library compiled according to the instructions in the `build-unix.md` file so that any changes the distribution may make in the future will not result in a problem for users. The problem that can exist, clients built against different versions of BerkeleyDB may not be able read each other's `wallet.dat` file which can make it difficult for a user to recover from backup in the event of a system failure. ## Graphical User Interface and Qt Version The RPM spec file will by default build the GUI client linked against the Qt5 libraries. If you wish instead to link against the Qt4 libraries you need to pass the switch `-D '_use_qt4 1'` at build time to the `rpmbuild` or `mock` command used to build the packages. If you would prefer not to build the GUI at all, you can pass the switch `-D '_no_gui 1'` to the `rpmbuild` or `mock` build command. ## Desktop and KDE Files The desktop and KDE meta files are created in the spec file itself with the `cat` command. This is done to allow easy distribution specific changes without -needing to use any patches. A specific time stamp is given to the files so that +needing to use any patches. A specific timestamp is given to the files so that it does not they do not appear to have been updated every time the package is -built. If you do make changes to them, you probably should update time stamp -assigned to them in the `touch` command that specifies the time stamp. +built. If you do make changes to them, you probably should update timestamp +assigned to them in the `touch` command that specifies the timestamp. ## SVG, PNG, and XPM Icons The `bitcoin.svg` file is from the source listed as `Source100`. It is used as the source for the PNG and XPM files. The generated PNG and XPM files are given -the same time stamp as the source SVG file as a means of indicating they are +the same timestamp as the source SVG file as a means of indicating they are derived from it. ## Systemd This spec file assumes the target distribution uses systemd. That really only matters for the `bitcoin-server` package. At this point, most RPM based distributions that still receive vendor updates do in fact use systemd. The files to control the service are created in the RPM spec file itself using the `cat` command. This is done to make it easy to modify for other distributions that may implement things differently without needing to patch -source. A specific time stamp is given to the files so that they do not appear +source. A specific timestamp is given to the files so that they do not appear to have been updated every time the package is built. If you do make changes to -them, you probably should update the time stamp assigned to them in the `touch` -command that specifies the time stamp. +them, you probably should update the timestamp assigned to them in the `touch` +command that specifies the timestamp. ## SELinux The `bitcoin-server` package should have SELinux support. How to properly do that *may* vary by distribution and version of distribution. The SELinux stuff in this RPM spec file *should* be correct for CentOS, RHEL, and Fedora but it would be a good idea to review it before building the package on other distributions. ## Tests The `%check` section takes a very long time to run. If your build system has a time limit for package build, you may need to make an exception for this package. On CentOS 7 the `%check` section completes successfully with both OpenSSL and LibreSSL, a failure really does mean something is wrong. ## LibreSSL Build Notes To build against LibreSSL you will need to pass the switch `-D '_use_libressl 1'` to the `rpmbuild` or `mock` command or the spec file will want the OpenSSL development files. ### LibreSSL and Boost LibreSSL (and some newer builds of OpenSSL) do not have support for SSLv3. This can cause issues with the Boost package if the Boost package has not been patched accordingly. On those distributions, you will either need to build Bitcoin-Core against OpenSSL or use a patched version of Boost in the build system. As SSLv3 is no longer safe, distributions that have not patched Boost to work with TLS libraries that do not support SSLv3 should have bug reports filed against the Boost package. This bug report has already been filed for RHEL 7 but it may need to be filed for other distributions. A patch for Boost: https://github.com/boostorg/asio/pull/23/files ## ZeroMQ At this time, this RPM spec file does not support the ZeroMQ build options. A suitable version of ZeroMQ is not available for the platform this spec file was developed on (CentOS 7). ## Legacy Credit This RPM spec file is largely based upon the work of Michael Hampton at [Ringing Liberty](https://www.ringingliberty.com/bitcoin/). He has been packaging Bitcoin for Fedora at least since 2012. Most of the differences between his packaging and this package are stylistic in nature. The major differences: 1. He builds from a github tagged release rather than a release tarball. This should not result in different source code. 2. He does not build BerkeleyDB but instead uses the BerkeleyDB provided by the Linux distribution. For the distributions he packages for, they currently all use the same version of BerkeleyDB so that difference is *probably* just academic. 3. As of his 10.11.2 package he did not allow for building against LibreSSL, specifying a build without the Qt GUI, or specifying which version of the Qt libraries to use. 4. I renamed the `bitcoin` package that contains the Qt GUI to `bitcoin-core` as that appears to be how the general population refers to it, in contrast to `bitcoin-xt` or `bitcoin-classic`. I wanted to make sure the general population knows what they are getting when installing the GUI package. As far as minor differences, I generally prefer to assign the file permissions in the `%files` portion of an RPM spec file rather than specifying the permissions of a file during `%install` and other minor things like that are largely just cosmetic. diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 0cf5481a80..1fd270ca90 100644 --- a/doc/REST-interface.md +++ b/doc/REST-interface.md @@ -1,98 +1,98 @@ Unauthenticated REST Interface ============================== The REST API can be enabled with the `-rest` option. The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet and port 18332 for testnet. Supported API ------------- -####Transactions +#### Transactions `GET /rest/tx/.` Given a transaction hash: returns a transaction in binary, hex-encoded binary, or JSON formats. For full TX query capability, one must enable the transaction index via "txindex=1" command line / configuration option. -####Blocks +#### Blocks `GET /rest/block/.` `GET /rest/block/notxdetails/.` Given a block hash: returns a block, in binary, hex-encoded binary or JSON formats. The HTTP request and response are both handled entirely in-memory, thus making maximum memory usage at least 2.66MB (1 MB max block, plus hex encoding) per request. With the /notxdetails/ option JSON response will only contain the transaction hash instead of the complete transaction details. The option only affects the JSON response. -####Blockheaders +#### Blockheaders `GET /rest/headers//.` Given a block hash: returns amount of blockheaders in upward direction. -####Chaininfos +#### Chaininfos `GET /rest/chaininfo.json` Returns various state info regarding block chain processing. Only supports JSON as output format. * chain : (string) current network name as defined in BIP70 (main, test, regtest) * blocks : (numeric) the current number of blocks processed in the server * headers : (numeric) the current number of headers we have validated * bestblockhash : (string) the hash of the currently best block * difficulty : (numeric) the current difficulty * verificationprogress : (numeric) estimate of verification progress [0..1] * chainwork : (string) total amount of work in active chain, in hexadecimal * pruned : (boolean) if the blocks are subject to pruning * pruneheight : (numeric) highest block available * softforks : (array) status of softforks in progress -####Query UTXO set +#### Query UTXO set `GET /rest/getutxos//-/-/.../-.` The getutxo command allows querying of the UTXO set given a set of outpoints. See BIP64 for input and output serialisation: https://github.com/bitcoin/bips/blob/master/bip-0064.mediawiki Example: ``` $ curl localhost:18332/rest/getutxos/checkmempool/b2cdfd7b89def827ff8af7cd9bff7627ff72e5e8b0f71210f92ea7a4000c5d75-0.json 2>/dev/null | json_pp { "chaintipHash" : "00000000fb01a7f3745a717f8caebee056c484e6e0bfe4a9591c235bb70506fb", "chainHeight" : 325347, "utxos" : [ { "scriptPubKey" : { "addresses" : [ "mi7as51dvLJsizWnTMurtRmrP8hG2m1XvD" ], "type" : "pubkeyhash", "hex" : "76a9141c7cebb529b86a04c683dfa87be49de35bcf589e88ac", "reqSigs" : 1, "asm" : "OP_DUP OP_HASH160 1c7cebb529b86a04c683dfa87be49de35bcf589e OP_EQUALVERIFY OP_CHECKSIG" }, "value" : 8.8687, "height" : 2147483647, "txvers" : 1 } ], "bitmap" : "1" } ``` -####Memory pool +#### Memory pool `GET /rest/mempool/info.json` Returns various information about the TX mempool. Only supports JSON as output format. * size : (numeric) the number of transactions in the TX mempool * bytes : (numeric) size of the TX mempool in bytes * usage : (numeric) total TX mempool memory usage `GET /rest/mempool/contents.json` Returns transactions in the TX mempool. Only supports JSON as output format. Risks ------------- Running a web browser on the same node with a REST enabled bitcoind can be a risk. Accessing prepared XSS websites could read out tx/block data of your node by placing links like `