Bitcoin Forum
April 25, 2024, 12:19:32 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How does my Trezor wallet work?  (Read 141 times)
bkelly13 (OP)
Member
**
Offline Offline

Activity: 62
Merit: 33


View Profile
November 11, 2022, 02:36:39 AM
Merited by o_e_l_e_o (4), DdmrDdmr (3), Pmalek (1), dkbit98 (1)
 #1

I don’t mean the specifics of the code on this device.  More like the basics of how any/every offline wallet works.  I presume they are all fundamentally similar.  Kind along these lines:

1) I decide to send some coin and enter the command on my Windows 11 computer with the wallet connected.  Let’s say the transfer is from wallet_send to wallet_receive.  Yes, I do realize, or think I do, the transfer is between bitcoin addresses identified on wallet_send and wallet_receive.

2) wallet_send, really the Trezor app on my computer, builds a message containing some kind of public key / hash that can only come from me and my wallet and uniquely identifies the bitcoin address controlled by this wallet.  The message also contains the address to be transferred to.

3) The bitcoin network checks out the specifics and decides the transfer request is valid.  The network moves the bitcoins from send to receive.

4) Sometime later ( how much later? ) my computer / wallet_send gets a response verifying the transfer.

And then

5) How does wallet_receive learn that its bitcoin address has received the goods.  Must it be on-line at the time of the send?  I suspect not.  So how long after the send can it be put online and get the message. 

Or maybe, when I connect any wallet to my computer the Windows 11 app gets the addresses controlled by the wallet and queries the bitcoin network for the quantities held in those addresses.

Thank you for your time and patience.
1714047572
Hero Member
*
Offline Offline

Posts: 1714047572

View Profile Personal Message (Offline)

Ignore
1714047572
Reply with quote  #2

1714047572
Report to moderator
1714047572
Hero Member
*
Offline Offline

Posts: 1714047572

View Profile Personal Message (Offline)

Ignore
1714047572
Reply with quote  #2

1714047572
Report to moderator
1714047572
Hero Member
*
Offline Offline

Posts: 1714047572

View Profile Personal Message (Offline)

Ignore
1714047572
Reply with quote  #2

1714047572
Report to moderator
Transactions must be included in a block to be properly completed. When you send a transaction, it is broadcast to miners. Miners can then optionally include it in their next blocks. Miners will be more inclined to include your transaction if it has a higher transaction fee.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
jackg
Copper Member
Legendary
*
Offline Offline

Activity: 2856
Merit: 3071


https://bit.ly/387FXHi lightning theory


View Profile
November 11, 2022, 03:11:08 AM
Merited by DdmrDdmr (3), Pmalek (1), kamvreto (1)
 #2

When you pair (connect) your trezor with the wallet you see on screen it sends across a master public key which can be used to derive all of your addresses and your computer wallet software connects to a server and queries that public key with them to see what balance you have - this is frequently refreshed too.

If you want to send funds the only thing your trezor needs is the address you want to send to and the unspent transaction outputs you want to spend (they're just the txid you received the amount from plus the index the amount your private key controls is - all that can be seen on the blockchain is your address).

If you want to receive funds, a query is made to the trezor device to display your address and that's it.

Most public information is stored on your computer with the wallet software, the hardware wallet "just" has keys for signing everything and some verification/utility software to make it function (such as pin processing).
bkelly13 (OP)
Member
**
Offline Offline

Activity: 62
Merit: 33


View Profile
November 11, 2022, 04:25:51 AM
 #3

... If you want to receive funds, a query is made to the trezor device to display your address and that's it.
...

A query is a question, an inquiry.  If my computer makes a query to the trezor, then how does my computer / trezor know how many bitcoins are in the specified account?
Upgrade00
Legendary
*
Online Online

Activity: 2016
Merit: 2170


Professional Community manager


View Profile WWW
November 11, 2022, 04:37:00 AM
 #4

3) The bitcoin network checks out the specifics and decides the transfer request is valid.  The network moves the bitcoins from send to receive.

4) Sometime later ( how much later? ) my computer / wallet_send gets a response verifying the transfer.

And then

5) How does wallet_receive learn that its bitcoin address has received the goods.  Must it be on-line at the time of the send?  I suspect not.  So how long after the send can it be put online and get the message.  
• Yes, nodes verify that the unspent transaction output involved in the current transaction are in the address(es) initiating the transaction.

• Do you mean how much later for the transaction to be confirmed and added to the mempool awaiting confirmation by miners? Doesn't take long at all.

