Pages:
Author

Topic: Bitcoin protocol questions - page 2. (Read 2970 times)

legendary
Activity: 4270
Merit: 1313
November 19, 2014, 03:19:20 PM
#7
Yes, I indeed have to read the official document. When I created my questions I used some article, that was explaining how bitcoins works but it seems that the article was incorrect.

...
Definitely read the paper, if you read it and understand it, it will answer many (all?) of your questions about how the network works.  Clearly the article was full of misconceptions and bad information if it was talking about "boxes" and "serial numbers"


Quote
...
And if every new block is created every 10 mins, does it mean that in order to implement transaction , a sender has to wait at least 10 mins?

Blocks are created on average every ten minutes.  It may be 10 seconds apart or an hour.  That is only for a confirmation of a transaction.  It depends on what you mean "implement a transaction" but you can create a transaction at any time and broadcast it to the network.  


Quote
Quote
Correct.  Confirmations will not occur unless there is at least one node that is "mining".
So eventually we will come to the point when it will not be profitable to mine. And consequently the network will stop?
unless somebody fully artificially will mine in order to keep the network working
...
No, there will be transaction fees that compensate people for mining.

Quote
Quote
Correct.  Once one miner broadcasts a valid block, all miners will generally start all over working on a new block.
So, eventually we will come to the point where only some organisation with the most powerful computers is able to confirm the transactions and earn on transactions. Is it Federal Reserve System?

No, anyone can confirm transactions at any time.  The power of your computer is related, but a powerful computer won't overwhelm the rest,  if your computer has "power 1" and someone else has "power 10", statistically they will get about ten times the number of blocks you do, but you will still be getting blocks in proportion to your contribution to the network, but it will occur randomly.  Your "power 1" computer could get 100 in a row to their one, but that is unlikely.

PLEASE read the paper, once you have done so more people will be inclined to help you understand it if there are points you are unclear on.  

:-)
legendary
Activity: 1652
Merit: 1016
November 19, 2014, 03:10:16 PM
#6
Quote
No.  Only those that are running "full nodes" (which store and share the entire blockchain) have to verify every transaction.  There are lightweight wallets that don't store the entire blockchain, and services that can provide wallets with an interface.
Let's imagine that every1 uses only "full" wallets. Does it mean that if the network includes 1million members, each of them has to verify the transactions of 999,999 members?
All nodes on the network assume that any data received from another node is malicious. That's why every node independently checks all incoming transactions/blocks. It doesn't need to trust any data from anyone else as it can verify the data is valid itself.
newbie
Activity: 8
Merit: 0
November 19, 2014, 02:49:18 PM
#5
DannyHamilton, thanks a lot for answering so many questions. Yes, I indeed have to read the official document. When I created my questions I used some article, that was explaining how bitcoins works but it seems that the article was incorrect.
And I will probably ask other questions when I finish reading, but before I'd like to ask some questions about your answers.

Quote
No.  Only those that are running "full nodes" (which store and share the entire blockchain) have to verify every transaction.  There are lightweight wallets that don't store the entire blockchain, and services that can provide wallets with an interface.
Let's imagine that every1 uses only "full" wallets. Does it mean that if the network includes 1million members, each of them has to verify the transactions of 999,999 members?

Quote
Then they will have created their own alternative coin.  Since their chain won't have completed enough work on the time consuming task, the rest of the network won't recognize their chain as being valid.
How do you know if their chain completed enough work on the task or not? : I guess there is a time field in the block right?
But what if they do in the following way:
each block has some property "previous_block_id", so schematically it looks sth like this:
1<--2<--3<--4
Imagine that block id number 4 is the latest one in the list. Then, they could simply manually create block with a property previous_block_id =4 and suggest this block to the others.
How can you recognise that this last block is invalid? If has a reference to the previous block which can be verified.

Quote
Yes.  However, most nodes on the network will refuse to accept or relay a transaction with an extremely small amount of bitcoin unless the transaction also pays a transaction fee of at least 0.0001 BTC.  That means the DDOS attack will cost the attacker 1 BTC for every 10,000 transactions that they send.

