I try to understand Transactions.
I have a Source Wallet1 (Address1/PublicKey1 and PrivateKey1) - with 10 Bitcoins (simplified).
Now a friend gives me his Wallet2 (Address2/PublicKey2), and wants to receive 1 Bitcoin.
When I read the documentation (https://bitcore.io/api/lib/transaction) then for a simple Transaction (1-to-1) the code looks like this:
var transaction = new Transaction() .from(utxos) // Feed information about what unspent outputs one can use .to(address, amount) // Add an output with the given amount of satoshis .change(address) // Sets up a change address where the rest of the funds will go .fee(5430) // Minimum non-dust amount .sign(privkeySet) // Signs all the inputs it can
But I have these Questions:
- What is the argument
.from(utxos)function is. Is this the PublicKey1 from my Wallet1?
- The argument
.to(address)function is the PublicKey2 of my Friends Wallet2?
- The argument
change(address)function is a new Address3, which belongs to MY Wallet3, which I have to create just before I make the transaction? => This means I need to know the PrivateKey3 of this Wallet3 and this is the Wallet3 which I will get my rest of the 9 Bitcoins? => Is it possible to do the Transaction without this
.change(address)function? If I say, I don’t want to transfer the rest of my 9 Bitcoins to the new Address? They should just stay in the original Wallet1?
.fee(5430)means that I will spend 5430 Satoshi = USD $0.2337424950 for this Transaction?
.sign(privkeySet)function is the PrivateKey1 from my original Wallet1 right? After this
.sign()function the Transaction will be ‘fired’ and the job is done?
Thank you very much for your support.