Bitcoin Forum
December 18, 2017, 08:20:46 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: RPC "GetBalance" when does it increment?  (Read 1012 times)
TangibleCryptography
Sr. Member
****
Offline Offline

Activity: 476


Tangible Cryptography LLC


View Profile WWW
August 01, 2012, 02:09:11 PM
 #1

When does "GetBalance" increment?
When the bitcoind receives a 0-confirm tx, after 1 confirmation, after 6?
Can this be modified short of modifying the source code and recompiling?
1513585246
Hero Member
*
Offline Offline

Posts: 1513585246

View Profile Personal Message (Offline)

Ignore
1513585246
Reply with quote  #2

1513585246
Report to moderator
1513585246
Hero Member
*
Offline Offline

Posts: 1513585246

View Profile Personal Message (Offline)

Ignore
1513585246
Reply with quote  #2

1513585246
Report to moderator
1513585246
Hero Member
*
Offline Offline

Posts: 1513585246

View Profile Personal Message (Offline)

Ignore
1513585246
Reply with quote  #2

1513585246
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1513585246
Hero Member
*
Offline Offline

Posts: 1513585246

View Profile Personal Message (Offline)

Ignore
1513585246
Reply with quote  #2

1513585246
Report to moderator
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1484


View Profile
August 01, 2012, 02:36:54 PM
 #2

When does "GetBalance" increment?
When the bitcoind receives a 0-confirm tx, after 1 confirmation, after 6?
Can this be modified short of modifying the source code and recompiling?

Had to ask sipa for the answer:  1 for external transactions, 0 for change or send-to-self ones


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
August 01, 2012, 02:51:09 PM
 #3

Ah.  No wonder why I couldn't figure it out.  I first assumed it was 0 but then I noticed a delay so I figured it was 1 but that wasn't always consistent.  I didn't think of the possibility that "from self" would be handled differently.

So that leads me to my followup question.  It isn't possible to "spend" 0-confirm tx with bitcoind?  The protocol allows it.
If bitcoind doesn't increment until 1 confirmation it will error out (insufficient funds) until 1-confirm is detected and it it increments.

Thus bitcoind is more conservative than the protocol?  I guess this behavior can't be overriden without modifying the source.
jgarzik
Legendary
*
qt
Offline Offline

Activity: 1484


View Profile
August 01, 2012, 03:13:20 PM
 #4

There are many ways that the bitcoin software is more conservative than the protocol Smiley

Only relaying standard transactions is another well-known example...


Jeff Garzik, Bloq CEO, former bitcoin core dev team; opinions are my own.
Visit bloq.com / metronome.io
Donations / tip jar: 1BrufViLKnSWtuWGkryPsKsxonV2NQ7Tcj
Foxpup
Legendary
*
Online Online

Activity: 2044



View Profile
August 02, 2012, 08:18:38 PM
 #5

So that leads me to my followup question.  It isn't possible to "spend" 0-confirm tx with bitcoind?  The protocol allows it.
0-confirm transactions can only be spent if they came from yourself (change or send-to-self), since bitcoind doesn't "trust" transactions from other sources until they have at least 1 confirmation. This rule came about after one version of Bitcoin had a bug that caused it to sometimes send transactions with insufficient fees, which would therefore never be confirmed. Normally this would be no big deal, except that other clients simply accepted these transactions and spent them, creating even more transactions which would never confirm, which would be spent again, and so on ad infinitum, until finally everyone's transactions were getting stuck because everyone's wallets were filled with coins that were never going to confirm. It was a real mess.

So now Bitcoin will only trust other people's transactions if they have at least one confirmation, which is the way it should be. The old way of just trusting all transactions, confirmed or not, never really made sense, since the whole point of distinguishing between confirmed and unconfirmed transactions in the first place is that unconfirmed transactions can't be trusted (eg, they may yet be double-spent, while confirmed transactions cannot (at least, not without a lot of further discussion)).

Will pretend to do unverifiable things (while actually eating an enchilada-style burrito) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
kjj
Legendary
*
Offline Offline

Activity: 1302



View Profile
August 05, 2012, 03:28:11 PM
 #6

If you really need to override this behavior, you should be able to use the raw transaction API.

Also, the client won't include generated coins in the balance or new transactions until 120 blocks have passed.  I just mention it for completeness.

p2pcoin: a USB/CD/PXE p2pool miner - 1N8ZXx2cuMzqBYSK72X4DAy1UdDbZQNPLf - todo
I routinely ignore posters with paid advertising in their sigs.  You should too.
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!