Author

Topic: Block parsing and getting values. (Read 815 times)

newbie
Activity: 1
Merit: 0
November 09, 2016, 07:00:29 AM
#3
Looks Like
var lastReading = 0
is defined inside a class (better add context code to know where it is defined). If that is the case, you're probably executing your block / closure in a different thread. So:

you set lastReading = 0
you launch some time-consuming task in another thread. The main thread (or the thread running that code) continues executing immediately. At the end of the block, you assign lastReading.
if you check lastReading just after the block, nothing changes. Still == 0. That's because Main thread executes immediately and lastReading hasn't changed.
I'd better call a method to update lastReading at the end of the block:
var lastReading = 0

Query.getFirstObjectInBackgroundWithBlock(

    {(data:PFObject?,error:NSError?) -> Void in

    var dataEntry = data!

    var Reading: AnyObject! = dataEntry["reading"]!

    self.updatelastReading(Reading.integerValue)
})
copper member
Activity: 1498
Merit: 1499
No I dont escrow anymore.
November 09, 2016, 06:41:49 AM
#2
Being still very novice in the subject, there was a question about parsing blocks.
I understand that the block contains the transaction, each containing the inputs and outputs.
Outputs include the Value is Satoshi (8 bytes) and Address (20 bytes or 32 bytes ripemd160 publicKey).
Question. How to get a list of the form [Address1, Value1], [Address2, Value2] ... and so on, after parsing few blk00*.dat files?
It is clear how to add ballance for each address. But how to subtract?
It is also clear that value of the the transaction outputs is equal to the sum of the inputs. But this is only an indirect indication.
Prompt where to dig. How do I get this information?


Have you tried asking bitcoin core instead of the files directly?
jr. member
Activity: 36
Merit: 3
November 09, 2016, 06:35:15 AM
#1
Being still very novice in the subject, there was a question about parsing blocks.
I understand that the block contains the transaction, each containing the inputs and outputs.
Outputs include the Value is Satoshi (8 bytes) and Address (20 bytes or 32 bytes ripemd160 publicKey).
Question. How to get a list of the form [Address1, Value1], [Address2, Value2] ... and so on, after parsing few blk00*.dat files?
It is clear how to add ballance for each address. But how to subtract?
It is also clear that value of the the transaction outputs is equal to the sum of the inputs. But this is only an indirect indication.
Prompt where to dig. How do I get this information?
Jump to: