Author

Topic: send from address to address (Read 225 times)

HCP
legendary
Activity: 2086
Merit: 4361
July 31, 2019, 10:54:44 PM
#3
I know that the SendFrom command is depreciated, There's two things I'm hoping you can help with.
1. How do I sendtoaddress but from a particular address, e.g. 1 user sending another bitcoin , how can i specify it to come from their address/label.
2. Setting up users and assigning their addresses through 'labels' (as i know the account feature is gone, would be ok?)
It sounds like you're trying to setup some sort of online "custodial" type wallet where your users are able to send one another funds within the confines of your system. In this instance, you may be better off simply running like a "normal" custodial setup, controlling the wallets/addresses in the backend and using a database to track payments into, within and out of your system, rather than trying to have multiple users within essentially the same wallet.

You'd be able to generate receive addresses as required and simply assign a generated "deposit" address to a specific user in the database... If UserAAddress receives funds, then UserABalance = UserABalance + amount. If User A then wants to send User B funds, you simply alter the appropriate values in the database (off-chain). So UserABalance = UserABalance - amount... UserBBalance = UserBBalance + amount etc.

Should a user wish to withdraw funds from the service or send to an external address, you can then simply create a transaction from your master wallet, and it doesn't really matter what address the funds come from... you then simply debit the appropriate amount from the user balance... UserABalance = UserABalance - amount.

Obviously, this is a dramatic simplification of the setup, and you'd need to consider ways to minimise risk to the funds in your system wallet should your system security be compromised... most services tend to use a system of hot wallets and cold storage to achieve this.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
July 31, 2019, 08:17:41 PM
#2
1. How do I sendtoaddress but from a particular address, e.g. 1 user sending another bitcoin , how can i specify it to come from their address/label.

You can use the createrawtransction command and specify which UTXO to be used in the transaction. You can use listunspent to find out the specific UTXOs to use. Thereafter, you can just sign the transaction normally.
2. Setting up users and assigning their addresses through 'labels' (as i know the account feature is gone, would be ok?)

Since labels don't have a balance associated with them, you can still group addresses together by labels but it would be troublesome to calculate the total balance.
3. how can i calculate the sendfee?  - i used sendtxfee to '6' which  means 6 blocks = 20/40 mins, right?
Do you mean settxfee? That command interprets 6 as 6BTC/KB and it doesn't have floating fee. You can use estimatesmartfee to get the floating fee and use another command to set the fee.



While creating the raw transaction, you can just select UTXOs with its total value that equates to the total output value. You can use fundrawtransaction to have the client add UTXOs for the fees.
newbie
Activity: 6
Merit: 2
July 31, 2019, 06:53:50 PM
#1
Hi Guys,

Thanks for the help. It's really good to see a community so warm and welcoming!

I got my client up and running, working with RPC :-)

I'm running a testnet client so I can mess with transactions (without losing my money by accident!).


I know that the SendFrom command is depreciated, There's two things I'm hoping you can help with.


1. How do I sendtoaddress but from a particular address, e.g. 1 user sending another bitcoin , how can i specify it to come from their address/label.
2. Setting up users and assigning their addresses through 'labels' (as i know the account feature is gone, would be ok?)
3. how can i calculate the sendfee?  - i used sendtxfee to '6' which  means 6 blocks = 20/40 mins, right?

Thanks
Jump to: