• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

Using daemon to send coins

Ledo

New member
Hi,

After a search through the forum i couldn't find how to use the daemon to send coins using a specific address, can someone tell me the command to do it. Thanks
 
From dash-qt help:

setaccount "dashaddress" "account"

Sets the account associated with the given address.

Arguments:
1. "dashaddress" (string, required) The dash address to be associated with an account.
2. "account" (string, required) The account to assign the address to.

Examples:
> dash-cli setaccount "XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg" "tabby"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "setaccount", "params": ["XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg", "tabby"] }' -H 'content-type: text/plain;' http://127.0.0.1:9998/

sendfrom "fromaccount" "todashaddress" amount ( minconf "comment" "comment-to" )

Sent an amount from an account to a dash address.
The amount is a real and is rounded to the nearest 0.00000001.
Requires wallet passphrase to be set with walletpassphrase call.

Arguments:
1. "fromaccount" (string, required) The name of the account to send funds from. May be the default account using "".
2. "todashaddress" (string, required) The dash address to send funds to.
3. amount (numeric, required) The amount in btc. (transaction fee is added on top).
4. minconf (numeric, optional, default=1) Only use funds with at least this many confirmations.
5. "comment" (string, optional) A comment used to store what the transaction is for.
This is not part of the transaction, just kept in your wallet.
6. "comment-to" (string, optional) An optional comment to store the name of the person or organization
to which you're sending the transaction. This is not part of the transaction,
it is just kept in your wallet.

Result:
"transactionid" (string) The transaction id.

Examples:

Send 0.01 btc from the default account to the address, must have at least 1 confirmation
> dash-cli sendfrom "" "XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg" 0.01

Send 0.01 from the tabby account to the given address, funds must have at least 6 confirmations
> dash-cli sendfrom "tabby" "XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg" 0.01 6 "donation" "seans outpost"

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendfrom", "params": ["tabby", "XwnLY9Tf7Zsef8gMGL2fhWA9ZmMjt4KPwg", 0.01, 6, "donation", "seans outpost"] }' -H 'content-type: text/plain;' http://127.0.0.1:9998/
 
In my case i have 3 addresses on my account. When i type dash-cli getaddressesbyaccount "" it shows for instance:

xxxx1
xxxx2
xxxx3

If i want to send coins using addres xxxx3 from my account what command i use? I wasn't explicit on my question on my earlier post.
 
Something went wrong. I was able to give the address i wanted to use an account name "led" and the other addresses remained with the default account name "". When i used the command sendfrom "led" "todashaddress" amount, it used the first address of the list when i enter dash-cli getaddressesbyaccountand and not the address under the account name led. I am missing something here.
 
Looks like it work not as expected and ignored "from" :(

Sending 0.1 DASH:
debug.log said:
2016-03-25 22:19:15 CWallet::SelectCoinsMinConf best subset: 0.04819626 0.02914269 0.0264544 0.00612667 0.00010001 - total 0.11002003

Any devs comment?
 
Looks like it work not as expected and ignored "from" :(

Sending 0.1 DASH:


Any devs comment?
I think what you might expected is not the way it works.
It does **not** change Bitcoin's algorithm for selecting which coins in the wallet are sent-- you should think of the coins in the wallet as being mixed together when they are received. There is no way to ask Bitcoin to "create a payment transaction using the coins received from these previously received transactions" without using the raw transactions API(which is not part of the account system.)
https://en.bitcoin.it/wiki/Help:Accounts_explained

I highly encourage you to never use accounts at all to avoid confusion. Account related functions are going to be depreciated in 12.1.
 
There is no way to ask Bitcoin to "create a payment transaction using the coins received from these previously received transactions" without using the raw transactions API(which is not part of the account system.)
So, I tried this way (by wiki example):
createrawtransaction '[{"txid":"some_unspent_txid","vout":0}]' '{"some_address":0.1}'
decoderawtransaction hex_returned_with_createrawtransaction
signrawtransaction hex_returned_with_createrawtransaction '[{"txid":"some_unspent_txid","vout":0,"scriptPubKey":"vout_hex_from_decoderawtransaction"}]'
sendrawtransaction hex_from_signrawtransaction
and it work! But all excess coins from tx less than amount to send go as fee.
 
So, I tried this way (by wiki example):
createrawtransaction '[{"txid":"some_unspent_txid","vout":0}]' '{"some_address":0.1}'
decoderawtransaction hex_returned_with_createrawtransaction
signrawtransaction hex_returned_with_createrawtransaction '[{"txid":"some_unspent_txid","vout":0,"scriptPubKey":"vout_hex_from_decoderawtransaction"}]'
sendrawtransaction hex_from_signrawtransaction
and it work! But all excess coins from tx less than amount to send go as fee.
Yes, because you have to add some {"change_address":<input_amount - send_amount(i.e. 0.1 in this case) - fee>} in createtransaction manually. When you use GUI wallet does it for you automagically.
 
Back
Top