Bitcoin Forum
May 07, 2024, 12:12:04 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: The TX id that we need to create a transaction  (Read 85 times)
zkquality (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 7


View Profile
October 17, 2021, 03:40:43 AM
Merited by o_e_l_e_o (4), ABCbits (1)
 #1

I have no idea if it was asked before. when spending from paper wallet, we need to create a watch-only wallet first, then electrum gets some data from bitcoin network and save it into a file, then we sign that file with the real-wallet.

so basically while seeing the bitcoinjs documents, to create a transaction we need a "TXID" of a pervious transaction. so if I have a wallet with multiple transactions and all of them are deposits, then which one do we need its TXID now? can anybody please explain?

also, why do we need a watch only wallet first before signing transaction? i mean what kind of data does electrum get from the address and the network.

tnx in advance
1715040724
Hero Member
*
Offline Offline

Posts: 1715040724

View Profile Personal Message (Offline)

Ignore
1715040724
Reply with quote  #2

1715040724
Report to moderator
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715040724
Hero Member
*
Offline Offline

Posts: 1715040724

View Profile Personal Message (Offline)

Ignore
1715040724
Reply with quote  #2

1715040724
Report to moderator
ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4166


View Profile
October 17, 2021, 04:31:14 AM
Merited by o_e_l_e_o (4), pooya87 (2), ABCbits (2)
 #2

You select the inputs that you'd like to spend in the transaction. Get the TXID and the output index of it for the transaction, for which the output index is the order for which your output is in within that specific transaction.

Electrum obtains the unspent transaction output and displays it to the user in the GUI for them to choose and construct an unsigned transaction for it to be signed, that is the purpose of a watch-only wallet.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
zkquality (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 7


View Profile
October 17, 2021, 04:54:27 AM
 #3

You select the inputs that you'd like to spend in the transaction. Get the TXID and the output index of it for the transaction, for which the output index is the order for which your output is in within that specific transaction.

Electrum obtains the unspent transaction output and displays it to the user in the GUI for them to choose and construct an unsigned transaction for it to be signed, that is the purpose of a watch-only wallet.

Did you mean I cannot spend multiple transactions at once?

Can you please explain more? So If the wallet has 1 btc that was received in a multiple unspent transactions. e.g. 10x 0.1 BTC deposited. Then I want to spend them all, which transaction should I use its TXID now?

Thanks.
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10550



View Profile
October 17, 2021, 04:55:05 AM
Merited by o_e_l_e_o (4), ABCbits (2)
 #4

so basically while seeing the bitcoinjs documents, to create a transaction we need a "TXID" of a pervious transaction. so if I have a wallet with multiple transactions and all of them are deposits, then which one do we need its TXID now? can anybody please explain?
You don't need TXID you need UTXO (Unspent Transaction Output) which contains [received] transaction hash, index of the output in that transaction, amount of the output in satoshis and finally the pubkey script (that should correspond with the address you are spending from).
You get a list of them that belong to your address and spend as many of them as you want granted you don't violate any standard rules (ie. don't end up with a huge tx).

Quote
also, why do we need a watch only wallet first before signing transaction?
You don't need a watch only wallet first, it is an option to maximize security.

Quote
when spending from paper wallet, we need to create a watch-only wallet first, then electrum gets some data from bitcoin network and save it into a file, then we sign that file with the real-wallet.
Electrum gets a list of UTXOs for your address and then it creates an unsigned transaction that has everything expect signatures set (such as inputs and outputs) then puts it in a file that you can transfer to cold storage for signing. The cold storage reads the file and signs the transaction (not the file) then you can transfer the signed transaction in that file to the online watch only wallet to broadcast.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
zkquality (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 7


View Profile
October 17, 2021, 04:56:54 AM
 #5

so basically while seeing the bitcoinjs documents, to create a transaction we need a "TXID" of a pervious transaction. so if I have a wallet with multiple transactions and all of them are deposits, then which one do we need its TXID now? can anybody please explain?
You don't need TXID you need UTXO (Unspent Transaction Output) which contains [received] transaction hash, index of the output in that transaction, amount of the output in satoshis and finally the pubkey script (that should correspond with the address you are spending from).
You get a list of them that belong to your address and spend as many of them as you want granted you don't violate any standard rules (ie. don't end up with a huge tx).

Quote
also, why do we need a watch only wallet first before signing transaction?
You don't need a watch only wallet first, it is an option to maximize security.

Quote
when spending from paper wallet, we need to create a watch-only wallet first, then electrum gets some data from bitcoin network and save it into a file, then we sign that file with the real-wallet.
Electrum gets a list of UTXOs for your address and then it creates an unsigned transaction that has everything expect signatures set (such as inputs and outputs) then puts it in a file that you can transfer to cold storage for signing. The cold storage reads the file and signs the transaction (not the file) then you can transfer the signed transaction in that file to the online watch only wallet to broadcast.

What to do with case they are multiple unspent ones?
ranochigo
Legendary
*
Offline Offline

Activity: 2954
Merit: 4166


View Profile
October 17, 2021, 04:57:16 AM
 #6

Did you mean I cannot spend multiple transactions at once?
You're never spending multiple transactions, you are spending multiple transaction outputs. It is possible and easy to do so. Just reference all of them in the transaction that you want.
Can you please explain more? So If the wallet has 1 btc that was received in a multiple unspent transactions. e.g. 10x 0.1 BTC deposited. Then I want to spend them all, which transaction should I use its TXID now?
All of them. The transaction needs to reference all of their TXIDs and their corresponding indexes.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
zkquality (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 7


View Profile
October 17, 2021, 05:15:44 AM
 #7

You don't need a watch only wallet first, it is an option to maximize security.

Does that mean with just the - private key - I can create a raw transaction without getting any data from the Bitcoin network?
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10550



View Profile
October 17, 2021, 05:20:11 AM
 #8

What to do with case they are multiple unspent ones?
I already said it, you get a list of UTXOs and you can spend as many of them as you want.
Each bitcoin transaction has an array of inputs and an array of outputs that have to have at least one item in them (one input and one output) but you can create a transaction with for example 10 inputs and 4 outputs.

You don't need a watch only wallet first, it is an option to maximize security.
Does that mean with just the - private key - I can create a raw transaction without getting any data from the Bitcoin network?
No.
A watch-only wallet is a wallet that does NOT contain any private keys. It is created using the addresses (or technically could be with public keys too). It provides security since your private keys remain offline.
But you still need to construct a transaction knowing the UTXOs you can spend and you can only find them by knowing the address and searching the bitcoin blockchain.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
zkquality (OP)
Newbie
*
Offline Offline

Activity: 23
Merit: 7


View Profile
October 17, 2021, 05:51:44 AM
 #9

I already said it, you get a list of UTXOs and you can spend as many of them as you want.
Each bitcoin transaction has an array of inputs and an array of outputs that have to have at least one item in them (one input and one output) but you can create a transaction with for example 10 inputs and 4 outputs.

Oh, it seems that I know nothing at all. I thought transaction inputs are addresses like they appear on block explorers. Anyway thank you guys I'm investigating this again.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18510


View Profile
October 17, 2021, 09:33:55 AM
Merited by pooya87 (2)
 #10

I thought transaction inputs are addresses like they appear on block explorers.
This is just done to make it easier for humans to navigate, since we are generally more interested in the total balance of bitcoin at each address as opposed to the balance of each individual UTXO. At a protocol level, the inputs to each transaction are selected based on the outputs of previous transactions.

The block explorer blockstream.info will instead show each input as "TXID:Index", rather than as coming from a specific address. For example, if we take this transaction: https://blockstream.info/tx/435656e0e95952ff44df53906625be446451fd6fb3f1a051c14e491bd917043d. The first input to that transaction is the eighth output (7) of the transaction with hash 3227e..., the next input is the 34th output (33) of the transaction with hash 46d7e..., and the last input is the first output (0) of the transaction with hash c6277....

You also might find this a useful resource: https://learnmeabitcoin.com/technical/transaction-data

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!