Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: maplelake on March 01, 2020, 01:51:26 AM



Title: Does RPC support "call over internet" ?
Post by: maplelake on March 01, 2020, 01:51:26 AM
Currently bitcoin core support Rest and RPC. while REST support less apis.
RPC support invoke apis across-process .
So it aslo support call api "over internet" ?

Node_B call Node_A's api by A's ipaddress,Right ? Because RPC is implemented based on PORT communication.

Thanks




Title: Re: Does RPC support "call over internet" ?
Post by: achow101 on March 01, 2020, 02:06:09 AM
No. RPC is not exposed over the internet and it is not safe to expose it to the internet.

Nodes communicate using the P2P protocol. There is no need for another node to directly control another node using the RPC commands.


Title: Re: Does RPC support "call over internet" ?
Post by: PrimeNumber7 on March 01, 2020, 07:37:33 AM
If I am not mistaken, even if ill-advisable, you can add the rpcallowip=[IPv4/IPv6 address or with a subnet specification] line to bitcoin.conf to accept connections from external IP addresses.


Title: Re: Does RPC support "call over internet" ?
Post by: maplelake on March 01, 2020, 08:48:58 AM
No. RPC is not exposed over the internet and it is not safe to expose it to the internet.

Nodes communicate using the P2P protocol. There is no need for another node to directly control another node using the RPC commands.

There are many web-service/app which serves bitcoin. What is their tech prototype ?
As my understanding, they must enter bitcoin network by a node. How do they provide service on internet ? I guess they talk to some bitcoin core node by rest/RPC by IP address  and then expose their service by web interface.

do you know some project that i could refer its code ?
actually this question bothers me a lot for a long time...

Thanks 


Title: Re: Does RPC support "call over internet" ?
Post by: achow101 on March 01, 2020, 06:26:37 PM
There are many web-service/app which serves bitcoin. What is their tech prototype ?
As my understanding, they must enter bitcoin network by a node. How do they provide service on internet ? I guess they talk to some bitcoin core node by rest/RPC by IP address  and then expose their service by web interface.
They run Bitcoin Core as part of their backend. Their APIs and whatever else is part of their service accesses the RPCs as needed. The RPCs are never directly exposed to the internet.


Title: Re: Does RPC support "call over internet" ?
Post by: PrimeNumber7 on March 01, 2020, 06:34:58 PM
If I am not mistaken, even if ill-advisable, you can add the rpcallowip=[IPv4/IPv6 address or with a subnet specification] line to bitcoin.conf to accept connections from external IP addresses.

Alternatively you can use reverse proxy, which also could take care security problem (assuming you configure it properly).
Yes, a reverse proxy, assuming the proxy is configured to only make specific RPC commands would be better security-wise than allowing RPC access via the internet. I believe the OPs question is if it is possible to have RPC access via the internet, and the answer is that this is a very bad idea, but it is possible.
The best solution would probably be to have an intermediary DB that stores whatever information you want to be publicly available on the internet and have an API that queries the DB (similar to what achow101 described above).