0

How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?

I understand that it is verifiable by scanning the entire blockchain and see whether the wallet has the enough bitcoin in it so that it is possible to make the transaction.

However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid?

3

How does the Bitcoin Network verify whether the wallet has enough bitcoins for the transaction?

It doesn't. The network doesn't care about wallets or accounts at all. Those are constructs used by other programs to manage bitcoins.

The network just checks to make sure that the inputs a transaction uses are valid.

However isn't it feasible if the size of the blockchain becomes really large? Is there any practical way that the current nodes verify whether the transaction is valid?

Nodes keep an efficient index of unspent outputs. They can then check the inputs of a new transaction to make sure they're in the index of unspent outputs. You have to scan the whole blockchain to build this index, but once it's built, accessing and maintaining it is cheap and efficient.

You can think of an account as a key and unspent outputs as locks. The nodes just have to check that the key fits the lock. It doesn't matter what other locks the key might or might not open. The person who holds a key wants to know what locks it will open, but to know if access is allowed, we just have to check if the key fits the lock it's being put in.

1

Transactions consist of inputs and outputs. Inputs refer to transactions which have sent bitcoins to your public keys (addresses). All a node needs to do is check if the bitcoins being spent are less than or equal to the sum of bitcoins referenced by input transactions (and signature has to verify ofcourse).

-3

Bitcoin wallet does not have any bitcoins. All bitcoins are in blockchain. Wallet only have private keys. That gave access to bitcoins in blockchain. You do not need to scan whole blockchain to find out how many bitcoins you have. You just need to check your public address for example through blockchain.info

  • The Bitcoin network does not verify your transaction by querying the privately-operated website blockchain.info. OP asks how nodes can validate transactions by themselves. – Pieter Wuille Feb 8 '17 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.