# Gavin Andresen # 2012-03-06 16:35:20 # https://bitcointalk.org/index.php?topic=66714.msg786501#msg786501 You should be able to build your GL on top of the accounts feature of bitcoind. @p{par} The 'validateaddress' RPC call will tell you the account associated with an address and whether or not it is an address that belongs to you or is external. @p{par} Combined with the 'sendfrom' and 'setaccount' RPC calls, you should be able to create a proper general-ledger-type application where all transactions have well-defined "from" and "to" accounts. @p{par} Example of one way to do it using my testnet-in-a-box setup: @p{par} 1. Create a couple of accounts: @p{brk} Code: ./bitcoind -testnet getaccountaddress "cash" @p{brk} # ... send some coin to the "cash" account from ... somewhere ... @p{brk} ./bitcoind -testnet setaccount mzDfbJCELPQzHMjJ6ZLFRUxT51FdKezbEZ "hosting_expenses" @p{brk} # the mzDfb... address would come from my web hosting company, of course @p{brk} @p{brk} 2. Now pay for web hosting out of "cash" @p{brk} Code: ./bitcoind -testnet sendfrom "cash" mzDfbJCELPQzHMjJ6ZLFRUxT51FdKezbEZ 10 @p{brk} @p{brk} 3. All the information about the transaction (from and to accounts) is available, but you'll need 2 RPC calls to get it: @p{brk} Code: $ ./bitcoind -testnet listtransactions "cash" 1 @p{brk} [ @p{brk} { @p{brk} "account" : "cash", @p{brk} "address" : "mzDfbJCELPQzHMjJ6ZLFRUxT51FdKezbEZ", @p{brk} "category" : "send", @p{brk} "amount" : -10.00000000, @p{brk} "fee" : 0.00000000, @p{brk} "confirmations" : 0, @p{brk} "txid" : "53a681fd7f6b2cb542d69cb72d18ca780d42df63fcc00cf46b19499ab75540b3", @p{brk} "time" : 1331050826 @p{brk} } @p{brk} ] @p{brk} $ ./bitcoind -testnet validateaddress mzDfbJCELPQzHMjJ6ZLFRUxT51FdKezbEZ @p{brk} { @p{brk} "isvalid" : true, @p{brk} "address" : "mzDfbJCELPQzHMjJ6ZLFRUxT51FdKezbEZ", @p{brk} "ismine" : false, @p{brk} "account" : "hosting_expenses" @p{brk} } @p{brk} @p{brk} The GUI has no notion of a "sendfrom account", so any coins send from the GUI won't play nicely with whatever system you create using the RPC interface. The expectation is the vast majority of GUI users won't go to the trouble of creating a general ledger system to keep track of where their bitcoins are coming from and going to. @p{brk}