json rpc – Public bitcoind rpc server

So i found a mining software which can be easily customizable , but one problem is that it says it need to run beside bitcoind to use the RPC .

I tried to install bitcoin core because it have the bitcoind software , but it takes approximately 2 weeks, two freaking week to download full block chain and prune it to 2 gb size.

So i don’t have the patience to install bitcoind on my own , is there any public bitcoin rpc server which i could just simply connect and get required data for mining from it ?

I know some people would say this means sacrificing security , trusting 3rd party to give me actual block chain and not the fake one , and trusting 3rd party that the reward from mining a block is given to my wallet and not stolen.

But i do this only as experiment purpose and for fun so i dont care. And i won’t open my wallet using public rpc anyway so i don’t mind .

bitcoind – What is the default username and password for bitcoin the rpc deamon?

What is the default username and default password for the bitcoin rpc?

I have a bitcoin daemon running, but there is no bitcoin.conf file. If I attempt to query the RPC, I get a 401 Unauthorized response

[root@host .bitcoin]# curl -i --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Basic realm="jsonrpc"
Date: Wed, 07 Sep 2021 01:23:45 GMT
Content-Length: 0
Content-Type: text/html; charset=ISO-8859-1

[root@host .bitcoin]# 

What is the username and password that bitcoin defaults to using?

json rpc – Get raw transaction from tx id without txindex=1

I’m trying to get the raw transaction hex string of a transaction that I know the id from.

I would like to do that without using txindex=1.

As I assume the transaction is unspent (and confirmed) I’m doing the following steps:

bitcoin-cli gettxout 'txid'

bitcoin-cli getblockcount

bitcoin-cli getblockhash 'blockcount - txout.confirmations + 1'

bitcoin-cli getrawtransaction 'txid' 0 'blockhash'

I have a race condition when getting the blockcount.

Is there a better way to do that?

json rpc – Is it possible to configure c-lightning cookie based auth to bitcoind as opposed to rpcuser/rpcpassword?

Is it possible to configure c-lightning cookie based authentication to bitcoind as opposed to rpcuser/rpcpassword?

Yes it works with .cookie now. It is automatic, it is the positive side effect of c-lightning invoking bitcoin-cli to communicate with bitcoind instead of handling RPC and authentication itself.

Does lightning.conf read the rpcuser/rpcpassword from bitcoin.conf?

No.

This was answered by various individuals on Twitter.

bitcoind – How to get total number of transactions from bitcoin core wallet using rpc

I’m trying to implement paginations using :

https://chainquery.com/bitcoin-api/listtransactions

I want to have reverse listing (oldest first), so I need to get total number of transaction returned by listtransactions call.

I know that getwalletinfo returns number of transactions, but listtransactions returns transaction outputs, which are more if sendmany is used.

Is there any method to get listtransactions.length without fetching all transaction in the wallet ?

wallet – Why do I get -4 error code from Bitcoin RPC

I’m directly dealing with Bitcoin RPC and my first step is loading wallet. At first I try to check listwallets to find the current wallet there. If not, trying to load wallet:

Post body = {"method":"loadwallet","params":("aaa34f5c59305e2a13d5438e0ce*****"),"id":"jsonrpc"}
Address = /wallet/aaa34f5c59305e2a13d5438e0ce*****

Sometimes as a result of loading request I get:

{"result":null,"error":{"code":-4,"message":"Wallet file verification failed: Error loading wallet aaa34f5c59305e2a13d5438e0ce*****. Duplicate -wallet filename specified."},"id":"jsonrpc"}

So, this results in error, but after some time (a couple of minutes) listwallets contains my wallet (aaa34f5c59305e2a13d5438e0ce*****). What did happen?

I also noticed that listwallets always contains 50 results. I didn’t find in the documentation about this limit but it can be somehow related.

Differences between RPC and RMI

I am studying a notes about RPC vs RMI but I understood not much of it. So asking here.

RPC supports procedural programming paradigms this is C based while RMI supports object oriented paradigms so is java based.

I understand this.

The parameters passed to Remote procedures in RPC are the ordinary data structure. But RMI transmits objects as a parameter to the remote method.

What does this mean? Can you explain this based on RMI architecture?(the first figure is RPC and second figure is RMI architecture.)

enter image description here

RPC can be considered as the older version of RMI a nd it is used in the programming languages that support procedural programming and can only use pass by value method. On the other hand RMI facility is devised based on modern programming approach which could use pass by value or reference. Another advantage of RMI is that paramters passed by reference can be changed

I understand this.

RPC protocols generates more overhead than RMI.

Like how? Can you show with an example?

The paramters passed in RPC must be "in=out" which means that the value passed to the procdeure and the output value must have the same datatype. In contrast, there is no compulsion of passing "in=out" paramters in RMI.

I don’t understand this. Can you explain with an example.

In RPC, reference could not be probably because the two processes have the distinct address space, but it is possible in case of RMI.

I don’t understand this either. Can you explain with an example

Could be possible to get the Xpub from a Bitcoin Core wallet using RPC commands?

I know in the Bitcoin Core wallet there is no easy way to extract the xpub from a wallet, but maybe with the latest changes that have been made to the core (such as the exit descriptors), there are some new commands or ways that allow me to have the xpub from a wallet.

In Electrum Wallet or other wallets, that information can be taken easily, and I know that if I import my seed in these wallets I can get the xpub, but I would like to know if it is possible to do it from the Bitcoin Core wallet or not?

json rpc – How to internally call another RPC command inside bitcoin core server?

I’m new to Bitcoin Core development, and I am trying to find a way to execute another RPC command from within a new RPC command I’m trying to add. I believe the Node interface has the executeRpc() method, but I don’t have access to a node object, at least I can’t find it. How can I make that rpc call?

electrum – trying to get text of a field in json rpc 2.0 response into ar PHP variable

I use json_decode to vardump a return which yields

array(3) { (“jsonrpc”)=> string(3) “2.0” (“result”)=> array(13) { (“status”)=> string(7) “Pending” (“amount (BTC)”)=> string(10) “0.05130899” (“index_url”)=> . . . . (more fields here) . . . (“address”)=> string(34) “1GHHojoC4Ai1SPMN3YoNzemLNaaj2XFHKc”

I am trying to fill a variable with the text from the “address” field and I tried

$result = json_decode($response, true);
$address = $result->address;

but a varbump of $addrwss is NULL

any other variant like $result->”address” or $result->(“address”) is improper syntax

Can someone tell me how to get at the text of the address field of a JSON PRC 2.0 response to put it in a variable in PHP