Bitcoin Forum
July 21, 2018, 03:00:36 AM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Block parsing and getting values.  (Read 686 times)
coder0x15
Jr. Member
*
Offline Offline

Activity: 31
Merit: 1

chess newbie


View Profile
November 09, 2016, 10: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?
1532142036
Hero Member
*
Offline Offline

Posts: 1532142036

View Profile Personal Message (Offline)

Ignore
1532142036
Reply with quote  #2

1532142036
Report to moderator
1532142036
Hero Member
*
Offline Offline

Posts: 1532142036

View Profile Personal Message (Offline)

Ignore
1532142036
Reply with quote  #2

1532142036
Report to moderator
1532142036
Hero Member
*
Offline Offline

Posts: 1532142036

View Profile Personal Message (Offline)

Ignore
1532142036
Reply with quote  #2

1532142036
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1532142036
Hero Member
*
Offline Offline

Posts: 1532142036

View Profile Personal Message (Offline)

Ignore
1532142036
Reply with quote  #2

1532142036
Report to moderator
1532142036
Hero Member
*
Offline Offline

Posts: 1532142036

View Profile Personal Message (Offline)

Ignore
1532142036
Reply with quote  #2

1532142036
Report to moderator
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1470
Merit: 1236


No I dont escrow anymore.


View Profile WWW
November 09, 2016, 10: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?
sophia martin
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
November 09, 2016, 11: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)
})
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!