[ad_1]
I’m having troubles retrieving the balance of taproot addresses from a self-hosted Electrs (Electrum Server).
First of all I’m getting the scriptPubKey from Bitcoin Core:
{
"isvalid": true,
"address": "...",
"scriptPubKey": "...",
"isscript": true,
"iswitness": true,
"witness_version": 1,
"witness_program": "..."
}
Then I’m using this PHP code to query the balance from the Electrs server:
$addrScripthash = hash('sha256', hex2bin($address_info['scriptPubKey']));
$re="/.{2}/";
preg_match_all($re, $addrScripthash, $matches, PREG_PATTERN_ORDER, 0);
$addrScripthash = implode('', array_reverse($matches[0]));
$electrs->sendRequest('blockchain.scripthash.subscribe', array($addrScripthash))->result;
var_export($electrs->sendRequest('blockchain.scripthash.get_balance', array($addrScripthash))->result);
Unfortunately it seems to hang while it used to work just fine with Segwit addresses. Am I doing something wrong?
[ad_2]
Source link