a) who gets the fee? Let's say Bob sends coins to Alice. David is verifying their transaction. Will David get the fee?
b) So the wallets have some kind of verification section: if (transaction_amount < 0.0001) refuse_transaction() ?
c) What happens to the refused transaction? Will Bob get some notification or he will wait in vain?
d) If some reach person is in charge of the DDOS attack, so he can pay 1 BTC for 10K transaction, or if he uses the minimum amount of the BTC where no fees are charged, then BTC network could be stopped?

Speaking about the fees:
I understand that each transaction has a priority field: a transaction with lots of the money will be implemented first and transaction with small amount of the money will wait for its turn a lot of time, is it correct?
And if every new block is created every 10 mins, does it mean that in order to implement transaction , a sender has to wait at least 10 mins?

Quote
With mining though you are correct that the protocol requires the miner to prove that they have completed a time consuming task.  Once they can provide this proof, they can broadcast the associated block of transactions.
In general terms it's clear but I'm trying to understand how it really works in the world full of hackers.
Bob "takes" a block he wants to "unlock".
a) Bob does not see the transactions in the block? e.g. the transactions are maybe encrypted?
b) Who is this person who gets the proof of Bob that the task was done?
In the case if it's only Bob's mining application that works in the following way:
while(true)
{
        ...
   if (check_key(suggested_key))
           return suggested_key;
}
And nobody else checks Bob's solution, then Bob can easily modify his software. So I guess somebody checks his answer, right?

Quote
 In exchange for this service, the miner gets to include a special transaction that pays him 25 BTC that didn't exist before the block as well as paying him all the transaction fees from all the transactions that are included in the block.

so Bob's mining software has some kinda flow:

Stamp_block(){
 include_transactions_into_block();
 include_25BTC_into_block_forMiner();
}
?

If this is the case, why Bob can't hack his software and request only include_25BTC_into_block_forMiner() ?


Quote
Correct.  Confirmations will not occur unless there is at least one node that is "mining".
So eventually we will come to the point when it will not be profitable to mine. And consequently the network will stop?
unless somebody fully artificially will mine in order to keep the network working

Quote
David's software looks at the list of transactions that are not yet in any block that David's software knows about.  David's softwware chooses which of these unconfirmed transactions it would like to confirm.  It collects all the chosen unconfirmed transactions together into a block and computes a block header that is specific only to that exact list of transactions.  It includes a special transaction that will pay David 25 BTC plus the sum of the transaction fees from all the chosen transactions.

a) There is a public queue with unconfirmed transactions. How David works with these transactions: he only marks them that now he works on them or he removes them from the public queue?
What if David marks/remove the transactions and then turns off his PC, what will happen next with the marked/removed transactions? They will be lost?
b) I understand that each block of transactions has a reference to the previous block.
So David and Alice are mining and both of them started "building" their blocks. They both know that the id of the last block is 5. What happens next? - they both create a new block with a reference to the block #5 ?

Quote
Correct.  Once one miner broadcasts a valid block, all miners will generally start all over working on a new block.
So, eventually we will come to the point where only some organisation with the most powerful computers is able to confirm the transactions and earn on transactions. Is it Federal Reserve System?

Quote
Every peer on the network keeps their own list of unconfirmed transactions and their own copy of the blockchain.
These lists which each node has, are they equal?

Quote
There is not key.  There is a proof of work that must be accomplished.  If Alice does not complete the appropriate proof of work, then the rest of the network will ignore her invalid block.

But you said that miner creates a block, populates it with the transactions he wants to confirm and "locks" it with some hash and then starts searching for the answer for this hash.
So is it possible that Alice(miner) will create a very easy hash or the hash depends on the included transitions and consequently can not be "adjusted" by Alice?



legendary
Activity: 3528
Merit: 4945
November 18, 2014, 04:27:41 PM
#4
You clearly have not read the bitcoin whitepaper.  You are making a lot of guesses about how bitcoin works from things you have heard unknowledgeable people say, and many of your guesses are just wrong.  This is leading you to a very invalid understanding of the system.  Please throw out everything that you think you know about bitcoin and read the bitcoin whitepaper at least once before you try to understand how bitcoin works:
https://bitcoin.org/bitcoin.pdf

1. How bitcoin wallet knows how much money I have?

There are many wallets.  Exactly how it is accomplished depends on what wallet you are using.  Generally though, your private keys and the associated address hash is stored by the wallet.  The wallet maintains a list of unspent outputs from the blockchain that are associated with those addresses and adds them up.

: it count it on the basis of the bit coin chains or i just uses some variable to keep the info?

Like I said, it depends on the wallet you are choosing to use.  Generally though, a wallet will add up the values of the unspent outputs and store this total in a variable so that it doesn't have to repeat the sum every time it wants to display the total.

2. If I understand it correctly,  every time when I make a transaction, I also send my public key so that the others could verify that it's done by me?

There are several different types of transactions, but in the most common transaction type, yes the public key is sent.  The key isn't sent so that others can verify that it's done by you.  That verification is done with the signature which is computed from the private key.  The public key is just sent to save some computing time so that the software doing the verifying doesn't need to compute the public key from the signature.

If yes, lets imagine the following situation:

Bob creates bit coin wallet and gets some bit coins.
Alice steals Bob's public key(which is not a secret) and simulates the bit coin message which says that Bob transfers Alice 1 bit coin. She uses Bob's public key to validate it.
Actually here we have 2 situation: a) when Bob's public key was already used in some of the transactions. b) he never used it before.

This is not possible. The public key is not used to validate the transaction, the signature is.  It is only possible to create a valid signature with the private key.  The private key is never included in any transactions, it is just used to calculate the signature.

3.
Verifycation whether a sender has the money:
 
Bob does not just confirms Alice's transaction. Instead he transfers her message to the whole network. The others check whether Alice has the money or not for this transaction. If positive, they send a message "Yes, Alice has the money". The transaction is complete when the necessary number of the members confirm this. And after that, everyones chain list will show that now Bob has 1 coin Alice transferred him.

No.  This is not how bitcoin works at all.  You should probably take some time to read the bitcoin whitepaper:
https://bitcoin.org/bitcoin.pdf

Alice creates a transaction that specifies exactly which unspent outputs she is spending.  Bob's software can check his own list of unspent outputs to verify that those outputs are actually unspent.  In the transaction Alice includes a digital signature for every unspent output that she includes as an input.  Each unspent output is encumbered with a requirement to supply a digital signature from a private key that is associated with a specific public key hash.  Bob's software can confirm these signatures and know that Alice has met the requirement and therefore has the right to reassign the value associated with those unspent outputs to him by creating a new unspent output which is encumbered with a requirement to supply a signature from a private key that is associated with Bob's public key hash (also known as a Bitcoin Address).  This allows Bob to verify the transaction without any assistance from anybody else.

Since it is possible that Alice might have sent another transaction that spends those exact same unspent outputs to somebody else, and Bob might not know about it, the system needs a distributed timestamp system that can determine which transaction happened "first".  This is the purpose of mining.  Miners perform a time consuming task, and when they complete that task successfully they get to broadcast a block of transactions that is linked to the previous block.  If Bob sees Alice's transaction in that block, then he knows that miner saw that transaction "first" (before any other transaction that might try to spend the same unspent outputs).  All miners that see that block will then ignore any other transaction that Alice tries to send spending the same unspent outputs.

a) What if we have 100K members or even 1 million, all of them have to verify each other's transaction?

No.  Only those that are running "full nodes" (which store and share the entire blockchain) have to verify every transaction.  There are lightweight wallets that don't store the entire blockchain, and services that can provide wallets with an interface.

b) what it means "the necessary number of the members"? How many?

I don't know what you are asking.  That's probably because you don't understand what you are asking about.

d)

You skipped "c"

When the others change the chain list on their PCs? : let's say Bob received a request to verify some transaction. Ok. Done. So should Bob immediately change the chain after that? What if Bob confirms and changes but John does not confirm?

No, if Bob is running a full node, then his software keeps a list of "unconfirmed" transactions.  These are transactions that Bob's software has seen, but which a miner has not yet included in a block.  His software also stores the blockchain (the list of every valid block that he has received so far).  Bob's software immediately adds valid new transactions to his list of "unconfirmed" transactions as he receives them, and then removes the transactions from the list of "unconfirmed" transactions when he sees the transaction in a block.

e) What will happen if 50% of the fake members(the bots) would have their own chain list?

