Bitcoin Forum
November 10, 2024, 01:11:56 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Check address balance, get unspent TX, and broadcast thru bitcoind or bitcore  (Read 289 times)
copyleft (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 9


View Profile
August 19, 2019, 06:09:30 PM
Merited by LoyceV (2), Foxpup (1), ABCbits (1)
 #1

I'm getting Cloudflare blocked by Blockcypher and chain.so's APIs.

I'm told there's no performant (milliseconds) method to retrieve address balance for an address in one's bitcoin core wallet, it'd take minutes. Is bitcore's node tools a viable option for balance retrieval, getting unspent tx's, and broadcasting?

Any any insight for similar support tools for litecoin?

bonus question: referrals to any non-cloudflare baring API's that hold BTC and/or LTC blockchain data are appreciated
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
August 19, 2019, 08:58:55 PM
Merited by Foxpup (3), LoyceV (2), bones261 (2), BitMaxz (1), ABCbits (1), TalkStar (1)
 #2

If you want just the UTXO(s) and don't care about an address's transaction history, you can use Bitcoin Core's scantxoutset command (available since 0.17.0) to scan just the UTXO set and retrieve the UTXOs for a given address or script. The command will also return you the total value of the UTXOs that it found for the address or script.

Once you have the UTXOs, you can get the full transactions if you have the transaction index enabled.

copyleft (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 9


View Profile
August 20, 2019, 04:28:54 PM
Last edit: August 20, 2019, 04:43:24 PM by copyleft
 #3

If you want just the UTXO(s) and don't care about an address's transaction history, you can use Bitcoin Core's scantxoutset command (available since 0.17.0) to scan just the UTXO set and retrieve the UTXOs for a given address or script. The command will also return you the total value of the UTXOs that it found for the address or script.

Once you have the UTXOs, you can get the full transactions if you have the transaction index enabled.


Thanks for the reply. I got my bitcoind server running in testnet on localhost:18332.

I'm figuring it out, but what would the url structure look like for the POST request to the RPC server for scantxoutset?'


Edit: got it, read the API reference. You POST localhost:18332 with { id: 'jsonrpc', method: 'scantxoutset', ....relevant_args } and basic auth with your rpcuser and rpc password from your bitcoin.conf. For anyone who ends up here.
copyleft (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 9


View Profile
August 20, 2019, 05:36:03 PM
Last edit: August 20, 2019, 05:55:52 PM by copyleft
 #4

Okay, having another issue actually.

Continually getting 500 errors when POSTing with method scantxoutset:



method: 'scantxoutset',
id: 'jsonrpc',
action: "start",
scanobjects: [
        "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
        {
          "desc": "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
          "range": 1000,
        }
    ]


also tried :     [
        {
          "desc": "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
          "range": 1000,
        }
    ]

and simply:

['addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)']
500 Errror and gives me the same text from the link you sent.

I'll keep testing but, I'd love if someone can point out the error
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
August 20, 2019, 05:56:25 PM
 #5

Okay, having another issue actually.

Continually getting 500 errors when POSTing with method scantxoutset:



method: 'scantxoutset',
id: 'jsonrpc',
action: "start",
scanobjects: [
        "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
        {
          "desc": "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
          "range": 1000,
        }
    ]


also tried :     [
        {
          "desc": "addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)",
          "range": 1000,
        }
    ]

500 Errror and gives me the same text from the link you sent.

I'll keep testing but, I'd love if someone can point out the error
You've specified an address descriptor with a range, which is not valid.

Just do
Code:
["addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)"]

copyleft (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 9


View Profile
August 20, 2019, 07:12:31 PM
 #6

Code:
bitcoin-cli scantxoutset start  "[\"addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)\"]"


That works (only when I enter it as a text JSON array) but I'm having issues with getting the JSON RPC request to succeed"

BitcoinRPC class from here (ruby): https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)

btc = BitcoinRPC.new("http://rpcuser:rpcpassword@127.0.0.1:18332")

btc.getaddress    => "2NCixvAERq3eDt31jM7eYATGiHdTEcizQkj"     THIS WORKS

arguments =  { action: 'start', scanobjects: ["addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)"] }.to_json

btc.scantxoutset(arguments)  => BitcoinRPC::JSONRPCError: {"code"=>-8, "message"=>"Invalid command"}   Doesn't work...
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
August 20, 2019, 07:21:57 PM
 #7

btc.scantxoutset(arguments)  => BitcoinRPC::JSONRPCError: {"code"=>-8, "message"=>"Invalid command"}   Doesn't work...
That error means that the scantxoutset command doesn't exist in your version of Bitcoin Core. What version are you using?

copyleft (OP)
Newbie
*
Offline Offline

Activity: 13
Merit: 9


View Profile
August 20, 2019, 07:43:52 PM
 #8

Code:
$ bitcoin-cli --version
Bitcoin Core RPC client version v0.18.0.0-g2472733a24a9364e4c6233ccd04166a26a68cc65

I'm using bitcoin-cli through Ubuntu Linux subsystem and running bitcoin daemon through cmd.exe on Windows (can't seem to find the windows equivalent for bitcoin-cli for windows?)

I figure it will interface with the server running through main Windows, since it's on the same ports. I have 0.18.0 of Bitcoin Core on Windows.

achow101
Moderator
Legendary
*
Offline Offline

Activity: 3542
Merit: 6886


Just writing some code


View Profile WWW
August 20, 2019, 08:10:43 PM
Merited by bones261 (2)
 #9

It turns out Invalid command is not the error for a non-existent RPC method. It's actually saying that scantxoutset does not recognize the action that was given.

This appears to just be a question of how to pass in these parameters into the Ruby code. Unfortunately I am not very familiar with Ruby.

Could you try this line for setting arguments:
Code:
arguments =  { 'action' => 'start', 'scanobjects' => [ 'addr(mfskMRWntcPYdDgTJRJdwzdKiiHJikfvH4)' ]  }

darkv0rt3x
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
September 19, 2020, 05:59:12 PM
 #10

Hello

Sorry to use the same thread but it's about the same command in a different context.
I'm trying to use the command scantxoutset but without examples it's a bit harder to grasp it's usage.
I'm using Bitcoin Core 0.20.1 (full node) under Debian Buster.

I want to check the  utxos in a given address. I tried the following:

Code:
./bitcoin-cli scantxoutset start "[\"addr(address_here)\"]"

but either the command is taking too long to return any output or I'm misusing.

Any help?

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
HCP
Legendary
*
Offline Offline

Activity: 2086
Merit: 4361

<insert witty quote here>


View Profile
September 19, 2020, 09:35:31 PM
 #11

It can take a number of seconds/minutes to return a response to scantxoutset...

To see the percentage progress of the "current" scan, you can use the following command from another shell:
Code:
./bitcoin-cli scantxoutset status

For example, the output:
Code:
{
  "progress": 13
}
shows us that the scan is 13% complete.

█████████████████████████
████▐██▄█████████████████
████▐██████▄▄▄███████████
████▐████▄█████▄▄████████
████▐█████▀▀▀▀▀███▄██████
████▐███▀████████████████
████▐█████████▄█████▌████
████▐██▌█████▀██████▌████
████▐██████████▀████▌████
█████▀███▄█████▄███▀█████
███████▀█████████▀███████
██████████▀███▀██████████
█████████████████████████
.
BC.GAME
▄▄░░░▄▀▀▄████████
▄▄▄
██████████████
█████░░▄▄▄▄████████
▄▄▄▄▄▄▄▄▄██▄██████▄▄▄▄████
▄███▄█▄▄██████████▄████▄████
███████████████████████████▀███
▀████▄██▄██▄░░░░▄████████████
▀▀▀█████▄▄▄███████████▀██
███████████████████▀██
███████████████████▄██
▄███████████████████▄██
█████████████████████▀██
██████████████████████▄
.
..CASINO....SPORTS....RACING..
█░░░░░░█░░░░░░█
▀███▀░░▀███▀░░▀███▀
▀░▀░░░░▀░▀░░░░▀░▀
░░░░░░░░░░░░
▀██████████
░░░░░███░░░░
░░█░░░███▄█░░░
░░██▌░░███░▀░░██▌
░█░██░░███░░░█░██
░█▀▀▀█▌░███░░█▀▀▀█▌
▄█▄░░░██▄███▄█▄░░▄██▄
▄███▄
░░░░▀██▄▀


▄▄████▄▄
▄███▀▀███▄
██████████
▀███▄░▄██▀
▄▄████▄▄░▀█▀▄██▀▄▄████▄▄
▄███▀▀▀████▄▄██▀▄███▀▀███▄
███████▄▄▀▀████▄▄▀▀███████
▀███▄▄███▀░░░▀▀████▄▄▄███▀
▀▀████▀▀████████▀▀████▀▀
darkv0rt3x
Hero Member
*****
Offline Offline

Activity: 1274
Merit: 681


I rather die on my feet than to live on my knees


View Profile
September 20, 2020, 03:25:15 PM
 #12

It can take a number of seconds/minutes to return a response to scantxoutset...

To see the percentage progress of the "current" scan, you can use the following command from another shell:
Code:
./bitcoin-cli scantxoutset status

For example, the output:
Code:
{
  "progress": 13
}
shows us that the scan is 13% complete.

Yes, yesterday I replied here after I noticed that. It worked like I issued thhe command, but my message was deleted.

Thank you anyways.

Bitcoin is energy. Bitcoin is freedom
I rather die on my feet than living on my knees!
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!