Jaxkr (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 06, 2013, 09:55:36 PM |
|
Hi everyone. I'm currently curious as to how new transactions are relayed to the clients and miners. Without confirmations, they aren't in the blockchain. How do the miners and clients know they happened? How is the data transmitted in a decentralized way? Please be as technical as possible. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif)
|
|
|
|
DeathAndTaxes
Donator
Legendary
Offline
Activity: 1218
Merit: 1079
Gerald Davis
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 06, 2013, 10:02:31 PM |
|
Your node (node here refers to full node i.e. running bitcoin-qt client or bitcoind) has connections with multiple clients. When your node learns of a new tx (including one you create) it relays it to all the peers it is connected to. Those peers verify the tx and relay it to all peers they know, who do the same.
All nodes all new unconfirmed tx to the memory pool which is just a list of tx the node "knows about". Miners (in case of pool mining it is the pool actually doing the mining) use their copy of the memory pool to decide which tx to include in the next block they are working on.
When a miner broadcasts a block the same process happens at the block level. The node relays the block to all its peers who verify the block and relays it on.
When your node confirms that a new block extends the longest chain it removes all the tx from the memory pool (as they are now unconfirmed). If a new block orphans an existing block your node will add back any tx from the orphaned block to the memory pool and then remove any tx from the memory pool in the new block.
TL/DR: all nodes maintain a list of unconfirmed tx and relay them to another nodes. Node learns of a new tx - add to memory pool Node learns of a new block on longest chain - remove tx in block from memory pool Node leans an existing block on the longest chain has been orphaned - add orphaned block's tx back to memory pool
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 06, 2013, 11:00:26 PM |
|
As far as I get it, your client will also actually take a look at the transactions, to make sure it doesn't spread fake/bogus/spamming/double-spending transactions - it will on one hand check if the script(s) of the transaction adheres to certain standards, that are deemed "safe". Also it will not allow the spreading of transactions that spend inputs that are already spent in another transaction in the memory pool.
The recent inclusion of transactions that have less than 5430 Satoshis as output in the "is not standard" category (which is blocked by default on clients to limit the capabilities of the transaction scripting language to a safe set of instructions) caused some uproar yesterday, as the option is now configurable, but not set by default at the previous implicit level of 1 Satoshi.
|
|
|
|
kjj
Legendary
Offline
Activity: 1302
Merit: 1026
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 02:34:15 AM |
|
How is the data transmitted in a decentralized way? Please be as technical as possible. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) Did you check this page yet?
|
17Np17BSrpnHCZ2pgtiMNnhjnsWJ2TMqq8 I routinely ignore posters with paid advertising in their sigs. You should too.
|
|
|
Jaxkr (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 02:51:19 AM |
|
Your node (node here refers to full node i.e. running bitcoin-qt client or bitcoind) has connections with multiple clients. When your node learns of a new tx (including one you create) it relays it to all the peers it is connected to. Those peers verify the tx and relay it to all peers they know, who do the same.
All nodes all new unconfirmed tx to the memory pool which is just a list of tx the node "knows about". Miners (in case of pool mining it is the pool actually doing the mining) use their copy of the memory pool to decide which tx to include in the next block they are working on.
When a miner broadcasts a block the same process happens at the block level. The node relays the block to all its peers who verify the block and relays it on.
When your node confirms that a new block extends the longest chain it removes all the tx from the memory pool (as they are now unconfirmed). If a new block orphans an existing block your node will add back any tx from the orphaned block to the memory pool and then remove any tx from the memory pool in the new block.
TL/DR: all nodes maintain a list of unconfirmed tx and relay them to another nodes. Node learns of a new tx - add to memory pool Node learns of a new block on longest chain - remove tx in block from memory pool Node leans an existing block on the longest chain has been orphaned - add orphaned block's tx back to memory pool
Thank you very much! I've tried googling "bitcoin network protocol", and read the wiki. I still have one more question. How do nodes learn about other nodes? Is it via trackers, similar to BitTorrent? However, trackers would require some form of centralization. I'm curious about this.
|
|
|
|
Jaxkr (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 02:51:50 AM |
|
How is the data transmitted in a decentralized way? Please be as technical as possible. ![Smiley](https://bitcointalk.org/Smileys/default/smiley.gif) Did you check this page yet? Just read. Thanks for the link.
|
|
|
|
mc_lovin
Legendary
Offline
Activity: 1190
Merit: 1000
www.bitcointrading.com
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 04:06:42 AM |
|
Your node (node here refers to full node i.e. running bitcoin-qt client or bitcoind) has connections with multiple clients. When your node learns of a new tx (including one you create) it relays it to all the peers it is connected to. Those peers verify the tx and relay it to all peers they know, who do the same.
All nodes all new unconfirmed tx to the memory pool which is just a list of tx the node "knows about". Miners (in case of pool mining it is the pool actually doing the mining) use their copy of the memory pool to decide which tx to include in the next block they are working on.
When a miner broadcasts a block the same process happens at the block level. The node relays the block to all its peers who verify the block and relays it on.
When your node confirms that a new block extends the longest chain it removes all the tx from the memory pool (as they are now unconfirmed). If a new block orphans an existing block your node will add back any tx from the orphaned block to the memory pool and then remove any tx from the memory pool in the new block.
TL/DR: all nodes maintain a list of unconfirmed tx and relay them to another nodes. Node learns of a new tx - add to memory pool Node learns of a new block on longest chain - remove tx in block from memory pool Node leans an existing block on the longest chain has been orphaned - add orphaned block's tx back to memory pool
If it's adding unconfirmed tx's to the memory pool, couldn't a person attack via this way? Everyone adds all the BS spam tx's and it overloads?
|
|
|
|
oakpacific
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 06:06:20 AM |
|
A bit off-topic, sorry OP. But I always wonder why can't merchants just reject/put on hold transactions from addresses with still unconfirmed transactions to prevent race-attacks? Should be a fair request with a deterministic wallet as it's recommended to use every address only once.
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 07:00:30 AM |
|
If it's adding unconfirmed tx's to the memory pool, couldn't a person attack via this way? Everyone adds all the BS spam tx's and it overloads?
As I already wrote above, there are no "BS spam tx" - they either really do cost real coin or are not relayed if your client deems them to be "BS". If a client sends you a lot of these (to DoS you maybe), your client will simply cut the connection to that one and move on with it's life.
|
|
|
|
niko
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 07, 2013, 07:36:25 AM |
|
|
They're there, in their room. Your mining rig is on fire, yet you're very calm.
|
|
|
Jaxkr (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 08, 2013, 12:38:35 AM |
|
If it's adding unconfirmed tx's to the memory pool, couldn't a person attack via this way? Everyone adds all the BS spam tx's and it overloads?
As I already wrote above, there are no "BS spam tx" - they either really do cost real coin or are not relayed if your client deems them to be "BS". If a client sends you a lot of these (to DoS you maybe), your client will simply cut the connection to that one and move on with it's life. And transactions fees serve as DoS protection!
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 08, 2013, 01:07:36 AM |
|
How do you come to this conclusion?
|
|
|
|
Jaxkr (OP)
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 08, 2013, 01:30:32 AM |
|
How do you come to this conclusion?
It costs spammers much more to get junk transactions verified. However, fees don't protect relays. Hopefully, the new minimum transaction amount will in the future.
|
|
|
|
Sukrim
Legendary
Offline
Activity: 2618
Merit: 1007
|
![](https://bitcointalk.org/Themes/custom1/images/post/xx.gif) |
May 08, 2013, 01:42:22 AM |
|
Relays don't need that much protection, the new default setting is not a hard standard (and there is actually an incentive to set this to 21 million for anyone who doesn't mine...) and in my opinion I'd rather have a measurement/setting based on transaction size and UTXO set impact than transacted amount...
|
|
|
|
|