簡體   English   中英

通過https訪問比特幣節點

[英]access to bitcoin node via https

我在https鏈接上有自己的比特幣測試網節點,當我想通過curl對其進行ping操作時

I have a response like 我有一個像

JSONRPC server handles only POST requests 

因此,這意味着我可以連接到該節點並向其發送請求,因此我想通過nodejs和bitcoin-core連接至該節點。 我想像這樣初始化比特幣對象

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>

在這里,我連接到節點並發送有關其正常運行時間的請求,並收到類似的響應

錯誤: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}

那么,如何通過https和bitcoin-core連接到bitcoin節點呢?

Bitcoin Core的JSON RPC API不支持HTTPS。 但是,您可以使它(在服務器上)只能通過localhost( rpcallowip=127.0.0.1 )訪問。 您可以編寫一個包裝器(例如PHP)並通過HTTPS Web服務器運行它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM