Bitcoin Forum
May 12, 2024, 11:02:44 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 ... 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 [105]
2081  Other / Beginners & Help / Re: API: keeping account balance positive (+knowing in advance the transaction fee) on: December 06, 2012, 05:52:50 PM
Last time I tried it did not work that way, but maybe you're trying with the default account, which is allowed to go negatvie.
no:

Code:
looris@Palace-of-the-Nine-Moons:~/ext-Sviluppo/bitcoin $ bitcoind listaccounts
{
    "" : 0.00000000,
    "bj_1" : 0.06900000,
    "bj_2" : 0.03550000,
    "bj_3" : 0.01550000,
    "bj_7" : 0.00000000
}
looris@Palace-of-the-Nine-Moons:~/ext-Sviluppo/bitcoin $ bitcoind move bj_3 bj_1 0.02
true
looris@Palace-of-the-Nine-Moons:~/ext-Sviluppo/bitcoin $ bitcoind listaccounts
{
    "" : 0.00000000,
    "bj_1" : 0.08900000,
    "bj_2" : 0.03550000,
    "bj_3" : -0.00450000,
    "bj_7" : 0.00000000
}
2082  Other / Beginners & Help / Re: API: keeping account balance positive (+knowing in advance the transaction fee) on: December 06, 2012, 07:53:09 AM
Problem 2 only happens with sendfrom: there might be a transaction fee, hence if the user sends his entire balance, he'll have a negative balance due to that.
No, the transaction will fail if a tx fee causes the account to go negative
No, the account balance will go negative, I just tried.
We're talking about accounts here.
They do go negative.
2083  Other / Beginners & Help / API: keeping account balance positive (+knowing in advance the transaction fee) on: December 05, 2012, 11:37:16 PM
(as posted on SE)

I'm using the json API. I need to keep all the account balances positive: I call getbalance first, check if it has enough bitcoins to proceed, and then move or sendfrom.

This approach causes two problems.

Problem 1 is that this is not an atomic operation, so after the first getbalance the balance could actually be changed.

Problem 2 only happens with sendfrom: there might be a transaction fee, hence if the user sends his entire balance, he'll have a negative balance due to that.

Solution to Problem 2 would be to know in advance the transaction fee: I noticed (though I didn't try) I can set it with settxfee, but I found no call to get it, is there?

While I could implement some external lock mechanism to solve Problem 1, I'd rather use a bitcoind native method, though I get it does not exist, does it? Hacking the sendfrom function to have it check the balance before sending would be enough, I guess?
2084  Other / Beginners & Help / Re: Strongcoin.com SSL issue on: February 16, 2012, 01:57:37 PM
The certificate is only valid for following names:
*.heroku.com, heroku.com
I have the same problem trying to access it via android, using Wind (IT) as provider.
No problem on my desktop, using Fastweb (IT) as provider.
Pages: « 1 ... 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 [105]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!