<p>I got most of my answers <a href="https://electrum.readthedocs.io/en/latest/merchant.html" rel="nofollow noreferrer">here</a>.</p>

<blockquote>
  <p>Note that HTTP basic auth sends the username and the password unencrypted as part of the request. While using it on localhost is fine in our opinion, using it across an untrusted LAN or the Internet is not secure. Hence, you should take further measures in such cases, such as wrapping the connection in a secure tunnel. For further details, read <a href="https://bitcoin.org/en/release/v0.12.0#rpc-ssl-support-dropped" rel="nofollow noreferrer">this</a>.</p>
</blockquote>

<p>So it sounds like i'll have to build a PHP wrapper myself, or use a SSL tunnel. (Not excited at all)</p>

CC BY-SA 4.0
2019-12-03T07:10:01.707Z
2019-12-03T07:10:01.707Z
rockstardev
<p>I am able to execute calls on the server from the server. When I say calls, I mean like <a href="https://bitcoin.stackexchange.com/questions/51499/checking-polling-a-balance-of-an-address-in-electrum-via-the-command-line-rpc">this</a>. I.e. I can get the latest addresses doing something like this:</p>

<pre><code>$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:7777");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"id\":\"curltext\",\"method\":\"listaddresses\"}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
print '&lt;pre&gt;';
print_r($result);
</code></pre>

<p>The problem is, I don't want to have to execute this on the server. I was hoping there would be a secure way to execute this remotely. </p>

<p>Can someone please tell me if this is possible? I tried opening port 7777, but still can't access it. Is it perhaps on purpose? As I can imagine this being a security problem.</p>

<p>Thanks!</p>

<electrum>
How to access Electrum remotely via the rest api?
rockstardev
# How to access Electrum remotely via the rest api?

(Asked by: username_0 on 2019-12-03)

I am able to execute calls on the server from the server. When I say calls, I mean like this. I.e. I can get the latest addresses doing something like this:
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1:7777");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "{\"id\":\"curltext\",\"method\":\"listaddresses\"}");
curl_setopt($ch, CURLOPT_POST, 1);

$headers = array();
$headers[] = "Content-Type: application/x-www-form-urlencoded";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close ($ch);
print '';
print_r($result);

The problem is, I don't want to have to execute this on the server. I was hoping there would be a secure way to execute this remotely. 
Can someone please tell me if this is possible? I tried opening port 7777, but still can't access it. Is it perhaps on purpose? As I can imagine this being a security problem.
Thanks!

**Tags:** electrum


---

## 1 answers

### Answer by username_0 on 2019-12-03. Score: 0

I got most of my answers [here](https://electrum.readthedocs.io/en/latest/merchant.html).

> Note that HTTP basic auth sends the username and the password unencrypted as part of the request. While using it on localhost is fine in our opinion, using it across an untrusted LAN or the Internet is not secure. Hence, you should take further measures in such cases, such as wrapping the connection in a secure tunnel. For further details, read [this](https://bitcoin.org/en/release/v0.12.0#rpc-ssl-support-dropped).

So it sounds like i'll have to build a PHP wrapper myself, or use a SSL tunnel. (Not excited at all)


---

