cculianu / Fulcrum

A fast & nimble SPV Server for BCH, BTC, and LTC
Other
331 stars 76 forks source link

CLI query for Balance like Electrumx_rpc #165

Closed ccryptomann closed 1 year ago

ccryptomann commented 1 year ago

with Electrumx on Linux I can do this :

# electrumx_rpc query -l 1 19a92oxiyJuftaxrVvGY9RJkAwmV2LZ3b8 
Address: 19a92oxiyJuftaxrVvGY9RJkAwmV2LZ3b8
History #0: height 356,168 tx_hash b5f419f2d53605801921b6b1bdc06ae08792385057ffdf540aab83108972fb63
UTXO #1: tx_hash e99039c5171eaa929e9bde20ad7e92acac13720b627f15ef83525da0c8ffed76 tx_pos 0 height 536,597 value 436,055,339
Balance: 5.22852901 BTC

detail : https://github.com/spesmilo/electrumx/blob/master/electrumx_rpc

is it possible to do the same thing with Fulcrum ?

cculianu commented 1 year ago

Nope, not as such. You could do something like hit the TCP RPC port with curl but that's kind of low-level since you need to translate an addres -> scripthash.

I could add something like this to the admin. I never used that command on electrum back in the day so I neglected to add it to Fulcrum, tbh. :) Do you really want something like this? It can be added...

ccryptomann commented 1 year ago

Sure I do need it, I'm a big fan of Linux CLI. So it would be better if Fulcrum support this feature too, plus high performance (according to C multiple threads compare to Electrumx python single thread) such a big heavy compete to ElectrumX.

#electrumx_rpc query -l 1 19a92oxiyJuftaxrVvGY9RJkAwmV2LZ3b8 3J3snGqFVQ67rBLzM7pn76uUWBwxS6ApBB
Address: 19a92oxiyJuftaxrVvGY9RJkAwmV2LZ3b8
History #0: height 356,168 tx_hash b5f419f2d53605801921b6b1bdc06ae08792385057ffdf540aab83108972fb63
UTXO #1: tx_hash e99039c5171eaa929e9bde20ad7e92acac13720b627f15ef83525da0c8ffed76 tx_pos 0 height 536,597 value 436,055,339
Balance: 5.22852901 BTC
Address: 3J3snGqFVQ67rBLzM7pn76uUWBwxS6ApBB
History #0: height 459,206 tx_hash b0646ecf66d275c5c1ba909e3c037ae397f83a6713b2871a1669f8054c97963d
UTXO #1: tx_hash 956917bf07e4a67442068ada461fdd4eae1c8d715a39dd1e09b2a40b90461cc1 tx_pos 0 height 459,715 value 692,788
Balance: 1.02661752 BTC
# electrumx_rpc query bc1q7cyrfmck2ffu2ud3rn5l5a8yv6f0chkp0zpemf

At this time Electrumx does not support query for bc1q Address. Only ^1 and ^3 Address.

Hope Fulcrum will handle this in soon future.

cculianu commented 1 year ago

Ah ok. Sure I will add it to my to-do list. Maybe I will get it done this week.

At this time Electrumx does not support query for bc1q Address. Only ^1 and ^3 Address.

Yeah they never bothered to implement bech32 decoding. I am not sure I will bother to implement it either to be honest. The focus of Fulcrum is BCH really. The fact that it works with Bitcoin Core is a happy accident. I am not sure I have time to code the logic for bech32 in C++, test it, and refactor the code to use it in the case of Core, but not in the case of non-Core.

Given that caveat -- I may end up supporting the new address style.. since it would be nice for users, definitely. Just no guarantees on my end that I will do that :)

ccryptomann commented 1 year ago

Such a great new ! :-)))))))))))))))))))))))))))

cculianu commented 1 year ago

Hey so I just implemented this on master. Are you able to build from source off master to try it out and give me feedback on it?

ccryptomann commented 1 year ago

Hey so I just implemented this on master. Are you able to build from source off master to try it out and give me feedback on it?

OK I'll try and feedback soon. (my fullnode is running out of disk space cause of bitcoind and electrumx, I will need a new ssd for fulcrum indexing, so it can take a couple of time for this).