<p>Nodes communicate to each other using the peer-to-peer protocol, typically using TCP port 8333. They rumor blocks and transactions to each other, request data, tell each other about other IP addresses in the network, ...</p>

<p>Each node implements the level of validation they desire; some download all blocks and validate everything (full nodes), some do that but don't keep the blocks on disk after validation (pruned full nodes), and some download only the transactions they're interested in along with proofs they wee including in the chain without verifying validity.</p>

<p>Independently, some node software also exposes an interface to communicate with users or other software using an RPC protocol. This interface however is not public for good reasons:</p>

<ul>
<li>It's usually not designed to work in adverserial settings (for example: the RPC interface may expose a command to shut down a node, or dump its private keys, ...).</li>
<li>It's not hardened against denial-of-service (DoS) attacks.</li>
<li>It's not others than the node's operator should be using anyway, as the information provided by RPC is an interpretation of what is going on in the network; it's not verifiable. So if exposed to untrusted party, node software could just lie, possibly defrauding the party using it.</li>
</ul>

CC BY-SA 4.0
2019-04-28T19:22:43.880Z
Ok, but can I try the peer-to-peer protocol, what can I do with that, and what cannot be done? (I will change the question to make that idea clear)
eloyesp
CC BY-SA 4.0
2019-04-28T20:02:27.213Z
Obviously everything can be done with the P2P protocol (it's literally how all nodes get all their information).
Pieter Wuille
CC BY-SA 4.0
2019-04-28T17:45:24.307Z
2019-04-28T17:45:24.307Z
Pieter Wuille
<p>I'm trying to understand bitcoin <del>RPC</del> Peer to Peer protocol to implement SPV on a web-application that should receive crypto payments.</p>

<p>The problem is that on the examples I found, examples are about RPC requests to a full node I'm supposed to own, but I want to query other nodes (nodes I have no user:password for).</p>

<p>As far as I understand, bitcoinj and full wallets connects to the network make requests to them without user:pass, but I could not found how that requests are built, and how can I test and try them using curl to learn how it works.</p>

<p><del>Is there a api documentation I can check and a list of nodes I can query?</del></p>

<p><del>Also, I understand that to establish a connection I should send the <code>version</code> request, but from curl I don't have a "version".</del></p>

<p>I've found <a href="https://bitcoin.org/en/developer-reference#p2p-network" rel="nofollow noreferrer">this documentation</a> about the protocol, but I've found no way to test that out in simple terms (like curl), to know what is being sent-received.</p>

<p>I want to understand what queries I can make using this protocol without running a full node.</p>

<h3>update</h3>

<p>It seems that what I wanted to know if it is possible to learn about the bitcoin protocol making test calls with curl to full-nodes (not RPC). It seems that it is not possible.</p>

<json-rpc><protocol><spv><request>
Curl bitcoin protocol for learning?
eloyesp
# Curl bitcoin protocol for learning?

(Asked by: username_0 on 2019-04-28)

I'm trying to understand bitcoin ~~RPC~~ Peer to Peer protocol to implement SPV on a web-application that should receive crypto payments.

The problem is that on the examples I found, examples are about RPC requests to a full node I'm supposed to own, but I want to query other nodes (nodes I have no user:password for).

As far as I understand, bitcoinj and full wallets connects to the network make requests to them without user:pass, but I could not found how that requests are built, and how can I test and try them using curl to learn how it works.

~~Is there a api documentation I can check and a list of nodes I can query?~~

~~Also, I understand that to establish a connection I should send the `version` request, but from curl I don't have a "version".~~

I've found [this documentation](https://bitcoin.org/en/developer-reference#p2p-network) about the protocol, but I've found no way to test that out in simple terms (like curl), to know what is being sent-received.

I want to understand what queries I can make using this protocol without running a full node.

### update

It seems that what I wanted to know if it is possible to learn about the bitcoin protocol making test calls with curl to full-nodes (not RPC). It seems that it is not possible.

**Tags:** json-rpc, protocol, spv, request


---

## 1 answers

### Answer by username_1 on 2019-04-28. Score: 1

Nodes communicate to each other using the peer-to-peer protocol, typically using TCP port 8333. They rumor blocks and transactions to each other, request data, tell each other about other IP addresses in the network, ...

Each node implements the level of validation they desire; some download all blocks and validate everything (full nodes), some do that but don't keep the blocks on disk after validation (pruned full nodes), and some download only the transactions they're interested in along with proofs they wee including in the chain without verifying validity.

Independently, some node software also exposes an interface to communicate with users or other software using an RPC protocol. This interface however is not public for good reasons:

* It's usually not designed to work in adverserial settings (for example: the RPC interface may expose a command to shut down a node, or dump its private keys, ...).
* It's not hardened against denial-of-service (DoS) attacks.
* It's not others than the node's operator should be using anyway, as the information provided by RPC is an interpretation of what is going on in the network; it's not verifiable. So if exposed to untrusted party, node software could just lie, possibly defrauding the party using it.

> **Comments:**
> **username_0**: Ok, but can I try the peer-to-peer protocol, what can I do with that, and what cannot be done? (I will change the question to make that idea clear)  
> **username_1**: Obviously everything can be done with the P2P protocol (it's literally how all nodes get all their information).  

---

