Question about orphans: Since they are blocks that are not part of the main chain, due to another hash getting a higher number of confirmations, does this mean that the transactions are lost, or are they placed back in the transaction pool, ready to be placed once more?
yes the transactions are put back into the mempool.
imagine block A and block B got solved at same time..
because 2 different pools done the blocks and indepentdantly decided what their block added.. some of the same tx's would be in each other block. and some transactions may differ.. eg pool B decided to accept some fee free transactions but pool A decided to mainly look at the high price and some tx's middle priced would be in both..
lets say A got orphaned for a reason.
A puts all transactions back into mempool and then looks at B and sees whats confirmed to know which transactions to not handle in A's next attempt because B confirmed them
My current understanding is that miners mine the same block of transactions consisting of a Block header (80kb of hash data), Block Body (1mb of transaction data) and a nonce, which they use to reach a correct hash.
miners (ASICS) dont handle or see the full 1mb of data.. they just get
the hash of that data and then rehash it with a nonce until it creates a new hash which meets the solution requiring a certain amount of 0's at the start of the new hash.
This would suggest that orphaned blocks are a concern only for miners, but not for the network and its users, since the network naturally follows the longest chain and the transaction gets mined anyways.
once an asic finds a hash solution.. it is just handed another hash (new block attempt) to start.. asics dont care about tx data. they just re-hash whatever hash they are handed.. in short asics(miners) dont validate and check transactions
if the pool gets told to orphan the full block the pool handed out to the network because of a problem. the pool then makes a new block hash based on new block data and sends the hash to the asics to start again.
what asics only see as negative is the wasted time working on something that ultimately didnt end in the network longterm, thus no pay for the wasted time.
Double-spending attacks should be of no concern, since the orphaned block eventually falls off and is forever forgotten by the network.
double spends
are a concern to the network because the block is sent out to the network and then thrown out if it was a bad block or a better block was preferred.
so while on the network for those couple seconds or more.. some merchants may have ticked a box to say 'yep confirmed' and released goods/services/fiat to the customer.. then 2seconds or more later.. that block is gone. but the goods/services/fiat is already handed to the customer...
usually in 99.996%-99.75% the tx they thought was confirmed sits back as unconfirmed again until included in the next block so no harm done ultimately but just waiting to reconfirm....
but
as said in previous post (on a good no drama day) in 0.004% or 0.25% chance of the tx not being added to the next block for either malicious reason or unintentionally struck off by how the network works.
(note there are other ways to mess with tx's in an orphan event. but lets not complicate things)
this small under 1% risk is lowest odds. and not strict numbers they are variable. for instance when there is a new feature being added (code rule) like the current 95% soft fork. could result in 5% orphans occurring(higher risk) and many malicious people may increase their malicious attempts ontop due to the "perfect storm to go on a riot" mindset. so it could end up being over 5% risk instead of one 2500th of 1% risk of malicious intent.. or due to the higher blocks.. less 'free transactions' get accepted so the risk of a free transaction not getting re-confirmed becomes riskier.
so its still a risk and worth waiting a few blocks
like some say 1confirm for small amounts (coffee value) 6 confirms (car/house value) during normal no drama transacting.
the terminology was that if there is a bad block found that has no competing better block yet. its just called a rejected/invalid block.
however if after getting the block(a1) a new block is built ontop(a2).. but later a competing block(b1)+(b2) has something preferable where the network has to orphan (a2) because (b2) was linked to a different previous block(b1), making (a1 <-the parent) get rejected thus (a2) is the orphan because it lost its parent.
though, these days we use the term 'orphan' for any block that initially had a solution but then thrown away and something else that takes its place for multiple reasons. whther the network had to reject any parents or not.
there have been times in the past where a block with SEVERAL parents(previous blocks) gets orphaned/rejected off in preference of a better chain of blocks
hense the 6confirm mindset many people have, because a chain of 5 blocks can ALL get orphaned as it has happened before.
usually during feature activation events (the day segwit or dynamic blocks reaches 95% to activate) the orphan risk is higher so some say maybe wait 10 confirms for house value amounts.
lets say there was a 51% attack or a controversial activation of a rule (very high orphan risk) some people will say wait 72-144 blocks (12-24 hours) before trusting