bitcoin/doc
Ryan Ofsky 75118a608f
Merge bitcoin/bitcoin#27101: Support JSON-RPC 2.0 when requested by client
cbc6c440e3 doc: add comments and release-notes for JSON-RPC 2.0 (Matthew Zipkin)
e7ee80dcf2 rpc: JSON-RPC 2.0 should not respond to "notifications" (Matthew Zipkin)
bf1a1f1662 rpc: Avoid returning HTTP errors for JSON-RPC 2.0 requests (Matthew Zipkin)
466b90562f rpc: Add "jsonrpc" field and drop null "result"/"error" fields (Matthew Zipkin)
2ca1460ae3 rpc: identify JSON-RPC 2.0 requests (Matthew Zipkin)
a64a2b77e0 rpc: refactor single/batch requests (Matthew Zipkin)
df6e3756d6 rpc: Avoid copies in JSONRPCReplyObj() (Matthew Zipkin)
09416f9ec4 test: cover JSONRPC 2.0 requests, batches, and notifications (Matthew Zipkin)
4202c170da test: refactor interface_rpc.py (Matthew Zipkin)

Pull request description:

  Closes https://github.com/bitcoin/bitcoin/issues/2960

  Bitcoin Core's JSONRPC server behaves with a special blend of 1.0, 1.1 and 2.0 behaviors. This introduces compliance issues with more strict clients. There are the major misbehaviors that I found:
  - returning non-200 HTTP codes for RPC errors like "Method not found" (this is not a server error or an HTTP error)
  - returning both `"error"` and `"result"` fields together in a response object.
  - different error-handling behavior for single and batched RPC requests (batches contain errors in the response but single requests will actually throw HTTP errors)

  https://github.com/bitcoin/bitcoin/pull/15495 added regression tests after a discussion in https://github.com/bitcoin/bitcoin/pull/15381 to kinda lock in our RPC behavior to preserve backwards compatibility.

  https://github.com/bitcoin/bitcoin/pull/12435 was an attempt to allow strict 2.0 compliance behind a flag, but was abandoned.

  The approach in this PR is not strict and preserves backwards compatibility in a familiar bitcoin-y way: all old behavior is preserved, but new rules are applied to clients that opt in. One of the rules in the [JSON RPC 2.0 spec](https://www.jsonrpc.org/specification#request_object) is that the kv pair `"jsonrpc": "2.0"` must be present in the request. Well, let's just use that to trigger strict 2.0 behavior! When that kv pair is included in a request object, the [response will adhere to strict JSON-RPC 2.0 rules](https://www.jsonrpc.org/specification#response_object), essentially:

  - always return HTTP 200 "OK" unless there really is a server error or malformed request
  - either return `"error"` OR `"result"` but never both
  - same behavior for single and batch requests

  If this is merged next steps can be:

  - Refactor bitcoin-cli to always use strict 2.0
  - Refactor the python test framework to always use strict 2.0 for everything
  - Begin deprecation process for 1.0/1.1 behavior (?)

  If we can one day remove the old 1.0/1.1 behavior we can clean up the rpc code quite a bit.

ACKs for top commit:
  cbergqvist:
    re ACK cbc6c440e3
  ryanofsky:
    Code review ACK cbc6c440e3. Just suggested changes since the last review: changing uncaught exception error code from PARSE_ERROR to MISC_ERROR, renaming a few things, and adding comments.
  tdb3:
    re ACK for cbc6c440e3

Tree-SHA512: 0b702ed32368b34b29ad570d090951a7aeb56e3b0f2baf745bd32fdc58ef68fee6b0b8fad901f1ca42573ed714b150303829cddad4a34ca7ad847350feeedb36
2024-05-16 10:18:04 -04:00
..
design doc: fix broken relative md links 2024-05-03 16:07:12 +01:00
man
policy [doc] fix docs and comments from v3 2024-02-12 14:27:25 +00:00
release-notes doc: archive 27.0 release notes 2024-04-16 09:10:33 +01:00
.gitignore
assets-attribution.md
benchmarking.md doc: update doc/benchmarking.md 2021-06-24 11:15:29 +02:00
bips.md doc: document that BIP324 on by default for v27.0 2024-02-19 15:37:59 +00:00
bitcoin_logo_doxygen.png
bitcoin-conf.md Security config warning 2022-08-19 23:18:13 -04:00
build-android.md build, qt: Use Android NDK r23 LTS 2021-12-05 03:00:02 +02:00
build-freebsd.md doc: suggest only necessary Qt packages for installation on FreeBSD 2024-04-24 14:14:18 +02:00
build-netbsd.md doc: update for NetBSD 9.2, add GUI Build Instructions 2022-07-06 21:27:05 -04:00
build-openbsd.md doc: Suggest only necessary Qt packages for installation on OpenBSD 2024-04-24 09:17:48 +01:00
build-osx.md doc: add LLVM instruction for macOS < 13 2024-04-29 10:33:21 +02:00
build-unix.md Merge bitcoin/bitcoin#29756: doc: Override -g properly to skip debugging information 2024-04-01 16:54:44 +02:00
build-windows.md doc: remove mingw-w64 install for "older" systems 2023-11-17 10:57:51 +00:00
cjdns.md doc: update getnodeaddresses for CJDNS, I2P and Tor and rm link 2023-06-01 15:52:51 +02:00
dependencies.md depends: miniupnpc 2.2.7 2024-04-30 10:07:19 +08:00
descriptors.md doc: Add example of mixing private and public keys in descriptors 2024-03-15 16:28:43 +03:00
developer-notes.md doc: fix broken relative md links 2024-05-03 16:07:12 +01:00
dnsseed-policy.md Update the developer mailing list address. 2024-04-02 15:38:40 -03:00
Doxyfile.in Generate doxygen documentation for test sources 2021-05-19 22:08:18 -07:00
external-signer.md wallet: compare address returned by displayaddress 2024-04-16 17:47:43 +02:00
files.md Ignore banlist.dat 2021-07-30 11:21:51 +02:00
fuzzing.md doc: remove references to disable-asm option now that it's gone 2024-02-29 19:10:31 +00:00
guix.md
i2p.md doc: i2p: improve -i2pacceptincoming mention 2024-04-04 18:32:39 -03:00
init.md Remove -sysperms option 2023-02-05 08:09:16 +00:00
JSON-RPC-interface.md doc: add comments and release-notes for JSON-RPC 2.0 2024-05-14 11:28:48 -04:00
managing-wallets.md doc: explain what the wallet password does 2024-04-22 18:07:23 +03:00
multiprocess.md doc: Add multiprocess design doc 2023-12-22 16:23:33 -05:00
multisig-tutorial.md doc: update multisig-tutorial.md to default wallet type 2022-03-10 12:50:34 +01:00
offline-signing-tutorial.md doc: update signet faucet link in offline-signing-tutorial.md 2024-03-04 00:14:29 +07:00
p2p-bad-ports.md init, doc: improve -onlynet help and tor/i2p documentation 2022-03-03 16:14:01 +01:00
productivity.md doc: add distcc to productivity notes 2022-06-13 16:13:11 +02:00
psbt.md doc: M-of-N multisig using descriptor wallets and PSBTs, as well as a signing flow 2021-08-16 10:43:07 +05:00
README_doxygen.md
README_windows.txt
README.md remove libbitcoinconsensus 2024-03-18 16:59:39 +00:00
reduce-memory.md doc: Be vague instead of wrong about MALLOC_ARENA_MAX 2023-09-20 17:12:24 +00:00
reduce-traffic.md doc: update/clarify max outbound connection count 2023-12-11 20:05:25 +01:00
release-notes-27101.md doc: add comments and release-notes for JSON-RPC 2.0 2024-05-14 11:28:48 -04:00
release-notes-27114.md docs: add release notes for #27114 2024-02-28 10:05:56 -03:00
release-notes-27375.md doc: add release notes and help text for unix sockets 2024-03-01 14:47:29 -05:00
release-notes-27679.md doc: release notes for PR 27679 2024-04-16 14:14:42 -04:00
release-notes-29845.md rpc: return warnings as an array instead of just a single one 2024-05-01 14:44:57 +01:00
release-notes-empty-template.md doc: add minimum required Linux Kernel to release-notes 2023-12-07 13:53:41 +00:00
release-process.md [doc] update release-process.md and backports section of CONTRIBUTING 2024-04-18 17:07:57 +01:00
REST-interface.md Merge bitcoin/bitcoin#26207: rest: add verbose and mempool_sequence query params for mempool/contents 2023-03-15 19:39:30 -04:00
tor.md Merge bitcoin/bitcoin#27719: doc: remove Tor link & generalize onion getnodeaddresses RPC 2023-06-01 15:24:23 +01:00
tracing.md Use int32_t type for most transaction size/weight values 2023-06-12 19:47:19 +01:00
translation_process.md doc: Update translation_process.md 2024-02-14 21:39:39 -03:00
translation_strings_policy.md
zmq.md validationinterface: only send zmq notifications for active 2023-09-30 06:38:47 -04:00

Bitcoin Core

Setup

Bitcoin Core is the original Bitcoin client and it builds the backbone of the network. It downloads and, by default, stores the entire history of Bitcoin transactions, which requires a few hundred gigabytes of disk space. Depending on the speed of your computer and network connection, the synchronization process can take anywhere from a few hours to a day or more.

To download Bitcoin Core, visit bitcoincore.org.

Running

The following are some helpful notes on how to run Bitcoin Core on your native platform.

Unix

Unpack the files into a directory and run:

  • bin/bitcoin-qt (GUI) or
  • bin/bitcoind (headless)

Windows

Unpack the files into a directory, and then run bitcoin-qt.exe.

macOS

Drag Bitcoin Core to your applications folder, and then run Bitcoin Core.

Need Help?

Building

The following are developer notes on how to build Bitcoin Core on your native platform. They are not complete guides, but include notes on the necessary libraries, compile flags, etc.

Development

The Bitcoin repo's root README contains relevant information on the development process and automated testing.

Resources

Miscellaneous

License

Distributed under the MIT software license.