[英]access to bitcoin node via https
i have my own bitcoin testnet node over https link and when i wanna ping it via curl 我在https链接上有自己的比特币测试网节点,当我想通过curl对其进行ping操作时
curl https://link_to node/ I have a response like curl https:// link_to node /我有一个像
JSONRPC server handles only POST requests
so it's mean that I can connect to the node and send requests to it, so I wanna connect to it via nodejs and bitcoin-core. 因此,这意味着我可以连接到该节点并向其发送请求,因此我想通过nodejs和bitcoin-core连接至该节点。 and I wanna init bitcoin object like
我想像这样初始化比特币对象
const bitcoin = require('bitcoin-core');
let client = new bitcoin({
network: 'testnet',
username: 'user',
password: 'password',
host: 'https://link_to_node/',
timeout: 30000,
port: 443
});
client.upTime((err, res) => {console.log(err, ' and ', res);})</i>
here I connected to the node and send a request about uptime of it and receive a response like 在这里,我连接到节点并发送有关其正常运行时间的请求,并收到类似的响应
Error: getaddrinfo ENOTFOUND https https:80 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26) errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'https', host: 'https', port: 80 }, isOperational: true, errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'https', host: 'https', port: 80 }
错误:GetAddrInfoReqWrap.onlookup上的getaddrinfo ENOTFOUND https https:80 [作为未完成](dns.js:57:26)errno:'ENOTFOUND',代码:'ENOTFOUND',系统调用:'getaddrinfo',主机名:'https',主机:'https',端口:80},isOperational:true,errno:'ENOTFOUND',代码:'ENOTFOUND',系统调用:'getaddrinfo',主机名:'https',主机:'https',端口:80}
So how I can connect to bitcoin node via https and bitcoin-core? 那么,如何通过https和bitcoin-core连接到bitcoin节点呢?
Bitcoin Core's JSON RPC API does not support HTTPS. Bitcoin Core的JSON RPC API不支持HTTPS。 However you can make it (on the server) only accessible through localhost (
rpcallowip=127.0.0.1
). 但是,您可以使它(在服务器上)只能通过localhost(
rpcallowip=127.0.0.1
)访问。 Tehn you could write a wrapper (PHP for example) and run this through an HTTPS web server. 您可以编写一个包装器(例如PHP)并通过HTTPS Web服务器运行它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.