diff --git a/contrib/linearize/example-linearize.cfg b/contrib/linearize/example-linearize.cfg index d019b06b6..2315898bf 100644 --- a/contrib/linearize/example-linearize.cfg +++ b/contrib/linearize/example-linearize.cfg @@ -1,43 +1,50 @@ # bitcoind RPC settings (linearize-hashes) rpcuser=someuser rpcpassword=somepassword #datadir=~/.bitcoin host=127.0.0.1 + +#mainnet default port=8332 + +#testnet default #port=18332 +#regtest default +#port=18443 + # bootstrap.dat hashlist settings (linearize-hashes) max_height=313000 # bootstrap.dat input/output settings (linearize-data) # mainnet netmagic=f9beb4d9 genesis=000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f input=/home/example/.bitcoin/blocks # testnet #netmagic=0b110907 #genesis=000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943 #input=/home/example/.bitcoin/testnet3/blocks # "output" option causes blockchain files to be written to the given location, # with "output_file" ignored. If not used, "output_file" is used instead. # output=/home/example/blockchain_directory output_file=/home/example/Downloads/bootstrap.dat hashlist=hashlist.txt # Maximum size in bytes of out-of-order blocks cache in memory out_of_order_cache_sz = 100000000 # Do we want the reverse the hash bytes coming from getblockhash? rev_hash_bytes = False # On a new month, do we want to set the access and modify times of the new # blockchain file? file_timestamp = 0 # Do we want to split the blockchain files given a new month or specific height? split_timestamp = 0 # Do we want debug printouts? debug_output = False diff --git a/contrib/rpm/bitcoin.spec b/contrib/rpm/bitcoin.spec index e35dc058e..c100d0069 100644 --- a/contrib/rpm/bitcoin.spec +++ b/contrib/rpm/bitcoin.spec @@ -1,438 +1,442 @@ %define bdbv 4.8.30 %global selinux_variants mls strict targeted %if 0%{?_no_gui:1} %define _buildqt 0 %define buildargs --with-gui=no %else %define _buildqt 1 %if 0%{?_use_qt4} %define buildargs --with-qrencode --with-gui=qt4 %else %define buildargs --with-qrencode --with-gui=qt5 %endif %endif Name: bitcoin Version: 0.12.0 Release: 2%{?dist} Summary: Peer to Peer Cryptographic Currency Group: Applications/System License: MIT URL: https://bitcoin.org/ Source0: https://bitcoin.org/bin/bitcoin-core-%{version}/bitcoin-%{version}.tar.gz Source1: http://download.oracle.com/berkeley-db/db-%{bdbv}.NC.tar.gz Source10: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/debian/examples/bitcoin.conf #man pages Source20: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoind.1 Source21: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoin-cli.1 Source22: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/doc/man/bitcoin-qt.1 #selinux Source30: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.te # Source31 - what about bitcoin-tx and bench_bitcoin ??? Source31: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.fc Source32: https://raw.githubusercontent.com/bitcoin/bitcoin/v%{version}/contrib/rpm/bitcoin.if Source100: https://upload.wikimedia.org/wikipedia/commons/4/46/Bitcoin.svg %if 0%{?_use_libressl:1} BuildRequires: libressl-devel %else BuildRequires: openssl-devel %endif BuildRequires: boost-devel BuildRequires: miniupnpc-devel BuildRequires: autoconf automake libtool BuildRequires: libevent-devel Patch0: bitcoin-0.12.0-libressl.patch %description Bitcoin is a digital cryptographic currency that uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. %if %{_buildqt} %package core Summary: Peer to Peer Cryptographic Currency Group: Applications/System Obsoletes: %{name} < %{version}-%{release} Provides: %{name} = %{version}-%{release} %if 0%{?_use_qt4} BuildRequires: qt-devel %else BuildRequires: qt5-qtbase-devel # for /usr/bin/lrelease-qt5 BuildRequires: qt5-linguist %endif BuildRequires: protobuf-devel BuildRequires: qrencode-devel BuildRequires: %{_bindir}/desktop-file-validate # for icon generation from SVG BuildRequires: %{_bindir}/inkscape BuildRequires: %{_bindir}/convert %description core Bitcoin is a digital cryptographic currency that uses peer-to-peer technology to operate with no central authority or banks; managing transactions and the issuing of bitcoins is carried out collectively by the network. This package contains the Qt based graphical client and node. If you are looking to run a Bitcoin wallet, this is probably the package you want. %endif %package libs Summary: Bitcoin shared libraries Group: System Environment/Libraries %description libs This package provides the bitcoinconsensus shared libraries. These libraries may be used by third party software to provide consensus verification functionality. Unless you know need this package, you probably do not. %package devel Summary: Development files for bitcoin Group: Development/Libraries Requires: %{name}-libs = %{version}-%{release} %description devel This package contains the header files and static library for the bitcoinconsensus shared library. If you are developing or compiling software that wants to link against that library, then you need this package installed. Most people do not need this package installed. %package server Summary: The bitcoin daemon Group: System Environment/Daemons Requires: bitcoin-utils = %{version}-%{release} Requires: selinux-policy policycoreutils-python Requires(pre): shadow-utils Requires(post): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus Requires(postun): %{_sbindir}/semodule %{_sbindir}/restorecon %{_sbindir}/fixfiles %{_sbindir}/sestatus BuildRequires: systemd BuildRequires: checkpolicy BuildRequires: %{_datadir}/selinux/devel/Makefile %description server This package provides a stand-alone bitcoin-core daemon. For most users, this package is only needed if they need a full-node without the graphical client. Some third party wallet software will want this package to provide the actual bitcoin-core node they use to connect to the network. If you use the graphical bitcoin-core client then you almost certainly do not need this package. %package utils Summary: Bitcoin utilities Group: Applications/System %description utils This package provides several command line utilities for interacting with a bitcoin-core daemon. The bitcoin-cli utility allows you to communicate and control a bitcoin daemon over RPC, the bitcoin-tx utility allows you to create a custom transaction, and the bench_bitcoin utility can be used to perform some benchmarks. This package contains utilities needed by the bitcoin-server package. %prep %setup -q %patch0 -p1 -b .libressl cp -p %{SOURCE10} ./bitcoin.conf.example tar -zxf %{SOURCE1} cp -p db-%{bdbv}.NC/LICENSE ./db-%{bdbv}.NC-LICENSE mkdir db4 SELinux cp -p %{SOURCE30} %{SOURCE31} %{SOURCE32} SELinux/ %build CWD=`pwd` cd db-%{bdbv}.NC/build_unix/ ../dist/configure --enable-cxx --disable-shared --with-pic --prefix=${CWD}/db4 make install cd ../.. ./autogen.sh %configure LDFLAGS="-L${CWD}/db4/lib/" CPPFLAGS="-I${CWD}/db4/include/" --with-miniupnpc --enable-glibc-back-compat %{buildargs} make %{?_smp_mflags} pushd SELinux for selinuxvariant in %{selinux_variants}; do make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile mv bitcoin.pp bitcoin.pp.${selinuxvariant} make NAME=${selinuxvariant} -f %{_datadir}/selinux/devel/Makefile clean done popd %install make install DESTDIR=%{buildroot} mkdir -p -m755 %{buildroot}%{_sbindir} mv %{buildroot}%{_bindir}/bitcoind %{buildroot}%{_sbindir}/bitcoind # systemd stuff mkdir -p %{buildroot}%{_tmpfilesdir} cat < %{buildroot}%{_tmpfilesdir}/bitcoin.conf d /run/bitcoind 0750 bitcoin bitcoin - EOF touch -a -m -t 201504280000 %{buildroot}%{_tmpfilesdir}/bitcoin.conf mkdir -p %{buildroot}%{_sysconfdir}/sysconfig cat < %{buildroot}%{_sysconfdir}/sysconfig/bitcoin # Provide options to the bitcoin daemon here, for example # OPTIONS="-testnet -disable-wallet" OPTIONS="" # System service defaults. # Don't change these unless you know what you're doing. CONFIG_FILE="%{_sysconfdir}/bitcoin/bitcoin.conf" DATA_DIR="%{_localstatedir}/lib/bitcoin" PID_FILE="/run/bitcoind/bitcoind.pid" EOF touch -a -m -t 201504280000 %{buildroot}%{_sysconfdir}/sysconfig/bitcoin mkdir -p %{buildroot}%{_unitdir} cat < %{buildroot}%{_unitdir}/bitcoin.service [Unit] Description=Bitcoin daemon After=syslog.target network.target [Service] Type=forking ExecStart=%{_sbindir}/bitcoind -daemon -conf=\${CONFIG_FILE} -datadir=\${DATA_DIR} -pid=\${PID_FILE} \$OPTIONS EnvironmentFile=%{_sysconfdir}/sysconfig/bitcoin User=bitcoin Group=bitcoin Restart=on-failure PrivateTmp=true TimeoutStopSec=120 TimeoutStartSec=60 StartLimitInterval=240 StartLimitBurst=5 [Install] WantedBy=multi-user.target EOF touch -a -m -t 201504280000 %{buildroot}%{_unitdir}/bitcoin.service #end systemd stuff mkdir %{buildroot}%{_sysconfdir}/bitcoin mkdir -p %{buildroot}%{_localstatedir}/lib/bitcoin #SELinux for selinuxvariant in %{selinux_variants}; do install -d %{buildroot}%{_datadir}/selinux/${selinuxvariant} install -p -m 644 SELinux/bitcoin.pp.${selinuxvariant} %{buildroot}%{_datadir}/selinux/${selinuxvariant}/bitcoin.pp done %if %{_buildqt} # qt icons install -D -p share/pixmaps/bitcoin-abc.ico %{buildroot}%{_datadir}/pixmaps/bitcoin-abc.ico install -p share/pixmaps/nsis-header.bmp %{buildroot}%{_datadir}/pixmaps/ install -p share/pixmaps/nsis-wizard.bmp %{buildroot}%{_datadir}/pixmaps/ install -p %{SOURCE100} %{buildroot}%{_datadir}/pixmaps/bitcoin.svg %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin-abc16.png -w16 -h16 %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin-abc32.png -w32 -h32 %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin-abc64.png -w64 -h64 %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin-abc128.png -w128 -h128 %{_bindir}/inkscape %{SOURCE100} --export-png=%{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png -w256 -h256 %{_bindir}/convert -resize 16x16 %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png %{buildroot}%{_datadir}/pixmaps/bitcoin-abc16.xpm %{_bindir}/convert -resize 32x32 %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png %{buildroot}%{_datadir}/pixmaps/bitcoin-abc32.xpm %{_bindir}/convert -resize 64x64 %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png %{buildroot}%{_datadir}/pixmaps/bitcoin-abc64.xpm %{_bindir}/convert -resize 128x128 %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png %{buildroot}%{_datadir}/pixmaps/bitcoin-abc128.xpm %{_bindir}/convert %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.png %{buildroot}%{_datadir}/pixmaps/bitcoin-abc256.xpm touch %{buildroot}%{_datadir}/pixmaps/*.png -r %{SOURCE100} touch %{buildroot}%{_datadir}/pixmaps/*.xpm -r %{SOURCE100} # Desktop File - change the touch timestamp if modifying mkdir -p %{buildroot}%{_datadir}/applications cat < %{buildroot}%{_datadir}/applications/bitcoin-core.desktop [Desktop Entry] Encoding=UTF-8 Name=Bitcoin Comment=Bitcoin P2P Cryptocurrency Comment[fr]=Bitcoin, monnaie virtuelle cryptographique pair à pair Comment[tr]=Bitcoin, eşten eşe kriptografik sanal para birimi Exec=bitcoin-qt %u Terminal=false Type=Application Icon=bitcoin128 MimeType=x-scheme-handler/bitcoincash; Categories=Office;Finance; EOF # change touch date when modifying desktop touch -a -m -t 201511100546 %{buildroot}%{_datadir}/applications/bitcoin-core.desktop %{_bindir}/desktop-file-validate %{buildroot}%{_datadir}/applications/bitcoin-core.desktop # KDE protocol - change the touch timestamp if modifying mkdir -p %{buildroot}%{_datadir}/kde4/services cat < %{buildroot}%{_datadir}/kde4/services/bitcoin-core.protocol [Protocol] exec=bitcoin-qt '%u' protocol=bitcoin input=none output=none helper=true listing= reading=false writing=false makedir=false deleting=false EOF # change touch date when modifying protocol touch -a -m -t 201511100546 %{buildroot}%{_datadir}/kde4/services/bitcoin-core.protocol %endif # man pages install -D -p %{SOURCE20} %{buildroot}%{_mandir}/man1/bitcoind.1 install -p %{SOURCE21} %{buildroot}%{_mandir}/man1/bitcoin-cli.1 %if %{_buildqt} install -p %{SOURCE22} %{buildroot}%{_mandir}/man1/bitcoin-qt.1 %endif # nuke these, we do extensive testing of binaries in %%check before packaging rm -f %{buildroot}%{_bindir}/test_* %check make check srcdir=src test/bitcoin-util-test.py test/functional/test_runner.py --extended %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig %pre server getent group bitcoin >/dev/null || groupadd -r bitcoin getent passwd bitcoin >/dev/null || useradd -r -g bitcoin -d /var/lib/bitcoin -s /sbin/nologin \ -c "Bitcoin wallet server" bitcoin exit 0 %post server %systemd_post bitcoin.service # SELinux if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then for selinuxvariant in %{selinux_variants}; do %{_sbindir}/semodule -s ${selinuxvariant} -i %{_datadir}/selinux/${selinuxvariant}/bitcoin.pp &> /dev/null || : done %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 8332 %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 8333 %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18332 %{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18333 +%{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18443 +%{_sbindir}/semanage port -a -t bitcoin_port_t -p tcp 18444 %{_sbindir}/fixfiles -R bitcoin-server restore &> /dev/null || : %{_sbindir}/restorecon -R %{_localstatedir}/lib/bitcoin || : fi %posttrans server %{_bindir}/systemd-tmpfiles --create %preun server %systemd_preun bitcoin.service %postun server %systemd_postun bitcoin.service # SELinux if [ $1 -eq 0 ]; then if [ `%{_sbindir}/sestatus |grep -c "disabled"` -eq 0 ]; then %{_sbindir}/semanage port -d -p tcp 8332 %{_sbindir}/semanage port -d -p tcp 8333 %{_sbindir}/semanage port -d -p tcp 18332 %{_sbindir}/semanage port -d -p tcp 18333 + %{_sbindir}/semanage port -d -p tcp 18443 + %{_sbindir}/semanage port -d -p tcp 18444 for selinuxvariant in %{selinux_variants}; do %{_sbindir}/semodule -s ${selinuxvariant} -r bitcoin &> /dev/null || : done %{_sbindir}/fixfiles -R bitcoin-server restore &> /dev/null || : [ -d %{_localstatedir}/lib/bitcoin ] && \ %{_sbindir}/restorecon -R %{_localstatedir}/lib/bitcoin &> /dev/null || : fi fi %clean rm -rf %{buildroot} %if %{_buildqt} %files core %defattr(-,root,root,-) %license COPYING db-%{bdbv}.NC-LICENSE %doc COPYING bitcoin.conf.example doc/README.md doc/bips.md doc/files.md doc/multiwallet-qt.md doc/reduce-traffic.md doc/release-notes.md doc/tor.md %attr(0755,root,root) %{_bindir}/bitcoin-qt %attr(0644,root,root) %{_datadir}/applications/bitcoin-core.desktop %attr(0644,root,root) %{_datadir}/kde4/services/bitcoin-core.protocol %attr(0644,root,root) %{_datadir}/pixmaps/*.ico %attr(0644,root,root) %{_datadir}/pixmaps/*.bmp %attr(0644,root,root) %{_datadir}/pixmaps/*.svg %attr(0644,root,root) %{_datadir}/pixmaps/*.png %attr(0644,root,root) %{_datadir}/pixmaps/*.xpm %attr(0644,root,root) %{_mandir}/man1/bitcoin-qt.1* %endif %files libs %defattr(-,root,root,-) %license COPYING %doc COPYING doc/README.md doc/shared-libraries.md %{_libdir}/lib*.so.* %files devel %defattr(-,root,root,-) %license COPYING %doc COPYING doc/README.md doc/developer-notes.md doc/shared-libraries.md %attr(0644,root,root) %{_includedir}/*.h %{_libdir}/*.so %{_libdir}/*.a %{_libdir}/*.la %attr(0644,root,root) %{_libdir}/pkgconfig/*.pc %files server %defattr(-,root,root,-) %license COPYING db-%{bdbv}.NC-LICENSE %doc COPYING bitcoin.conf.example doc/README.md doc/REST-interface.md doc/bips.md doc/dnsseed-policy.md doc/files.md doc/reduce-traffic.md doc/release-notes.md doc/tor.md %attr(0755,root,root) %{_sbindir}/bitcoind %attr(0644,root,root) %{_tmpfilesdir}/bitcoin.conf %attr(0644,root,root) %{_unitdir}/bitcoin.service %dir %attr(0750,bitcoin,bitcoin) %{_sysconfdir}/bitcoin %dir %attr(0750,bitcoin,bitcoin) %{_localstatedir}/lib/bitcoin %config(noreplace) %attr(0600,root,root) %{_sysconfdir}/sysconfig/bitcoin %attr(0644,root,root) %{_datadir}/selinux/*/*.pp %attr(0644,root,root) %{_mandir}/man1/bitcoind.1* %files utils %defattr(-,root,root,-) %license COPYING %doc COPYING bitcoin.conf.example doc/README.md %attr(0755,root,root) %{_bindir}/bitcoin-cli %attr(0755,root,root) %{_bindir}/bitcoin-tx %attr(0755,root,root) %{_bindir}/bench_bitcoin %attr(0644,root,root) %{_mandir}/man1/bitcoin-cli.1* %changelog * Fri Feb 26 2016 Alice Wonder - 0.12.0-2 - Rename Qt package from bitcoin to bitcoin-core - Make building of the Qt package optional - When building the Qt package, default to Qt5 but allow building - against Qt4 - Only run SELinux stuff in post scripts if it is not set to disabled * Wed Feb 24 2016 Alice Wonder - 0.12.0-1 - Initial spec file for 0.12.0 release # This spec file is written from scratch but a lot of the packaging decisions are directly # based upon the 0.11.2 package spec file from https://www.ringingliberty.com/bitcoin/ diff --git a/doc/REST-interface.md b/doc/REST-interface.md index 1fd270ca9..a54fbc5c4 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. +The interface runs on the same port as the JSON-RPC interface, by default port 8332 for mainnet, port 18332 for testnet, and port 18443 for regtest. Supported API ------------- #### 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 `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 `GET /rest/headers//.` Given a block hash: returns amount of blockheaders in upward direction. #### 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 `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 `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 `