Bitcoin Forum
July 18, 2024, 12:12:01 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Two transactions for "1" operation?  (Read 533 times)
ultralisks (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 20, 2014, 09:58:46 PM
 #1

1 "move" command...

Code:
move('', 'person-5', 2.5, 0, 'play-money')

Creates two transactions...

Code:
[
  {"account"=>"",         "category"=>"move", "time"=>1390254155, "amount"=>-2.5, "otheraccount"=>"person-5", "comment"=>"play-money"},
  {"account"=>"person-5", "category"=>"move", "time"=>1390254155, "amount"=>2.5,  "otheraccount"=>"",         "comment"=>"play-money"}
]

The balances appear correct...

Code:
getbalance('') -> -2.5
getbalance('person-5') -> 2.5

The results look correct, but I don't understand why two transactions are needed for one operation. Is this common practice among "ledger" systems?

I suppose... if I think about the first transaction as a "debit", it makes sense that a corresponding "credit" exists. Is the "otheraccount" attribute used as a form of connecting the two transactions?

Example... if I made a debit object like the one above, minus the "otheraccount" attribute, I would know that a debit was made on account "", but I'd have no indication of where that bitcoin was to be moved to.

Okay. I guess I answered my own question. Cool.

Also, if "account" is meant to mean "from this account", and "otheraccount" is meant to mean "to this account", I think the existing labels are terrible. Not a question, just a complaint.
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!