Transcript for #bitcoin-dev 2017/05/11

03:57 RainMan28 is there a way to specifically spend some incoming unconfirmed coins on a bitcoind wallet with a higher fee (basically CPFP from command line)?
06:04 wumpus RainMan28: the only way to do that is manual: listunspent, then create a transaction using raw transactions API, then send it using sendrawtransaction
09:22 negatratoron hello
09:22 negatratoron i'm trying to figure out why bitcoin-core isn't synchronizing in a timely manner
09:27 negatratoron the bitcoin-qt client is hung at block #464933, and shows the message "Connecting to peers..."
17:12 ineb iam trying to understand btc and i wonder if some pool miner found a share, which is also valid for the network, could simply not submit that share to the pool and use it only for himself
17:12 abpa How would he use it for himself?
17:13 ineb i mean as if he is solo mining
17:13 arubi then he is not a part of a pool
17:13 ineb not sending the share to the pool but to the btc network instead and get all rewards for himself
17:13 abpa how does he get the rewards?
17:14 ineb maybe my understanding is wrong. i think that a share is a hash with lower difficulty than the btc network. however, a share is now and then also a valid hash for the btc network
17:15 abpa The reward payouts are part of the winning hash
17:15 abpa If you change the payouts, the hash is no longer valid
17:17 ineb ok one more time, consider a miner that sends all useless shares to the pool but if he founds the golden one which is also valid for the btc network, then he is submitting it directly to the network instead to the pool
17:17 abpa The payouts are in the hash
17:17 abpa You can't change the payouts
17:18 ineb is this because of the nonce from the pool?
17:18 abpa The way to win is to get a hash that matches a special pattern
17:18 abpa The hash is derived from many things, including the payout addresses
17:18 abpa You can't change the payout addresses after you win
17:18 ineb ahh
17:19 ineb that makes sense now
17:19 ineb ok i will look futher into it. thanks for your information
17:19 abpa np
18:19 suryab anyone have any thoughts on why a Bitcoin node would log `sending alert peer=145` before disconnecting from me? I looked up alerts and looks like they are an old thing
18:19 suryab to my knowledge the bitcoin code is up to date
18:21 achow101 suryab: core 0.14.0 sends a max sequence alert to ensure that all old nodes know that the alert system is disabled.
18:22 achow101 suryab:
18:22 arubi suryab, do you have the useragent for that peer? maybe one of these tracking peers that "ping" you and disconnect right after
18:24 suryab hmmm,
18:24 suryab so i tell the node that my version number is 70002
18:25 arubi I think that's the wallet version
18:25 suryab i actually have two bitcoin nodes that I'm running and want one to connect to the other
18:26 suryab one of them is relatively old and the other one is completely new
18:26 arubi that's the most convoluted XY problem I ever witnessed :)
18:27 suryab 2017-05-11 18:13:46 receive version message: <subversion>: version 70002, blocks=346110, us=, peer=185 2017-05-11 18:13:46 sending alert (168 bytes) peer=185 2017-05-11 18:14:42 disconnecting peer=185
18:27 arubi try with -whitelist
18:28 arubi on the serving node. -connect on the client node
18:28 suryab i'll give that a try but do you have any idea what could be causing this?
18:29 arubi I'm guessing your node just wants to connect to witness nodes
18:29 suryab even if this is on mainnet?
18:29 arubi the new one that is
18:29 arubi especially on mainnet
18:30 achow101 suryab: core 0.13.0+ won't use its outbound connections to non-segwit nodes
18:30 achow101 you should be able to override that with -whitelist and -addnode
18:30 suryab the new node isn't creating an outbound connection, i'm connectingg to it fro the other node
18:32 arubi best to try with whitelist and addnode before trying to debug further
18:32 suryab okay
18:32 arubi it could be that the ip's are similar, slots are exhausted..
18:33 arubi I /think/ a node avoids connecting to "near by" peers.. not sure
21:22 RainMan28 i'm trying to use the tool to create a raw txn in order to bump the miner fee for some coins that are waiting to confirm to my wallet. Could anyone help me please? I am not sure what to enter for vout or script.
21:25 abpa RainMan28 was your transaction flagged RBF?
21:26 RainMan28 abpa: no, I am the receiving party though, and was hoping to use my receiving address' private key to create a new raw txn to myself with a higher fee
21:27 abpa So child pays for parent?
21:27 RainMan28 yes
21:27 RainMan28 but I am trying to use the tool to create the transaction and am not sure what to enter in for vout and script fields for the input
21:28 abpa Why don't you just use a normal wallet
21:28 RainMan28 the coins were sent to my bitcoind wallet but the node doesn't see the transaction because the fee paid was way too low and isn't being relayed by other nodes
21:29 RainMan28 if there's another way to do this thats easier, I'm all ears though
21:30 abpa If the fee is too low to be relayed, how will child pays for parent work?
21:30 abpa You could try submitting the raw transaction to your own node though
21:30 abpa sendrawtransaction
21:32 RainMan28 abpa: maybe I don't understand CPFP correctly but won't I be able to use some of the output amount as the miner fee and can't I make the miner fee larger that way?
21:32 RainMan28 How can I get the raw transaction?
21:32 RainMan28 here is the txid:
21:32 abpa What is the transaction id?
21:33 achow101 RainMan28: low fee isn't your only problem. There's also the fact that that transaction spends from another unconfirmed transaction which has an even low fee
21:34 abpa wow, low fee
21:34 abpa that is below the min relay fee so it might not get to the miners at all
21:34 abpa that would mean you couldn't use child pays for parent since they wouldn't know your parent
21:36 RainMan28 I see. So I can't just pay a high enough fee to be high enough for both txns?
21:36 abpa Normally you can if the tx fee is high enough to be relayed
21:36 achow101 RainMan28: You should be able to
21:37 RainMan28 ok so I want to pay like 0.005 BTC as a fee, that should be high enough to get them both included easily
21:38 achow101 don't go by a fixed fee, use fee rate instead and calculate what the aggregate fees for all three of the transactions should be. then use that as the fee for the cpfp transaction
21:41 RainMan28 achow101: ok that part i can handle, what i don't know how to do is how to create the transaction
21:42 RainMan28 on's new transaction tool,, it asks for outputs and inputs. I place my new receive address in the output. For inputs, it wants the transaction ID, and N, and script. I don't know what N and Script are supposed to be.
21:44 achow101 N is the output index of the output you want to spend. script is the script associated with that output
21:46 achow101 the output index starts from 0. For example, if you want to spend the output going to 14qgdqnQT7F4RiSWne2QrjwFn4warqEfTh, the output index is 1 and the script is 76a9202a1d6de72a50dba70848ed01a142d65a86adaf63878ac
21:46 RainMan28 how did you determine that achow101?
21:46 RainMan28 that is the gap in my knowledge
21:47 achow101 look at your transaction that you posted and make sure that you are in advanced mode on so it shows all inputs, outputs, and scripts
21:48 achow101 look in the outputs side of the transaction. starting from 0, count from the top down until you reach the output you want to spend. Whatever number you get is the output index
21:49 RainMan28 Ok i have seen show the output addresses in different sequences before on page reloads before so i wasn't sure if that was how it works
21:49 achow101 scroll down to the bottom where it says output scripts. again, starting from 0, find the output script for your transaction by counting from the top down until you get to the number of the output index. whichever script you are on is the output script that you want to spend
21:49 achow101 I've never seen do that before
21:50 RainMan28 achow101: ok i must be mistaken. now for the input script i do the same thing? I start from 0 and count to 1 (the second one)?
21:51 RainMan28 oh wait I don't need the input scripts from that txid, just the output scripts
21:51 achow101 what I described is how you get the numbers to enter for the inputs section of's transaction maker
21:51 achow101 right, it's all based on outputs
21:52 achow101 but finding input scripts works in the same way
21:54 RainMan28 achow101: so i see the following as the script: OP_DUP OP_HASH160 2a1d6de72a50dba70848ed01a142d65a86adaf63 OP_EQUALVERIFY OP_CHECKSIG but what you pasted is different?
21:54 RainMan28 you said the script is: 76a9202a1d6de72a50dba70848ed01a142d65a86adaf63878ac
21:55 achow101 only takes the hex of the script itself, not the names of the opcodes.
21:55 achow101 OP_DUP is 76, OP_HASH160 is a9, 20 is for the length of the hash that follows, OP_EQUALVERIFY is 88 and OP_CHECKSIG is ac
21:56 achow101 A list of opcodes can be found here:
21:56 RainMan28 are you a wizard
21:56 achow101 nope :D
21:56 achow101 I just know the output formats after staring at them for a long time now
21:57 RainMan28 achow101: very nice. so i tried to create, and sign the transaction and now I am receiving this error when broadcasting: 64: scriptsig-not-pushonly
21:58 achow101 don't use to sign transactions. something is wrong with their signer. Use bitcoind instead
21:58 RainMan28 doh!
21:59 RainMan28 ok so i see that i have to do bitcoin-cli signrawtransaction
21:59 RainMan28 but is the hexstring what generated for me
21:59 achow101 yes
22:00 achow101 since your bitcoind doesn't have the previous transaction, you will also need to supply the outputs array too. that will just have the info that you got for
22:03 RainMan28 achow101: ok i am trying to follow along here
22:04 RainMan28 the first part is the hexstring which I have
22:06 RainMan28 then i do {"tx_id":"id" so in this part i put the txid where it says "id" ?
22:06 achow101 your full command should be this: bitcoin-cli signrawtransaction <hex> '[{"txid":"db42ec6e7d8d70889886b89dd43b4f34f9d694aca1aeb1b9e17f60cd660736f2","vout":1,"scriptPubKey": "76a9202a1d6de72a50dba70848ed01a142d65a86adaf63878ac","amount":0.82848}]'
22:06 achow101 obviously replace <hex> with the hextring you got from coinbin
22:06 RainMan28 you're the man
22:06 RainMan28 thank you so much
22:07 achow101 use decoderawtransaction with the hex that signrawtransaction spits out to double check that everything is right before you send it
22:07 RainMan28 ok
22:07 achow101 make sure that the fee is right. its the most important part :)
22:08 RainMan28 blah it is telling me that the scriptPubKey must be hexadecimal string
22:09 achow101 could you paste your full command?
22:09 RainMan28 sure
22:10 RainMan28 bitcoin-cli signrawtransaction 0100000001f2360766cd607fe1b9b1aea1ac94d6f9344f3bd49db8869888708d7d6eec42db010000001a76a9202a1d6de72a50dba70848ed01a142d65a86adaf63878a0cffffffff01c0e6e004000000001976a914c997567d6e073832ea6cf51226a4dfff918447fe88ac00000000 '[{"txid":"db42ec6e7d8d70889886b89dd43b4f34f9d694aca1aeb1b9e17f60cd660736f2","vout":1,"scriptPubKey": "76a9202a1d6de72a50dba70848ed01a142d65a86ada
22:10 RainMan28 f63878ac","amount":0.82848}]'
22:11 achow101 try removing the space after "scriptPubKey":
22:11 RainMan28 ok
22:11 achow101 I don't remember if whitespace matters, but it might
22:11 RainMan28 scriptPubKey must be hexadecimal string (not '76a9202a1d6de72a50dba70848ed01a142d65a86adaf63878ac')
22:12 achow101 oh, I see it now. I forget an extra 8 before ac at the end
22:12 RainMan28 ah nice
22:12 RainMan28 that worked, but gave a different error
22:13 achow101 err. actually the script is 76a9202a1d6de72a50dba70848ed01a142d65a86adaf6388ac
22:13 RainMan28 oh ok
22:13 RainMan28 achow101:
22:15 achow101 bleh. I remembered the format wrong. it's actually 76a9142a1d6de72a50dba70848ed01a142d65a86adaf6388ac. this time its right, I pulled it from the raw transaction itself :D
22:15 RainMan28 No problem, thank you!!
22:15 achow101 np
22:15 RainMan28 that worked
22:15 RainMan28 now i will decode it
22:16 RainMan28 looks good!
22:16 achow101 great. you can send it with sendrawtransaction
22:17 achow101 and then hope that miners use CPFP
22:20 RainMan28 error code: -25
22:20 RainMan28 error message:
22:20 RainMan28 Missing inputs
22:20 RainMan28 when i tried to do bitcoin-cli sendrawtransaction
22:20 RainMan28 with the raw hash
22:20 achow101 derp. your node doesn't have the previous transaction, so it can't accept your transaction
22:20 RainMan28 oh right
22:21 RainMan28 you mentioned that
22:21 achow101 just use some transaction broadcasting service. has one
22:21 RainMan28 OK
22:24 RainMan28 wow achow101 that worked
22:24 RainMan28 you are awesome
22:24 RainMan28 that is some complicated stuff
22:25 achow101 RainMan28: no problem.
22:26 achow101 lol. 5,235.602 sat/B I think you're getting into absurd fee territory there :p
22:29 RainMan28 achow101: haha it is cheaper than asking ViaBTC to mine it.
22:29 RainMan28 achow101: I have actually one more so am going to try to do this one myself