Transcript for #bitcoin-dev 2018/04/03

04:29 ProfMac_ I want to serialize a block, viz:
04:29 ProfMac_ CBlock *pblock = &pblocktemplate->block; // pointer for convenience
04:29 ProfMac_ //some operations omitted for clarity
04:29 ProfMac_ ssCB << pblock;
04:30 ProfMac_ and I get a complaint about ambiguous templates.
04:30 ProfMac_ Has anyone done this?
05:07 sipa ProfMac_: pblock is a pointer; you can't serialize a poijter
05:07 sipa try ssCB << *pblock
06:11 ProfMac_ sipa, success. Thanks.
09:14 armid sturles: Thanks! but if 2 transactions occur in the different timestamp?
09:15 armid if transaction to B is broadcasted first
09:15 armid then 30 mins later, transaction to C is broadcasted
09:15 armid but transaction to B isn't in any block yet
09:16 armid so it couldn't be A -> B 2 coins, A -> C 1 coin and A -> A 7 coins.
09:18 sturles armid: The input can only be spent by one transaction. In my example there is only one transaction. If you need to split in to several transactions, there would be e.g. A -> B 2 BTC + A' 8 BTC. Then A' -> C 1 BTC + A'' 7 BTC.
09:19 sturles Note that A' isn't valid until the transaction to B has been confirmed. (Which may happen in the same block as the second transaction, as long as the first tx appear before the second in the block.)
09:19 sturles Transactions don't have timestamps.
09:53 armid Oh sorry, I meant in the different time not timestamp
09:56 sturles Still doesn't matter. In the case of multiple transactions, the transactions must be confirmed in the correct order to be valid. A transaction output is not valid as input until the transaction creating it has been confirmed, and the input can be spent only once.
09:57 arubi nit: it doesn't have to be confirmed, just valid to spend right now
09:58 arubi I mean, you can have a chain of unconfirmed transactions like cpfp
09:59 armid Could you please help me solving this? I mean not coding but how to manage it
09:59 armid
09:59 armid TxID: 598b4e12b0bd16e87f7cdd108a4361c27c147e943fe7742a807dd3d8d0a7f2db
10:00 armid was reused as inputs
10:00 armid because it's not removed from UTXOPool since the first transaction which used it isn't in the chain yet
10:01 armid I don't know where I should fix this. Client who tries to send coins
10:01 armid or miners who validate things
10:03 sturles A chain of unconfirmed transactions *must* be confirmed in strict order to be valid.
10:03 arubi yes, that's right
10:03 sturles With that in mind, there is nothing wrong with chains of unconfirmed transactions.
10:04 sturles If one transaction in the chain is replaced, the rest are invalid.
10:04 sturles The rest of the chain from there.
10:05 arubi yep, was just nit'ing the "A transaction output is not valid as input until the transaction creating it has been confirmed" part, but we're saying the same thing
10:06 arubi it's valid as a spend, but invalid if it confirms on its own without the parent before it in the block
10:08 armid Oh that explains it
10:08 armid Thanks alot!!
13:08 TyrfingMjolnir Where in the source code is the bitcoin and wallets defined? Some set of hierarchical structs perhaps?
13:08 TyrfingMjolnir I'm reading Mastering Bitcoin and would like to have the actual code in front of me to see how this is implemented.
15:36 satwo Hello all. Are there any performance differences between bitcoind's REST API and JSON-RPC, or is it purely a matter of developer preference?
15:38 sipa they're very similar
15:38 sipa rest is for public data
15:38 sipa rpc needs aurhentication
15:41 satwo Thank you sipa. Mainly concerned with querying historical fees; having to query all the inputs of a tx drives up the processing time substantially
15:41 satwo I'm working on implementing batch calls, hopefully that will help.
16:33 TyrfingMjolnir In particular then sending and receiving wallet.
18:56 paint-it-black Luke, in the libblkmaker, example.c .. in a sentence what is it doing?
18:56 paint-it-black I see the nonce loop in there and think, gosh, it is a little miner example ..
18:56 paint-it-black but then I think it is a getblktemplate example ..
19:15 TyrfingMjolnir I have installed the bitcoin wallet on my machine, downloaded the block chain.
19:16 TyrfingMjolnir How can I traverse the blocks looking at the timestamp, wallet source, wallet destination, amount?
19:16 TyrfingMjolnir Is there a struct defined anywhere?
19:18 TyrfingMjolnir I'm here:
19:18 TyrfingMjolnir cd /opt/local/de
19:18 sipa there is no such thing as "wallet source"
19:20 TyrfingMjolnir But there are blocks in a file in data of bitcoin
19:21 TyrfingMjolnir and some struct defined in bitcoin core
19:21 sipa yes
19:21 TyrfingMjolnir There has to be a to and from for each transaction, no?
19:21 sipa no
19:21 TyrfingMjolnir Where is this struct defined?
19:21 sipa that's not how bitcoin transactions work
19:21 TyrfingMjolnir So to and from is from context?
19:21 sipa there is no "from"
19:21 sipa transactions create and spend "coins"
19:22 sipa each coin has an amount and an address (or script, more generally)
19:22 sipa every transactions specifies which exact outputs from previous transactions it spends
19:22 sipa you can see this as metal coins of various sizes
19:22 sipa and transactions that melt those coins down and cast them into different coins, with the same value overall
19:22 sipa say i send you 1 BTC
19:22 sipa you now have 1 BTC coin
19:23 sipa you send 0.3 BTC to someone else
19:24 sipa this means you create a tx which burns the 1 BTC coin, and creates 2 new coins: one of 0.3 BTC (assigned to your recipient) and one of 0.7 BTC (assigned to a different address of yourself)
19:25 TyrfingMjolnir Where in the path or function to the class or struct that describes each transaction?
19:25 TyrfingMjolnir sipa: Well explained, thanks.
19:25 sipa
19:26 TyrfingMjolnir thanks a heap
19:57 paint-it-black_ would some kind sole please copy the response to my question about example.c ? .. the machine rebooted and it doesn't look like one can scroll up here
20:02 paint-it-black_ .. never mind, just found the log .. and ah, no one had answered anyway ...LOL
20:50 paint-it-black_ trying to build a debug version of example for libblkmaker ... added a -g3 to the every line in before running automake but that isn't doing the trick ...
20:50 paint-it-black_ (debian/Ubuntu system)
21:10 paint-it-black_ to run the libblkmaker example in gdb:
21:11 paint-it-black_ gdb .lib/example
21:11 paint-it-black_ then (gdb) set environment LD_LIBRARY_PATH=/home/prevail/projects/btc/libblkmaker/.libs
21:11 paint-it-black_ set your absolute lib path of course
22:45 TyrfingMjolnir paint-it-black_: I believe it's called kind soul; sole is something below your feet.