Then they will have created their own alternative coin.  Since their chain won't have completed enough work on the time consuming task, the rest of the network won't recognize their chain as being valid.

f) Imagine that there is a million or even 100 millions of the bots and they send each other some extremely small amount of the bit coin. They do it without any purpose. So it means we get a kinda Dos attack?

Yes.  However, most nodes on the network will refuse to accept or relay a transaction with an extremely small amount of bitcoin unless the transaction also pays a transaction fee of at least 0.0001 BTC.  That means the DDOS attack will cost the attacker 1 BTC for every 10,000 transactions that they send.

4
I understand that "enough number of the members" simply uses the following idea:
Anybody can confirm the transition only in the case if he resolves a "task". And for this job he gets 25bitcoins.

Again I'm not sure what you are talking about when you say "enough of the members".
With mining though you are correct that the protocol requires the miner to prove that they have completed a time consuming task.  Once they can provide this proof, they can broadcast the associated block of transactions.  In exchange for this service, the miner gets to include a special transaction that pays him 25 BTC that didn't exist before the block as well as paying him all the transaction fees from all the transactions that are included in the block.

So David checks the list of his block chains and sees that transaction is correct. He wants to share the news over the network: the trans action is correct.
But before he does it, as a part of verification task, David must resolve some "task". Without it the others will not consider his confirmation.
Schematically we have a kinda box with unconfirmed transactions. And this box is locked with a key. So the task for David is to find this key to unlock the box and confirm the transactions.

That really isn't a very good way to look at it.  You really, Really, REALLY should read the bitcoin whitepaper:
https://bitcoin.org/bitcoin.pdf

David's software looks at the list of transactions that are not yet in any block that David's software knows about.  David's softwware chooses which of these unconfirmed transactions it would like to confirm.  It collects all the chosen unconfirmed transactions together into a block and computes a block header that is specific only to that exact list of transactions.  It includes a special transaction that will pay David 25 BTC plus the sum of the transaction fees from all the chosen transactions.  Then David's software attempts to complete some provable work on that header.  If David is able to complete the provable work before any other miner completes provable work on the block they are working on, then David gets to broadcast his completed block.  If someone else completes a block first and David hears about it, then he starts all over again.


Thus, having the following questions:

a) how the others know whether David resolved the task or not?

The task is to calculate a hash that has a low enough value.  The calculated hash is included in the header fo the block.  Everybody that receives the block that David broadcasts can verify that it is the correct hash for the block and that the value is low enough. If it is not a correct hash for the block or if it is not low enough value, then David's block is rejected by everyone on the network.

b) as far as I understand, confirmation is nothing but mining! If so, then in the case if we have let's say only 10 members in the network and none of them mines, we will get the huge list of unconfirmed transactions and this confirmation job will never be done unless one of them will be convinced to start mining?

Correct.  Confirmations will not occur unless there is at least one node that is "mining".

c)  If so and only a miner can confirm the transactions, then in the case if Alice will confirm the fake transaction everyone will accept it?

Which fake transaction?  If Alice sends 2 transactions that both spend the same previously unspent outputs, and neither of the transactions is confirmed yet, then the "real" transaction is whichever transaction is included in a block first, and the other transaction becomes invalid and disappears.

d) Imagine we have only 2 miners in the network. The first miner found the key first.Does it mean the second one will not get coins for his job?

Correct.  Once one miner broadcasts a valid block, all miners will generally start all over working on a new block.

If so we have a situation that only a miner with the most powerful PC will always earn and consequently the other miners will eventually stop mining.

Having the most powerful PC does not guarantee that you will solve the block first.  It simply increases your chances.  It is impossible to know how many hashes it will take to solve a block that a miner is working on, and every miner is working on a different block with a different set of hashes.  A very slow PC might successfully find a hash after computing the 5th hash on their block, while an extremely powerful PC might need to compute 100,000,000 hashes on their block before they successfully find one with a low enough value.

e) How the miner gets his reward for finding a key? I mean what is the source of this money? :
Is it sth like his mining app simply checks the condition: if result==key then balance+=25 coins?
If so then anybody can hack such the app.

