Bitcoin Forum
May 21, 2024, 04:50:14 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: RPC method listtransactions behavior in double spend attack scenario  (Read 946 times)
Satosh¡ Slot (OP)
Full Member
***
Offline Offline

Activity: 164
Merit: 100


Indie Developer


View Profile WWW
July 07, 2014, 03:29:08 PM
Last edit: July 07, 2014, 03:47:02 PM by Satosh¡ Slot
 #1

RPC method listtransactions behavior in double spend attack scenario
I am developing code to process bitcoin payments for my upcoming business venture.  I am using the RPC method listtransactions - I've found some useful information about that method's behavior in a few other posts ; my thanks to those who provided that info.  What I haven't found is how this method will behave in a double spend attack scenario.  Suppose a transaction is created and it gets to 2 confirmations (the more complex attacks) before it is detected.  Once it is detected, I need to know whether:
1)  listtransactions continues to return the transaction, OR
2)  listtransactions stops returning the transaction

And if the answer is #1, will the confirmations count returned by the method decrease?  Or just never increase?  Or is the transaction marked some other way to indicate what has happened?

Many thanks,
Defiance


Anyone know this? Also wondering what happens to 0 confirmation transactions when coins that were double spend were included in another block, effectively making the transaction most likely never confirm. Will bitcoind realize this or still report the double sent incoming transaction?

theymos
Administrator
Legendary
*
Offline Offline

Activity: 5208
Merit: 12998


View Profile
July 07, 2014, 04:07:55 PM
Last edit: July 07, 2014, 04:44:05 PM by theymos
 #2

The transaction will never be removed from listtransactions. If it's double-spent, then listtransactions will say that it has -1 confirmations. (In 2012, it would say that it had 0 confirmations -- this was improved fairly recently.)

1NXYoJ5xU91Jp83XfVMHwwTUyZFK64BoAD
Satosh¡ Slot (OP)
Full Member
***
Offline Offline

Activity: 164
Merit: 100


Indie Developer


View Profile WWW
July 08, 2014, 11:34:27 AM
 #3

The transaction will never be removed from listtransactions. If it's double-spent, then listtransactions will say that it has -1 confirmations. (In 2012, it would say that it had 0 confirmations -- this was improved fairly recently.)

Thanks theymos, this clarifies things. It also means that "getbalance account 0" will display the balance correctly and not include double spends (I assume). But what about "getbalance account -1", would that return all transactions, including double spends? (It would be an easy way to find if an account has double spent deposits).

gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4186
Merit: 8421



View Profile WWW
July 08, 2014, 01:23:36 PM
 #4

Unconfirmed non-self transactions have never been included in reported balances.
Satosh¡ Slot (OP)
Full Member
***
Offline Offline

Activity: 164
Merit: 100


Indie Developer


View Profile WWW
July 08, 2014, 03:57:44 PM
 #5

Unconfirmed non-self transactions have never been included in reported balances.

They show when I make RPC calls and specify 0 confirmations. So I get the unconfirmed balance by querying getbalance accountname 0. It always worked for me.

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!