• No, the wallet does not have to be online at the time. There are block explorers (like blockchair) that one can use the check the balance of a address or to monitor a particular transaction ID.

A query is a question, an inquiry.  If my computer makes a query to the trezor, then how does my computer / trezor know how many bitcoins are in the specified account?
Your public key shows the amount of bitcoins available on that address.

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
bkelly13 (OP)
Member
**
Offline Offline

Activity: 62
Merit: 33


View Profile
November 11, 2022, 06:46:06 PM
 #5


• No, the wallet does not have to be online at the time. There are block explorers (like blockchair) that one can use the check the balance of a address or to monitor a particular transaction ID.

A query is a question, an inquiry.  If my computer makes a query to the trezor, then how does my computer / trezor know how many bitcoins are in the specified account?
Your public key shows the amount of bitcoins available on that address.

Cool.  Makes sense now.  I had been concerned about that.
Thank you for your time.
Stalker22
Legendary
*
Offline Offline

Activity: 1484
Merit: 1355



View Profile
November 11, 2022, 07:21:21 PM
 #6

If my computer makes a query to the trezor, then how does my computer / trezor know how many bitcoins are in the specified account?

Your Trezor device does not actually know how many bitcoins are available at the specified address. It is like a special key, which you use to sign/authorize transactions.



Basically, software on your computer creates an unsigned transaction that contains all the necessary information. The transaction is sent to a hardware wallet device, which signs it and sends it back to the software application, which then broadcasts it to the bitcoin network.

█████████████████████████████
█████████▀     ▄██ ▀▀████████
█████▀ ▀██▀▀▀▀▀▀▀▀▀▄▄  ▀█████
████  ▄▀▀▄█████████▄▀▀▄██████
███▄▄█▀▄██████▀ ▀████▄▀█▀ ▀██
██▀▀█▌▐█   ▀▀▀   █████▌▐█  ██
██  █ ███▄▄▄      ▀▀▀▀█ █  ██
██  █▌▐████▌         ▄▌▐█████
███▄██▄▀█████▄   ▄▄██▀▄█ ▀███
████▀ ▀▄▄▀███▀    █▀▄▄▀  ████
█████▄  ▀▀▄▄▄▄▄▄▄▄▄██▄ ▄█████
████████▄▄██       ██████████
█████████████████████████████
         ▄██▄     ▄
        █████   ▄████
       █████▌  █████▌
      ██████████████
     ███▀█████▀██▀████▄
   ▄▄▄▄▄██████████████
 ▄▄██████▄██▄▄██████▄█▀
▐██████████████████████▄
 ▀████████         ████▀
   ▀███████▄     ▄███▀
    ███████████████▀
  ▄█████████████████
▄▄███████████████████▄
               ▄███▄
            ▄████████

        ▄▄██████████
       █▀▀▀██▀▀▀████
      ███████████
    ▀▀▀████████████
      ▀███████████▀
      ▄███████████▄
 ▄
    ▀▀▀▀▀▀▀▀███▀▀   ▄
▀▀█▀▀
███████████▀▀▀█▀▀
    ████████████████
    ████████████████
▄▄▄▄▄▄███████████████▄▄▄▄▄▄
.
..PLAY NOW..
       ▄▄▄▄ ▄▄█████▄
     ████████████████
 ▄▄▄█████████████████████▄
███████████████████████████▄▄
▀█████████████████████████████
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
       ▄█▄      ██
    ▄█▄▄█▄▄█▄          ▄▄
    ▄▄▄███▄▄▄    ▄ ▄ ▄ ▀▀
     ▀ ▄█▄ ▀  ▀▄█ ▀█▀ █▄▀
    ▄▄  ▀     ▀▀▀▀███▀▀▀▀
    ▀▀        ▀██▀▀█▀▀██▀
         ██   ▀ ▀▄▀█▀▄▀ ▀
The Cryptovator
Legendary
*
Offline Offline

Activity: 2226
Merit: 2170


Need PR/CMC & CG? TG @The_Cryptovator


View Profile WWW
November 11, 2022, 08:28:19 PM
 #7

I don't know how Trezor works, but I have been using Ledger. It creates a transaction from the apps that are connected to the device. Then send it to the Ledger to sign the transaction. If you approve then the device broadcasts it to the chain. And of course for signing message device should be online and connected to the internet. Bitcoin is actually stored in Blockchain but controlled by your private keys. So it will be updated on the Blockchain in real-time. Whenever you connect your wallet to the apps it will show a real balance. Of course, you should be connected to the internet to get data from the Blockchain. Even device not connected, just apps show me real time data.

