dashed-slug.net › Forums › General discussion › How to "connect RPC API on a different machine than that of your WordPress"
- This topic has 13 replies, 3 voices, and was last updated 5 years, 7 months ago by alexg.
-
AuthorPosts
-
May 9, 2019 at 8:50 pm #6286AnonymousInactive
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/May 10, 2019 at 9:22 am #6288alexgKeymasterGenerally 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!
May 10, 2019 at 6:39 pm #6289AnonymousInactiveThanks 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?
May 10, 2019 at 6:57 pm #6290AnonymousInactiveThe 8332 port on the bitcoin node is open, so we are good there.
May 10, 2019 at 10:32 pm #6291AnonymousInactiveAlso, 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: 5KT8355389487074GMay 10, 2019 at 11:20 pm #6293AnonymousInactiveAlso, 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.May 12, 2019 at 4:04 pm #6295AnonymousInactiveOK. 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.
May 13, 2019 at 6:45 am #6296AnonymousInactiveMay 13, 2019 at 9:11 am #6298alexgKeymaster@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
May 13, 2019 at 3:36 pm #6299AnonymousInactiveThanks 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?
May 13, 2019 at 5:26 pm #6300AnonymousInactiveI’ll ask them to open everything from my node.
May 13, 2019 at 6:47 pm #6301AnonymousInactiveThey said they can open some ports but need to know which ones. 8332, and?
May 13, 2019 at 7:32 pm #6302AnonymousInactiveThat was it guys! They opened that port and it’s responding now. Thanks! Now to move onto the ssh / stunnel work.
May 14, 2019 at 8:19 am #6304alexgKeymasterHello,
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
andrpcport
(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
-
AuthorPosts
- You must be logged in to reply to this topic.