No.  As I've stated, the protocol allows every block to include exactly 1 transaction that has outputs, but which doesn't have an equivalent or greater value in inputs.  The protocol requires that the outputs of this transaction be less than or equal to the sum of the current block subsidy and the transaction fees of all the transactions in the block.  If the outputs are larger than that, then every other node on the system will reject the block as invalid and will refuse to accept it into their copy of the blockchain.

f) Who creates and locks the "box" of transactions and composes a key for the boxes?

There is not box, and there is no key.  Every node on the system verifies that the block is valid before they accept it or relay it to anyone else.

g) Where does this box is located?

There is not "box"

As far as we are talking about a p2p network, there is no special place where we could keep the queue, etc.

Every peer on the network keeps their own list of unconfirmed transactions and their own copy of the blockchain.

Or maybe each wallet, on each PC, automatically creates a queue and automatically increments its number after the box is full?

There is no box.  There is nothing to "fill".

Then how they synchronise the work

Each node accepts the first block that they receive.  If they receive a block that does not belong to their chain, then they compare the total work for their chain to the total work of the chain with the new block and accept whichever chain has more total work.

and what if Alice hacked her app and it uses a weak key?

There is not key.  There is a proof of work that must be accomplished.  If Alice does not complete the appropriate proof of work, then the rest of the network will ignore her invalid block.

5) In the case if our bin coin chain has a split, the others consider the one which is longer and this "road" is considered as a real one.  We know that each chain has the id of the previous one and so on.
So what if Alice would generate a longer chain?  In this case her chain will be considered as the correct one, no?

As long as her chain completed the appropriate proof of work?  Then her chain would be accepted as the correct one.  In Bitcoin when talking about "longest chain" what is really meant is the chain with the largest amount of valid proof of work.

6) Bitcoin can be decided into lots of the pieces.

Correct.  The smallest integer unit of value within the protocol right now is equivalent to 0.00000001 BTC.  It is not currently possible to transfer amounts smaller than this within the bitcoin protocol.

For example, let's say Alice has 1 bit coin and it's serial number is 123456

There are no serial numbers in the bitcoin protocol.

Now Alice sends 0.5 bit coin to Bob  
Before this transaction, Bob already had 0.5 bit coin

Ok.

(presuming that even a part of bit coin has a serial number, the serial number of Bob's 0.5 bit coin was 98765)

There are no serial numbers in the bitcoin protocol.

So now Alice has 0.5 bit coin with a serial number 123456
And Bob has :
   0.5 bit coin with serial number 98765 and 0.5 bit coin with a number 98765 ?

No.  This is not how bitcoin works.  There are no serial numbers in bitcoin.

So each member has to keep the huge number of the small pieces instead of merging them?

Pieces can be merged.  Transactions have inputs (which supply value to the transaction from previously unspent outputs), and new unspent outputs.  A transaction can have multiple inputs and a single output.  This would combine multiple previously unspent outputs and would create a single new unspent output with the combined value of all the previously unspent outputs.
legendary
Activity: 4270
Merit: 1313
November 18, 2014, 03:40:34 PM
#3
If you haven't already read it, which seems likely, you might start here:
https://bitcoin.org/bitcoin.pdf


edit:

e.g.  Here are a few answers
3.f. They will spend a lot in fees if these bots try to spam the network.
4.d. See the paper - each is working simultaneously so that is not the case.
4.e. See the paper.

6. " serial number" - think about it as inputs and outputs. see https://bitcoin.org/en/developer-guide
legendary
Activity: 1652
Merit: 1016
November 18, 2014, 03:23:40 PM
#2
*A lot* of questions here. I'll answer a few.

1. How bitcoin wallet knows how much money I have? : it count it on the basis of the bit coin chains or i just uses some variable to keep the info?
It retrieves the data from the global blockchain.

2. If I understand it correctly,  every time when I make a transaction, I also send my public key so that the others could verify that it's done by me?
If yes, lets imagine the following situation:

Bob creates bit coin wallet and gets some bit coins.
Alice steals Bob's public key(which is not a secret) and simulates the bit coin message which says that Bob transfers Alice 1 bit coin. She uses Bob's public key to validate it.
Actually here we have 2 situation: a) when Bob's public key was already used in some of the transactions. b) he never used it before.
Alice cannot change Bob's transaction because she is unable to sign it without Bob's private key. Well actually she can change it, but the digital signature won't match, so the network will ignore it.
Only transactions with valid digital signatures will be accepted into the blockchain.
newbie
Activity: 8
Merit: 0
November 18, 2014, 03:14:10 PM
#1
1. How bitcoin wallet knows how much money I have? : it count it on the basis of the bit coin chains or i just uses some variable to keep the info?

