I reply to all queries on the forums and via email, once per day, Monday to Friday (not weekends).

If you are new here, please see some information on how to ask for support. Thank you!

How to "connect RPC API on a different machine than that of your WordPress"

dashed-slug.net Forums General discussion How to "connect RPC API on a different machine than that of your WordPress"

Tagged: , ,

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #6286
    Anonymous
    Inactive

    My wordpress site is hosted on a different provider than my bitcoin node. I have a simple Ubuntu VPS running my bitcoin node that I access via SSH CLI.

    There is a link provided which takes you to: https://en.bitcoin.it/wiki/Enabling_SSL_on_original_client_daemon
    which is not very helpful. I’ve been trying to research the best way to do this, but have come across a LOT of different information.

    Has anyone done this? What method did you use? Would this section of here be a good option:
    “Access a server using an SSH tunnel on Linux and Mac OS X” from https://docs.bitnami.com/google/faq/get-started/access-ssh-tunnel/

    #6288
    alexg
    Keymaster

    Generally there are two difficulties:

    1. Make sure that the firewalls on the wallet server allow incoming TCP connections to the wallet’s RPC API. Before trying to connect using WordPress, it might be worth trying to connect using bitcoin-cli or even nc. Check your firewalls, ip filters, etc.

    2. Once you get the connection to work, the next problem is that it’s not encrypted. You can’t use SSL as it was removed from bitcoind. You can set up an ssh tunnel to encrypt the connection, but the difficulty here is to maintain the tunnel even after server restart. Have a look here to get an idea of what’s involved: https://gist.github.com/EnigmaCurry/bdd9fd28d7a73fe52eb4 The first step is to open the tunnel using ssh from your WordPress host to the remote wallet’s socket. Then make the plugin connect to the local port instead of the remote one. Once you get this to work, you can setup a unix cron job that checks if the tunnel exists and if not, recreate it. In the script above you can see how to use netstat to check if the port is open.

    Best of luck!

    #6289
    Anonymous
    Inactive

    Thanks for the reply. I am having problems just getting the adapter connected to my node.

    I have my wordpress site hosted on a shared IP. I don’t see access to a firewall, but I can tell that port 8332 is blocked to my wordpress site. Do you think I need a dedicated IP for my WP site in order to do this?

    #6290
    Anonymous
    Inactive

    The 8332 port on the bitcoin node is open, so we are good there.

    #6291
    Anonymous
    Inactive

    Also, I’m now a paying member:

    Subscription Details
    Monthly Premium Membership – 1 site
    Terms
    $4.00 USD for each month
    Effective Date: May 10, 2019
    Purchase details
    Receipt number: 5KT8355389487074G

    #6293
    Anonymous
    Inactive

    Also, some of the pages within the plugin don’t “look” right. I see doubles of things and no save button, etc… see attachment.

    Attachments:
    You must be logged in to view attached files.
    #6295
    Anonymous
    Inactive

    OK. I’ve figured some more out: Once I delete and re-add your plug-in, I can see all the options in the bitcoin node section again including the Save button. As soon as I enable it, I get the double menu I showed you above. Also, accessing every other plugin or option in my word-press site takes 20 times longer than before, and in fact, getting to your plug-in options, takes up to 45 seconds (which use to take 1-2 seconds to access). Something happens when the Bitcoin node section of your plug-in gets enabled that “breaks” my site.

    #6296
    Anonymous
    Inactive

    @realslug

    please check the following link hope this helps you…

    SSH Tunneling

    #6298
    alexg
    Keymaster

    @realslug Hello, the 45 second delay is almost definitely a TCP timeout. This means that some firewall is blocking you. If your hosting plan is managed then you need to negotiate this with your hosting provider. If you are on an unmanaged machine (where you hold the root account), then you need to check your firewalls. In any case, this type of delay is always due to a firewall of some type.

    Thank you @san for posting this link. It will be relevant after the OP manages to connect to the wallet directly.

    with regards

    #6299
    Anonymous
    Inactive

    Thanks for the help. Are there particular ports that need to be opened? 8332, etc? Or do I need to ask them to open everything to the WAN?

    #6300
    Anonymous
    Inactive

    I’ll ask them to open everything from my node.

    #6301
    Anonymous
    Inactive

    They said they can open some ports but need to know which ones. 8332, and?

    #6302
    Anonymous
    Inactive

    That was it guys! They opened that port and it’s responding now. Thanks! Now to move onto the ssh / stunnel work.

    #6304
    alexg
    Keymaster

    Hello,

    It wouldn’t be smart to open all ports. Firewalls are there for a reason.

    As you found out, bitcoin wallets by default require *incoming* TCP connections to 8332 for the RPC API and 8333 for P2P communication. The plugin connects to the RPC API. You can always change these default numbers with the settings port and rpcport (see https://en.bitcoin.it/wiki/Running_Bitcoin ). This also means that *outgoing* TCP 8332 must be allowed from your WordPress site.

    Best of luck with setting up the tunnel, let me know if you have any questions.

    with regards

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.