1 2018-04-03 04:29:40 <ProfMac_> I want to serialize a block, viz:
 2 2018-04-03 04:29:42 <ProfMac_> CBlock *pblock = &pblocktemplate->block; // pointer for convenience
 3 2018-04-03 04:29:42 <ProfMac_> //some operations omitted for clarity
 4 2018-04-03 04:29:43 <ProfMac_> CDataStream ssCB(SER_NETWORK, PROTOCOL_VERSION);
 5 2018-04-03 04:29:43 <ProfMac_> ssCB << pblock;
 6 2018-04-03 04:30:05 <ProfMac_> and I get a complaint about ambiguous templates.
 7 2018-04-03 04:30:47 <ProfMac_> Has anyone done this?
 8 2018-04-03 05:07:12 <sipa> ProfMac_: pblock is a pointer; you can't serialize a poijter
 9 2018-04-03 05:07:22 <sipa> try ssCB << *pblock
10 2018-04-03 06:11:19 <ProfMac_> sipa, success.  Thanks.
11 2018-04-03 09:14:55 <armid> sturles: Thanks! but if 2 transactions occur in the different timestamp?
12 2018-04-03 09:15:11 <armid> if transaction to B is broadcasted first
13 2018-04-03 09:15:28 <armid> then 30 mins later, transaction to C is broadcasted
14 2018-04-03 09:15:44 <armid> but transaction to B isn't in any block yet
15 2018-04-03 09:16:09 <armid> so it couldn't be A -> B 2 coins, A -> C 1 coin and A -> A 7 coins.
16 2018-04-03 09:18:38 <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.
17 2018-04-03 09:19:51 <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.)
18 2018-04-03 09:19:59 <sturles> Transactions don't have timestamps.
19 2018-04-03 09:53:22 <armid> Oh sorry, I meant in the different time not timestamp
20 2018-04-03 09:56:52 <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.
21 2018-04-03 09:57:54 <arubi> nit:  it doesn't have to be confirmed, just valid to spend right now
22 2018-04-03 09:58:25 <arubi> I mean, you can have a chain of unconfirmed transactions like cpfp
23 2018-04-03 09:59:46 <armid> Could you please help me solving this? I mean not coding but how to manage it
24 2018-04-03 09:59:48 <armid> https://github.com/Jeiwan/blockchain_go/issues/23
25 2018-04-03 09:59:55 <armid> TxID: 598b4e12b0bd16e87f7cdd108a4361c27c147e943fe7742a807dd3d8d0a7f2db
26 2018-04-03 10:00:01 <armid> was reused as inputs
27 2018-04-03 10:00:38 <armid> because it's not removed from UTXOPool since the first transaction which used it isn't in the chain yet
28 2018-04-03 10:01:29 <armid> I don't know where I should fix this. Client who tries to send coins
29 2018-04-03 10:01:38 <armid> or miners who validate things
30 2018-04-03 10:03:18 <sturles> A chain of unconfirmed transactions *must* be confirmed in strict order to be valid.
31 2018-04-03 10:03:29 <arubi> yes, that's right
32 2018-04-03 10:03:58 <sturles> With that in mind, there is nothing wrong with chains of unconfirmed transactions.
33 2018-04-03 10:04:12 <sturles> If one transaction in the chain is replaced, the rest are invalid.
34 2018-04-03 10:04:22 <sturles> The rest of the chain from there.
35 2018-04-03 10:05:25 <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
36 2018-04-03 10:06:14 <arubi> it's valid as a spend, but invalid if it confirms on its own without the parent before it in the block
37 2018-04-03 10:08:13 <armid> Oh that explains it
38 2018-04-03 10:08:16 <armid> Thanks alot!!
39 2018-04-03 13:08:03 <TyrfingMjolnir> Where in the source code is the bitcoin and wallets defined? Some set of hierarchical structs perhaps?
40 2018-04-03 13:08:06 <TyrfingMjolnir> I'm reading Mastering Bitcoin and would like to have the actual code in front of me to see how this is implemented.
41 2018-04-03 15:36:21 <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?
42 2018-04-03 15:38:07 <sipa> they're very similar
43 2018-04-03 15:38:12 <sipa> rest is for public data
44 2018-04-03 15:38:17 <sipa> rpc needs aurhentication
45 2018-04-03 15:41:07 <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
46 2018-04-03 15:41:57 <satwo> I'm working on implementing batch calls, hopefully that will help.
47 2018-04-03 16:33:01 <TyrfingMjolnir> In particular then sending and receiving wallet.
48 2018-04-03 18:56:00 <paint-it-black> Luke,  in the libblkmaker, example.c  .. in a sentence what is it doing?
49 2018-04-03 18:56:27 <paint-it-black> I see the nonce loop in there and think, gosh, it is a little miner example ..
50 2018-04-03 18:56:40 <paint-it-black> but then I think it is a getblktemplate example ..
51 2018-04-03 19:15:12 <TyrfingMjolnir> I have installed the bitcoin wallet on my machine, downloaded the block chain.
52 2018-04-03 19:16:35 <TyrfingMjolnir> How can I traverse the blocks looking at the timestamp, wallet source, wallet destination, amount?
53 2018-04-03 19:16:42 <TyrfingMjolnir> Is there a struct defined anywhere?
54 2018-04-03 19:18:03 <TyrfingMjolnir> I'm here: https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp#L1098
55 2018-04-03 19:18:17 <TyrfingMjolnir> cd /opt/local/de
56 2018-04-03 19:18:21 <sipa> there is no such thing as "wallet source"
57 2018-04-03 19:20:51 <TyrfingMjolnir> But there are blocks in a file in data of bitcoin
58 2018-04-03 19:21:00 <TyrfingMjolnir> and some struct defined in bitcoin core
59 2018-04-03 19:21:17 <sipa> yes
60 2018-04-03 19:21:18 <TyrfingMjolnir> There has to be a to and from for each transaction, no?
61 2018-04-03 19:21:21 <sipa> no
62 2018-04-03 19:21:26 <TyrfingMjolnir> Where is this struct defined?
63 2018-04-03 19:21:29 <sipa> that's not how bitcoin transactions work
64 2018-04-03 19:21:34 <TyrfingMjolnir> So to and from is from context?
65 2018-04-03 19:21:41 <sipa> there is no "from"
66 2018-04-03 19:21:49 <sipa> transactions create and spend "coins"
67 2018-04-03 19:22:00 <sipa> each coin has an amount and an address (or script, more generally)
68 2018-04-03 19:22:17 <sipa> every transactions specifies which exact outputs from previous transactions it spends
69 2018-04-03 19:22:28 <sipa> you can see this as metal coins of various sizes
70 2018-04-03 19:22:44 <sipa> and transactions that melt those coins down and cast them into different coins, with the same value overall
71 2018-04-03 19:22:48 <sipa> say i send you 1 BTC
72 2018-04-03 19:22:52 <sipa> you now have 1 BTC coin
73 2018-04-03 19:23:02 <sipa> you send 0.3 BTC to someone else
74 2018-04-03 19:24:00 <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)
75 2018-04-03 19:25:27 <TyrfingMjolnir> Where in the path or function to the class or struct that describes each transaction?
76 2018-04-03 19:25:46 <TyrfingMjolnir> sipa: Well explained, thanks.
77 2018-04-03 19:25:48 <sipa> https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h
78 2018-04-03 19:26:03 <TyrfingMjolnir> thanks a heap
79 2018-04-03 19:57:24 <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
80 2018-04-03 20:02:44 <paint-it-black_> .. never mind, just found the log .. and ah, no one had answered anyway ...LOL
81 2018-04-03 20:50:00 <paint-it-black_> trying to build a debug version of example for libblkmaker ... added a -g3 to the every line in Makefile.am before running automake but that isn't doing the trick ...
82 2018-04-03 20:50:21 <paint-it-black_> (debian/Ubuntu system)
83 2018-04-03 21:10:50 <paint-it-black_> to run the libblkmaker example in gdb:
84 2018-04-03 21:11:02 <paint-it-black_> gdb .lib/example
85 2018-04-03 21:11:05 <paint-it-black_> then (gdb) set environment LD_LIBRARY_PATH=/home/prevail/projects/btc/libblkmaker/.libs
86 2018-04-03 21:11:35 <paint-it-black_> set your absolute lib path of course
87 2018-04-03 22:45:46 <TyrfingMjolnir> paint-it-black_: I believe it's called kind soul; sole is something below your feet.