Bitcoin Forum
April 19, 2024, 03:29:22 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Traversing Bitcoin by bitcoin-cli  (Read 146 times)
Tycek (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 1


View Profile
December 06, 2019, 04:03:42 PM
 #1

Hello.

I would like to ask, if it is possible with the help of bitcoin-cli to discover, if output of some transaction is spent, and if it is, which transaction it was. If it is not possible directly with bitcoin-cli, is there any other way, how to extract this information from Bitcoin blockchain?

Edit: Noticed I am maybe in a wrong category. Bitcoin Technical Support might be better place to put this question.
1713540562
Hero Member
*
Offline Offline

Posts: 1713540562

View Profile Personal Message (Offline)

Ignore
1713540562
Reply with quote  #2

1713540562
Report to moderator
Be very wary of relying on JavaScript for security on crypto sites. The site can change the JavaScript at any time unless you take unusual precautions, and browsers are not generally known for their airtight security.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713540562
Hero Member
*
Offline Offline

Posts: 1713540562

View Profile Personal Message (Offline)

Ignore
1713540562
Reply with quote  #2

1713540562
Report to moderator
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
December 06, 2019, 04:45:44 PM
 #2

If you can  create  a transaction spending the output, then  you can create a transaction and use testmempoolaccept.

Otherwise, there is no way to check whether an output was spent. It wouldn't be terribly hard to add an RPC for that, but I'm not sure of the  usefulness of this.

With a spent output, you definitely cannot find the transaction it was spent in. Bitcoin Core does not store this information because it is not useful to it. To extract that information, you would have to go through every transaction in the blockchain and store  which outpoints are spent in which transaction.

Tycek (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 1


View Profile
December 06, 2019, 07:47:13 PM
 #3

OK. How do blockexplorers work then? Because I found one API, which has this feature. Do they have any backend on the server, that tries to connect every input of a new transaction to its previous output?
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
December 07, 2019, 12:20:35 AM
 #4

OK. How do blockexplorers work then? Because I found one API, which has this feature. Do they have any backend on the server, that tries to connect every input of a new transaction to its previous output?
They don't  use Bitcoin Core, or at the very least, not stock Bitcoin Core. Instead they have their own custom  software and databases which parse and index the blockchain data so that lookups are fast. They also do other things which link together things that aren't actually linked in the blockchain, such as "input addresses".

Tycek (OP)
Newbie
*
Offline Offline

Activity: 16
Merit: 1


View Profile
December 07, 2019, 10:56:07 AM
 #5

I see. So my problem is, that I would like to get the flow of transactions somehow from the Bitcoin blockchain. I tried some blockexplorer APIs, but they seemed to be pretty unstable sometimes. What would be the good way to do it?
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!