SatoshiPortal / cyphernode

Modular Bitcoin full-node microservices API server architecture and utilities toolkit to build scalable, secure and featureful apps and services without trusted third parties
MIT License
362 stars 68 forks source link

Remote RPC bitcoin node #240

Open BytesTrust opened 2 years ago

BytesTrust commented 2 years ago

I try to use remote cyphernode with a remote node rpc it not working any help on that ? https://www.quicknode.com/

Kexkey commented 2 years ago

Hi @BytesTrust

I don't know about QuickNode, but if you want to use your Bitcoin node RPC, you need to expose it outside of your Docker network (it's one of the questions during Cyphernode's setup). Remember the username/password you entered for RPC during setup, those will be your credentials to use the RPC. You can look at them in your bitcoin.conf generated file.

Of course, there are more considerations, but I don't know about your exact situation. If you want to access the RPC remotely, you need to forward ports on your router. If you'd like to expose the RPC on Tor, you need to do it manually inside the torrc file.

We don't recommend exposing the RPC interface to the outside world for security reasons.

Kexkey commented 2 years ago

Oops sorry I made a mistake, the rpc port is not exposed by the setup. Only the p2p port.

I will write the steps to expose it manually outside of the docker network as well as Tor.

BytesTrust commented 2 years ago

Basically I am trying to connect Cyphernode to a remote Bitcoin RPC node.

Umbrel I try to connect change Cyphernode bitcoin RPC Umbrel . i went to cyphernode bitcoin.conf and changed the rpc information and it dint work I try to do the same thing with Quick node P2P connection information dint work to.

I try to change RPC information in cyphernode specter and click test dint work also. It seem cyphernode specter is broke almost 80 percent of feature as problem .. tor dont even work

I dont want to use cyphernode Bitcoin node RPC because the current pricing to host a bitcoin node in the clound with the size of the bitcoin db is very expensive @Kexkey

Kexkey commented 2 years ago

Yes, that is because the RPC port is not publish outside the cyphernodenet Docker network. If you want to publish it so you can access it from your host (at localhost:8332 for instance), you can add this in dist/docker-compose.yaml:

  ##########################
  # BITCOIN                #
  ##########################

  bitcoin:
    image: cyphernode/bitcoin:v22.0
    command: $USER /.bitcoin/entrypoint.sh

    ports:
      - "8333:8333"
      - "8332:8332"

Make sure to run ./start.sh to make the change effective. If something strange happens, run ./stop.sh first, wait for the stack to shutdown, then ./start.sh.

If you re-run ./setup.sh, it will recreate docker-compose.yaml and overwrite your changes. If you want to make them permanent, you need to add the 8332 line in the template file and build cyphernode yourself (with ./build.sh in root dir): cyphernodeconf_docker/templates/installer/docker/docker-compose.yaml.

BytesTrust commented 2 years ago

Not working at all cyphernode is not able to reach the remote rpc bitcoin node running over tor on a other server

Kexkey commented 2 years ago

TL;DR: we don't support having an external Bitcoin node.

Oh you want to use an external Bitcoin node! We used to support that 4 years ago but removed it because we had too many possible combinations to support. While it is possible to do it, it can easily become a networking challenge, depending on the setup.

Ex.: I'd suggest you use a VPN between the Cyphernode instance and the Bitcoin node to make it secure. Now, you need to decide what kind of VPN and you need to configure it. I personally use Wireguard. If you decide to deploy the remote Bitcoin node in the Docker Swarm, you need to use a VPN that is compatible with it; it must not be IPSec-based because the Encrypted Docker Overlay networks are IPSec-based (using protocol 50/ESP for eg). On the cloud side, don't forget to open the required ports (depending on the VPN) and in Cyphernode, you will need to unlock the "external Bitcoin node" configuration here:

https://github.com/SatoshiPortal/cyphernode/blob/master/cyphernodeconf_docker/prompters/900_bitcoin.js#L36

and see if it works. Last time we used that was in 2018 so I have no idea if it would still work just by adding the external choice.

If you only want to use the remote Bitcoin datadir (not the node itself), you could make a NFS drive to the bitcoin dir through, once again, a VPN and mount it on the host where your CN instance resides. Then you could simply put that path in the CN setup for the Bitcoin data path. It may be a bit easier. But I remember reading about problems with Bitcoin Core when the datadir is on a network drive... I'm not 100% sure.

BytesTrust commented 2 years ago

Where do you host cypher-node that wont cost 200 dollar per month ? @Kexkey