Transcript for #bitcoin-dev 2017/11/02

13:39 paulo_ hello
13:39 paulo_ does the client accept empty (coinbase-only) blocks?
13:41 arubi of course
13:42 arubi oh ghost43, did you manage eventually? invalidateblock and reconsiderblock are probably what you want
13:42 paulo_ I'm a 51% attacker who mines starting from an old block of height N. I mine only empty blocks and catch up with the main chain. Will this cause all transactions from height N to unconfirmed?
13:42 paulo_ *unconfirm
13:43 arubi yes
13:44 ghost43 arubi: thanks! I've only wanted to do this atm to test a certain behaviour of bitcoind, and ended up reading 2-3 source files instead :D
13:44 arubi hehe, I know exactly what you mean :)
13:45 paulo_ arubi: okay. so let's say the mempool of all clients are full from all the unconfirmed transactions. A few transactions are booted out of the mempool. have I essentially reversed transactions?
13:46 arubi why would transactions leave a mempool? also understand that there is no singular mempool. each node tracks its own
13:47 paulo_ arubi: the nodes prioritize transactions by feels when the mempool is full
13:47 paulo_ *fees
13:47 ghost43 he's essentially asking that if the local mempool size is 300 MB, and a reorg forces 1000 MB worth of txs out of the best chain, then are several 100 MBs of txs lost for most nodes
13:48 arubi any tx that was in a block previously now becomes unconfirmed but is otherwise valid. unless you also double spend one of the old ones, all txs can get confirmed again
13:48 arubi but yes, if an ancestor was lost entirely, I suppose you can say it's also reversed
13:49 paulo_ okay. there is no limitation as to how old a block I can mine from?
13:49 arubi you can mine them all starting from block 1, included
13:49 arubi block 0 is genesis and consensus
13:49 ghost43 paulo_: if even a single node has an enormously large max mempool configured, he can rebroadcast all txs to the whole network
13:50 paulo_ I can keep extending a side chain if I wanted to?
13:50 ghost43 no one can stop you from doing that
13:51 arubi right, but it's better for your pocket to extend main chain
13:51 paulo_ and the network will accept this as a side chain?
13:51 arubi not unless it's the same length
13:51 ghost43 the network won't care much, unless you catch up and overtake the best chain
13:52 ghost43 they won't download your blocks and after some time probably the headers either
13:53 arubi (or more) you're competing against difficulty. headers are enough to know if it's the longest chain or not by difficulty
13:54 paulo_ "they won't download your blocks and after some time probably the headers either" - at which point, exactly, will the side chain be ignored?
13:55 arubi paulo_, you'll be sending the block headers to your peers, and headers are enough to tell the total work done on that chain of blocks
13:55 arubi if it's less than the best chain we know about, there's no reason for us to download those blocks past the fork
14:10 paulo_ so eventually, If I keep mining the side chain, it's difficulty will go lower. and the client will ignore lower difficulty blocks?
14:13 arubi they're checking for total work done, it's both length and total work
14:14 paulo_ I'm trying to understand when it's safe to ignore a side chain, at the same time preventing a network fork.
14:17 arubi a node will follow the block it heard about first. if it hears about another valid one for the current height, it'll just keep it but still follow its current one. if it hears about a better chain it'll switch to it but still keep it's previous one
14:17 arubi you said you're going to start from very early, so you'll need to catch up until at least the current height to be considered by currently synced nodes'
14:21 paulo_ "if it hears about a better chain it'll switch to it but still keep it's previous one" - and the client will save side chain blocks, until the side chain's difficulty decreases?
14:23 arubi I don't know exactly, but if there are two competing forks with the same difficulty I think it's best to keep track of them both
14:25 paulo_ I'd want to save new side chain blocks, just in case it becomes the main chain. But at the same time, I don't want to be spammed by extensions to old sidechains.
14:25 arubi right, that's the reasoning I believe
14:28 paulo_ what is "total work done"?
14:30 paulo_ i know that hashes need to be lower than the target as POW, but I don't understand how they can be totaled
14:30 arubi each 2016 blocks is a retarget, and you sum up the work done in each of these periods
14:31 arubi 1 work is one hash256
14:31 arubi well, approximately right, large numbers and all
14:34 paulo_ hmmm.
14:35 arubi paulo_, at each of these periods a new target is calculated, and miners commit to that new target in a field in the block header
14:36 arubi so it's easy to just sum these all up as you look at the headers. it doesn't matter what the exact hash of the block was in a period, all blocks are treated as the same work
14:37 arubi all blocks in a period*, so what I mean is, a block's work is known by the bits fields in the block header
14:39 paulo_ so side chains are tagged as ignored during retargets?
14:40 arubi I don't know exactly the threshold to ignore blocks outside our chain, but I'm guessing that if the block is in a shorter chain than ours, then we don't really need it
14:41 paulo_ okay. I'm trying to figure out what exactly "shorter" is.
14:41 arubi less work
14:47 paulo_ you look at the target to determine work, right?
14:49 paulo_ I keep trying to extend a side chain, eventually it's difficul
14:51 paulo_ I keep trying to extend a side chain, eventually its difficulty will decrease since i'll be doing it slower, hence less work. If there is less work compared to the main chain, further extensions to the side chain will be ignored. Is that right?
14:55 arubi yes, that's what I think
14:56 arubi I mean, just extending some low diff chain and broadcasting it will be a successful attack if nodes would default to keep it all
14:58 paulo_ coinbase transactions are spendable after 100 confirmations, I guess it's safe to assume that after 100 blocks, it's considered permanent
15:00 paulo_ i mean no need to save sidechains older than 100 blocks
15:01 eck also consider that if your sidechain has a lower difficulty target than the main chain, by definition that means that you're mining blocks slowly, which makes it hard to catch up even just in terms of block height
16:45 devrandom hi. I have a message stuck in the bitcoin-dev mailing list for a couple of days (titled "Introducing a POW through..."). any pointers on how to get it released?
16:46 devrandom I meant to say "in the bitcoin-dev moderaton queue"
18:28 puchu hi
18:29 puchu how can i manually rebroadcast a transaction from the qt client?
18:30 execute what's happening to bitcoin testnet?
18:33 wumpus puchu: right click, copy transaction data, go to debug console, type sendrawtransaction <paste>
18:34 wumpus (so right click in the transaction list on the transaction you want to send)
18:34 wumpus you can also paste the raw hex into e.g. blockchain.info/pushtx or similar
18:42 puchu wumpus: thanks
19:46 jonasschnelli puchu: there are also standalone dependency free push clients
19:46 jonasschnelli https://github.com/laanwj/bitcoin-submittx
19:46 jonasschnelli https://github.com/libbtc/libbtc
19:52 puchu thanks
19:52 puchu do you also know if its possible to replace a none confirmed transaction with a transacation that has a lower value created with the same UTX
19:53 puchu @jonasschnelli
19:53 jonasschnelli puchu: Most miners/nodes do only allow BIP125 replacements (replace by fee)
19:53 jonasschnelli puchu: so the fee must be higher...
19:53 jonasschnelli You can add an input though
19:53 jonasschnelli You can lower the value of your change output as an example...
19:53 puchu but the transaction value (neto) has to stay the same?
19:53 jonasschnelli but the tx fee must rise
19:54 jonasschnelli you can add input and outputs as long as the fee rises in the in BIP125 way
19:54 puchu or is it possbile to decrease it?
19:55 jonasschnelli puchu: the fee or the output value?
19:55 puchu output value
19:55 jonasschnelli You can reduce the output value... sure. That will result in increasing the fee
19:55 puchu i broadcasted it multiple times but it doesnt show up on any blockexploerer
19:56 puchu no i mean i sent for exmaple 1BTC with 0.001BTC fee and replace it with the same UTX0 but with 0.5BTC+0.002BTC fee
19:57 jonasschnelli Have you signaled BIP125 RBF in your original TX?
19:57 jonasschnelli Otherwise your doing a double-spend
19:57 puchu nope. yeah i do a double spend but i want the later one to get confirmed
19:57 puchu to get the first marked as none valid
19:58 jonasschnelli I see.... that's non-trivial.. maybe have a look at petertodd's double-spend tool (never used, .. don't ask me for further support)
19:58 puchu is the second transaction broadcasted at all?
19:58 puchu i mean relayed
19:58 jonasschnelli Almost all nodes do only accept "replacemenets" if the original transaction has signaled BIP125 RBF.
19:58 puchu usig raw-tx broadcast tools give me an error
19:58 puchu there was no RBF
19:59 puchu and RBF only allows to increase the fee nothing else, the other parts have to stay the same
19:59 puchu as the name says replace by fee
19:59 jonasschnelli no
19:59 puchu really?
20:00 jonasschnelli BIP125 RBF does allow to add inputs and outputs as long as your fee increases (in a certain way)
20:00 jonasschnelli Have a look at BIP125
20:00 jonasschnelli There is another way to get your tx unbstuck...
20:00 jonasschnelli By CPFP
20:00 jonasschnelli Not sure if applicatble to your TX
20:01 jonasschnelli You can spend the unspend output of your "stuck" tx in another tx that pays a "high fee"
20:02 jonasschnelli (only possible if one of the outputs belongs to a key owned by you)
20:02 puchu yeah i have one change key
20:03 puchu so would have to send this to another transaction
20:03 puchu transaction/address
20:05 jonasschnelli yeah... just do a follow up tx with the output of the stuck tx... make sure you pay a high fee
20:05 puchu high = ?
20:05 jonasschnelli heh... difficult question
20:05 puchu current the client recommends 0.002btc/kb
20:05 puchu is 0.003 high?
20:06 jonasschnelli haven't checked my estimator... just double the value if you want a simple answer
20:06 puchu okya i jsut wanted to go with 4 :D
20:07 jonasschnelli a miner must then be interested to collect that fee,... but can only if he also includes your original tx in the new block (==CPFP)
20:09 puchu okay thanks i tried it , if it doenst make it i will end up with the original transaction
20:10 puchu the mempool is completly crouded
20:16 puchu jonasschnelli: thanks for your help
20:17 puchu jonasschnelli: i know what a CPFP is but i never tried it. maybe i should create a third one with the UTX0 from the last CPFP :)
20:17 puchu at least blockchain doesnt show my tx
20:17 puchu blockchain.info
20:51 jonasschnelli puchu: maybe give us (or PM) your txid(s)?
21:02 puchu the first one is confimed :(
21:03 puchu it is as it should be ;)