Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: dooferorg on September 23, 2012, 01:44:56 AM



Title: sendfromaddress method?
Post by: dooferorg on September 23, 2012, 01:44:56 AM
I have been tinkering with managing my own bitcoind installations and have tried sending from a few accounts. I noticed that the bitcoind will simply pick whatever address it wants to send them from instead of the address of the account given. Is this by design? Seems odd.

In looking for answers I noticed someone had a patch for adding a sendfromaddress method to the client. I have not tried that yet since it looks like it was for an older source tree.

Is the sendfromaddress method going to be added some time? I would certainly simplify managing accounts. For example, I sent coins from one account to the satoshi dice thing, and it chose the address on another account and so the winnings went back to that one! Weird

I tried it again and it then chose an address that wasn't even associated with an account so the 'return address' wasn't even one my bitcoind recognized or something since I've not seen any return coins, even the 1 satoshi you get on losing.


Title: Re: sendfromaddress method?
Post by: Severian on September 23, 2012, 02:49:51 AM
Have you taken a look at this?:

http://brainwallet.org/#tx


Title: Re: sendfromaddress method?
Post by: dooferorg on September 23, 2012, 03:59:53 AM
Looks interesting. Not sure I'd want to divulge my private key to a website though.

Shouldn't the main/official bitcoin client support this?


Title: Re: sendfromaddress method?
Post by: CIYAM on September 23, 2012, 04:25:02 AM
What you want to look into is this: https://en.bitcoin.it/wiki/Raw_Transactions

(you get complete control of a tx using these RPC calls)


Title: Re: sendfromaddress method?
Post by: dooferorg on September 23, 2012, 04:33:22 AM
Hmm.. seems cumbersome to have to do it like that but maybe I should get programming.. lol


Title: Re: sendfromaddress method?
Post by: CIYAM on September 23, 2012, 04:50:39 AM
Unfortunately it is very "low level" and so will take a bit of working out but if you want complete control over tx's it is the only way you are going to get it (the other patches that have been done aren't nearly as comprehensive as this raw approach is).

The accounts are very unintuitive - you tie one to an address via setaccount but actually that is only being done for the purposes of tracking incoming tx's. Outgoing tx's get their account label from the account label provided when you send (having nothing to do with any address you may have have "tagged" with setaccount).

So an account is not an address but instead a label applied to a tx. The design is for dividing a wallet up into separate user accounts as say an exchange might do and is most useful for the case of transferring bitcoin between such accounts without having to actually perform a real tx.


Title: Re: sendfromaddress method?
Post by: dooferorg on September 23, 2012, 04:55:36 AM
Yea, seems I'm learning that is the case. You're right, not very intuitive at all.


Title: Re: sendfromaddress method?
Post by: Severian on September 23, 2012, 05:29:51 AM
Looks interesting. Not sure I'd want to divulge my private key to a website though.

Download the site and use it offline. It's clientside javascript. You can create a raw transaction and then send it through RPC via the sendrawtransaction command using the hex result.

Quote
Shouldn't the main/official bitcoin client support this?

It mostly does through the RPC console.


Title: Re: sendfromaddress method?
Post by: dooferorg on September 23, 2012, 06:57:21 AM
Yea, good idea about simply downloading it. In looking over the source of the pages it certainly seems non-trivial to replicate it any time soon though I had started looking over the JSON-API-PHP project. I am a big fan of using PHP for my software projects both at work and privately.

Anyway, I appreciate the replies and insight from both of you.


Title: Re: sendfromaddress method?
Post by: Pieter Wuille on September 23, 2012, 04:51:51 PM
The accounts/labels in the (non-raw) bitcoin API do not have anything to do with coin selection. It's simply in order to keep separate balances for accounts in a shared wallet. The actual coins are shared, but transactions to certain addresses will credit the account they belong to, and sendfrom will deduct its balance from the given account.

If you need control over the coin selection process, use the raw transaction API, or separate wallets (zhich is, right now, mostly a pain, but we at least plan to add support for multiple wallets in some future version).


Title: Re: sendfromaddress method?
Post by: dooferorg on September 24, 2012, 02:16:13 PM
The accounts/labels in the (non-raw) bitcoin API do not have anything to do with coin selection. It's simply in order to keep separate balances for accounts in a shared wallet. The actual coins are shared, but transactions to certain addresses will credit the account they belong to, and sendfrom will deduct its balance from the given account.

If you need control over the coin selection process, use the raw transaction API, or separate wallets (zhich is, right now, mostly a pain, but we at least plan to add support for multiple wallets in some future version).

Good to know, thank you. It's taking me a bit of understanding to learn how bitcoin operates instead of  using an online wallet. I've been feeling I should probably be looking after my own coins


Title: Re: sendfromaddress method?
Post by: phelix on December 21, 2012, 08:22:48 AM
https://bitcointalk.org/index.php?topic=24784  (Patching The Bitcoin Client To Make It More Anonymous)