<p>When it comes to bandwidth and CPU usage (for serializing/deserializing), JSON is a terrible format.  It literally passes a label with every single field, regardless of how often that field is repeated.  It also passes numbers (both floating point and integer) as strings, which again, wastes bandwidth.  This does not scale well at all.</p>

<p>JSON is designed to be used with flexible object schemas, where you don't know ahead of time which fields your data may or may not contain.  That's why all the labelling is required.  Since this isn't a problem that Bitcoin has, there is no real advantage to using a flexible data format.</p>

<p>It's a tradeoff between bandwidth/cpu versus flexibility, and Bitcoin data does not need the flexibility.</p>

CC BY-SA 3.0
2017-07-18T21:22:39.690Z
2017-07-18T21:22:39.690Z
Jestin
<p>It would:</p>

<ul>
<li>Use significantly more CPU to parse the incoming data (and running a node is already intensive, especially when processing an incoming block).</li>
<li>Use significantly more bandwidth.</li>
</ul>

<p>It would not:</p>

<ul>
<li>Remove the need for nodes to know about the binary format, as that is used for defining the (protocol-defined) hashes of transactions, blocks, and other structures.</li>
</ul>

<p>So if you're going to need to implement the binary format anyway for hashing, why bother implementing another more expensive, less efficient layer on top, and incur the complexity of the conversion?</p>

CC BY-SA 3.0
2017-07-18T20:45:08.823Z
2017-07-18T20:45:08.823Z
Pieter Wuille
<p>Wouldn't be easier for the nodes to just build the messages with JSON, then encode it to bytes so it can be transmitted over TCP/IP? I'm not talking about JSON-RPC, but the communication between nodes.</p>

<bitcoin-core>
Why bitcoin protocol does not use JSON instead of low level data structures?
John Smith
# Why bitcoin protocol does not use JSON instead of low level data structures?

(Asked by: username_0 on 2017-07-18)

Wouldn't be easier for the nodes to just build the messages with JSON, then encode it to bytes so it can be transmitted over TCP/IP? I'm not talking about JSON-RPC, but the communication between nodes.

**Tags:** bitcoin-core


---

## 2 answers

### Answer by username_2 on 2017-07-18. Score: 3 | Accepted answer

It would:

* Use significantly more CPU to parse the incoming data (and running a node is already intensive, especially when processing an incoming block).
* Use significantly more bandwidth.

It would not:

* Remove the need for nodes to know about the binary format, as that is used for defining the (protocol-defined) hashes of transactions, blocks, and other structures.

So if you're going to need to implement the binary format anyway for hashing, why bother implementing another more expensive, less efficient layer on top, and incur the complexity of the conversion?


---

### Answer by username_1 on 2017-07-18. Score: 0

When it comes to bandwidth and CPU usage (for serializing/deserializing), JSON is a terrible format. It literally passes a label with every single field, regardless of how often that field is repeated. It also passes numbers (both floating point and integer) as strings, which again, wastes bandwidth. This does not scale well at all.

JSON is designed to be used with flexible object schemas, where you don't know ahead of time which fields your data may or may not contain. That's why all the labelling is required. Since this isn't a problem that Bitcoin has, there is no real advantage to using a flexible data format.

It's a tradeoff between bandwidth/cpu versus flexibility, and Bitcoin data does not need the flexibility.


---