.BEST..CHANGE.███████████████
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
██
███████████████
..BUY/ SELL CRYPTO..
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
November 12, 2022, 03:45:05 PM
Merited by Pmalek (1), Rikafip (1)
 #8

1) I decide to send some coin and enter the command on my Windows 11 computer with the wallet connected.  Let’s say the transfer is from wallet_send to wallet_receive.  Yes, I do realize, or think I do, the transfer is between bitcoin addresses identified on wallet_send and wallet_receive.
So far so good.

2) wallet_send, really the Trezor app on my computer, builds a message containing some kind of public key / hash that can only come from me and my wallet and uniquely identifies the bitcoin address controlled by this wallet.  The message also contains the address to be transferred to.
A bitcoin transaction does not identify which bitcoin to spend based on an address, but rather based on the previous transaction which moved those bitcoin to the address they are now on. This is how an address can hold multiple different batches of bitcoin from multiple different transactions, but you can still choose which of these to spend at a time.

However, the underlying principle remains the same. Your wallet software will build a transaction which includes specifying which bitcoin it wants to spend, specifying which address(es) to send them to, specifying how much to send to each address, and some other important data you don't need to worry about, such as a version number and a locktime. It also includes a signature for each input you are spending. The signature varies somewhat depending on the type of address you are spending from, but essentially is created with the private key from that address. It is easy for other users to verify, but impossible for them to forge. The presence of this signature allows other users to verify that you do indeed own the private key necessary to spend the coins you are spending, without revealing anything about the private key itself.

3) The bitcoin network checks out the specifics and decides the transfer request is valid.  The network moves the bitcoins from send to receive.
Essentially, yes.

4) Sometime later ( how much later? ) my computer / wallet_send gets a response verifying the transfer.
Within a few seconds of broadcasting the transaction, you should be able to see it appearing on the network as unconfirmed/zero confirmations.

5) How does wallet_receive learn that its bitcoin address has received the goods.  Must it be on-line at the time of the send?  I suspect not.  So how long after the send can it be put online and get the message.
Next time that wallet software connects to a bitcoin node or server via the internet, it will ask for updated balances and transaction history for all its addresses. It does not need to be online at the time, but again, should be able to see the transaction appearing as unconfirmed/zero confirmations within a few seconds. How long the transaction takes to confirm depends on the fee it pays and the number of other unconfirmed transactions competing for block space.
bkelly13 (OP)
Member
**
Offline Offline

Activity: 62
Merit: 33


View Profile
November 13, 2022, 06:15:41 AM
 #9

I have worked through much of the book "Mastering Bitcoin," the O'Reily book.  There is much more than I anticipated, much much more.

The completion of a transaction I, or anyone, initiates does not require my, out, presence to be completed.  My wallet, which represents me, can do the inquires as needed to determine what has happened.

I have had respect for bitcoin, and all the concepts of crypto currencies.  I wish it were not so volatile, but that is really an aspect of human nature.  Cannot fix that. 

Thank you for the replies.
o_e_l_e_o
In memoriam
Legendary
*
Offline Offline

Activity: 2268
Merit: 18507


View Profile
November 13, 2022, 06:47:21 AM
 #10

The completion of a transaction I, or anyone, initiates does not require my, out, presence to be completed. My wallet, which represents me, can do the inquires as needed to determine what has happened.
Correct. Once a valid transaction has been broadcast to the network, then it is shared throughout all the nodes on the network and will eventually be included in to a block by a miner. Neither the sending party nor the receiving party needs to be online at any time for this to happen. Whenever one of those parties comes back online later, their wallet software will sync up with what happened with the blockchain while they were offline and will show the updated balances and transaction history.
Pmalek
Legendary
*
Offline Offline

Activity: 2744
Merit: 7095



View Profile
November 13, 2022, 09:22:28 AM
 #11

3) The bitcoin network checks out the specifics and decides the transfer request is valid.  The network moves the bitcoins from send to receive.
The recipient (wallet_receive) gets notified of an incoming but still unconfirmed transaction. At this stage, the transaction is not considered to have been completed yet. It's still unconfirmed and not yet finalized. There is a chance for it to be double-spent and moved to a different address. The transaction from your wallet_send goes to the mempool/mempools of the node/nodes that your software client is connected to. Only when a miner picks it up and includes it in the next block, your transaction will get its first confirmation. If nothing happens to the block your transaction got included in (it gets orphaned), that's when the recipient can consider having control of those coins. If something happens, we just go back to the waiting game of having the transaction included in a new block again.     

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
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!