Bitcoin Forum
May 03, 2024, 08:56:48 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: scantxoutset example  (Read 188 times)
MixMAx123 (OP)
Full Member
***
Offline Offline

Activity: 161
Merit: 168


View Profile
October 23, 2023, 01:46:26 AM
Last edit: January 21, 2024, 01:49:22 AM by MixMAx123
 #1

please delete!
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714769808
Hero Member
*
Offline Offline

Posts: 1714769808

View Profile Personal Message (Offline)

Ignore
1714769808
Reply with quote  #2

1714769808
Report to moderator
1714769808
Hero Member
*
Offline Offline

Posts: 1714769808

View Profile Personal Message (Offline)

Ignore
1714769808
Reply with quote  #2

1714769808
Report to moderator
1714769808
Hero Member
*
Offline Offline

Posts: 1714769808

View Profile Personal Message (Offline)

Ignore
1714769808
Reply with quote  #2

1714769808
Report to moderator
seek3r
Legendary
*
Offline Offline

Activity: 1260
Merit: 1954



View Profile
October 23, 2023, 08:39:55 AM
 #2

It looks like you already found the way how to scan the outputs for a specific address.

Besides that you can also use
Code:
scantxoutset start '["raw(hex_script)"]
if you want to scan specific hex scripts.

or

Code:
scantxoutset start '["pkh(pubkey)"]
to scan P2PKH outputs of the public key you are interested in.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
NotATether
Legendary
*
Offline Offline

Activity: 1596
Merit: 6726


bitcoincleanup.com / bitmixlist.org


View Profile WWW
October 24, 2023, 12:49:47 PM
Merited by seek3r (1), Catenaccio (1), MixMAx123 (1)
 #3

Also note that in addition to the descriptor itself, you will usually have to pass the checksum of the descriptor right after it - the hash '#' followed by a bunch of letters and numbers. There are some software that can calculate this for you, but it's much easier to use getdescriptorinfo and pass the descriptor without checksum, in order to fetch it.

Example can be found here: https://developer.bitcoin.org/reference/rpc/getdescriptorinfo.html

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
nc50lc
Legendary
*
Offline Offline

Activity: 2408
Merit: 5583


Self-proclaimed Genius


View Profile
October 25, 2023, 04:36:02 AM
Merited by MixMAx123 (1)
 #4

Also note that in addition to the descriptor itself, you will usually have to pass the checksum of the descriptor right after it - the hash '#' followed by a bunch of letters and numbers.
That's only mandatory in importdescriptors command.
But scantxoutset will work regardless of the presence or absence of the checksum as of v25.0


Anyways, OP was asking for the "syntax" so most likely, he knows what arguments to include, just how to put them together which he already did in the edit.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
3dmlib
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
December 22, 2023, 08:06:37 PM
 #5

Hello.

I have following RPC code. It runs on local fully synced bitcoin core node.

JObject getAddressUtxosResponse = rpcClient.InvokeMethod("scantxoutset", "start", new[] { $"addr({bitcoinAddress})" });
JValue success = (JValue)getAddressUtxosResponse["result"]["success"];
if ((bool)success == true)
{
    // get total balance by total_amount
    JValue total_amount = (JValue)getAddressUtxosResponse["result"]["total_amount"];
    decimal totalBalance = (decimal)total_amount;
}

It return incorrect amount.
For example for address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa it returns 22.73242908 BTC, instead of correct 72.74245948 BTC.
Why this is can happen?
Thanks.
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1512
Merit: 7342


Farewell, Leo


View Profile
December 22, 2023, 08:24:45 PM
 #6

I have following RPC code. It runs on local fully synced bitcoin core node.
You'll have to be a little more explanatory. Where is this code from? Is it yours? What's the library you're using? Judging by the fact that it's C#, may I suppose it's NBitcoin?

For example for address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa it returns 22.73242908 BTC, instead of correct 72.74245948 BTC.
That particular address is the exception to the rule, because it was rewarded with the 50 non-spendable bitcoins of the genesis block. The correct amount of spendable coins is 22.73242908.

Judging by the code, it gets the total balance by summing the UTXOs. Since the block reward of genesis isn't UTXO, it doesn't count it.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
3dmlib
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
December 22, 2023, 08:38:04 PM
 #7

I have following RPC code. It runs on local fully synced bitcoin core node.
You'll have to be a little more explanatory. Where is this code from? Is it yours? What's the library you're using? Judging by the fact that it's C#, may I suppose it's NBitcoin?

For example for address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa it returns 22.73242908 BTC, instead of correct 72.74245948 BTC.
That particular address is the exception to the rule, because it was rewarded with the 50 non-spendable bitcoins of the genesis block. The correct amount of spendable coins is 22.73242908.

Judging by the code, it gets the total balance by summing the UTXOs. Since the block reward of genesis isn't UTXO, it doesn't count it.

Thanks. Code work ok then. It just a problem with this particular address. A lot needed to know about bitcoin internals. I'm heard first time about '50 non-spendable bitcoins of the genesis block'.
BitcoinCanSaveUsAll
Member
**
Offline Offline

Activity: 104
Merit: 120


View Profile
December 22, 2023, 09:47:41 PM
 #8

I believe the command syntax you're looking for would be this:

scantxoutset start "[\"addr(PasteYourAddressHere)\"]"

No need to rely on any third party blockchain explorers.  Way better privacy!
3dmlib
Newbie
*
Offline Offline

Activity: 37
Merit: 0


View Profile
December 25, 2023, 12:38:27 PM
 #9

No need to rely on any third party blockchain explorers.  Way better privacy!

Yeh. But it very slow to query this rpc call to local bitcoin core. Is any way to improve bitcoin core response time for this type of query? Thanks.
ABCbits
Legendary
*
Offline Offline

Activity: 2870
Merit: 7463


Crypto Swap Exchange


View Profile
December 26, 2023, 09:57:49 AM
 #10

No need to rely on any third party blockchain explorers.  Way better privacy!

Yeh. But it very slow to query this rpc call to local bitcoin core. Is any way to improve bitcoin core response time for this type of query? Thanks.

You either must,
1. Add that address to wallet so it'll be indexed by Bitcoin Core. First rescan is slow, but afterwards you only need to use wallet RPC call.
2. Run either self-hosted Electrum server or block-explorer which index all Bitcoin address.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
BlackHatCoiner
Legendary
*
Offline Offline

Activity: 1512
Merit: 7342


Farewell, Leo


View Profile
December 26, 2023, 02:44:31 PM
 #11

Thanks. Code work ok then. It just a problem with this particular address. A lot needed to know about bitcoin internals. I'm heard first time about '50 non-spendable bitcoins of the genesis block'.
Oh, yeah. It is mainly encyclopedic knowledge, but it might seem strange to anyone programming Bitcoin. For some reason, Satoshi decided to not include the coinbase transaction to the global transaction database (you can confirm this by getrawtransaction). Maybe he did to not be called a preminer as genesis block was mined before he released the very first Bitcoin client binaries.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!