2. If I understand it correctly,  every time when I make a transaction, I also send my public key so that the others could verify that it's done by me?
If yes, lets imagine the following situation:

Bob creates bit coin wallet and gets some bit coins.
Alice steals Bob's public key(which is not a secret) and simulates the bit coin message which says that Bob transfers Alice 1 bit coin. She uses Bob's public key to validate it.
Actually here we have 2 situation: a) when Bob's public key was already used in some of the transactions. b) he never used it before.

3.
Verifycation whether a sender has the money:
 
Bob does not just confirms Alice's transaction. Instead he transfers her message to the whole network. The others check whether Alice has the money or not for this transaction. If positive, they send a message "Yes, Alice has the money". The transaction is complete when the necessary number of the members confirm this. And after that, everyones chain list will show that now Bob has 1 coin Alice transferred him.

a) What if we have 100K members or even 1 million, all of them have to verify each other's transaction?
b) what it means "the necessary number of the members"? How many?
d) When the others change the chain list on their PCs? : let's say Bob received a request to verify some transaction. Ok. Done. So should Bob immediately change the chain after that? What if Bob confirms and changes but John does not confirm?
e) What will happen if 50% of the fake members(the bots) would have their own chain list?
f) Imagine that there is a million or even 100 millions of the bots and they send each other some extremely small amount of the bit coin. They do it without any purpose. So it means we get a kinda Dos attack?

4
I understand that "enough number of the members" simply uses the following idea:
Anybody can confirm the transition only in the case if he resolves a "task". And for this job he gets 25bitcoins.
 
So David checks the list of his block chains and sees that transaction is correct. He wants to share the news over the network: the trans action is correct.
But before he does it, as a part of verification task, David must resolve some "task". Without it the others will not consider his confirmation.
Schematically we have a kinda box with unconfirmed transactions. And this box is locked with a key. So the task for David is to find this key to unlock the box and confirm the transactions.
Thus, having the following questions:

 
a) how the others know whether David resolved the task or not?
b) as far as I understand, confirmation is nothing but mining! If so, then in the case if we have let's say only 10 members in the network and none of them mines, we will get the huge list of unconfirmed transactions and this confirmation job will never be done unless one of them will be convinced to start mining?
c)  If so and only a miner can confirm the transactions, then in the case if Alice will confirm the fake transaction everyone will accept it?
d) Imagine we have only 2 miners in the network. The first miner found the key first.Does it mean the second one will not get coins for his job? If so we have a situation that only a miner with the most powerful PC will always earn and consequently the other miners will eventually stop mining.

e) How the miner gets his reward for finding a key? I mean what is the source of this money? :
Is it sth like his mining app simply checks the condition: if result==key then balance+=25 coins?
If so then anybody can hack such the app.

f) Who creates and locks the "box" of transactions and composes a key for the boxes?

g) Where does this box is located? As far as we are talking about a p2p network, there is no special place where we could keep the queue, etc. Or maybe each wallet, on each PC, automatically creates a queue and automatically increments its number after the box is full? Then how they synchronise the work and what if Alice hacked her app and it uses a weak key?


5) In the case if our bin coin chain has a split, the others consider the one which is longer and this "road" is considered as a real one.  We know that each chain has the id of the previous one and so on.
So what if Alice would generate a longer chain?  In this case her chain will be considered as the correct one, no?
 

6) Bitcoin can be decided into lots of the pieces. For example, let's say Alice has 1 bit coin and it's serial number is 123456
Now Alice sends 0.5 bit coin to Bob 
Before this transaction, Bob already had 0.5 bit coin (presuming that even a part of bit coin has a serial number, the serial number of Bob's 0.5 bit coin was 98765)
So now Alice has 0.5 bit coin with a serial number 123456
And Bob has :
   0.5 bit coin with serial number 98765 and 0.5 bit coin with a number 98765 ?
So each member has to keep the huge number of the small pieces instead of merging them?
       





Pages:
Jump to: