Bitcoin Forum
May 11, 2024, 12:29:41 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Block parsing and getting values.  (Read 811 times)
coder0x15 (OP)
Jr. Member
*
Offline Offline

Activity: 36
Merit: 3


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?
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715387381
Hero Member
*
Offline Offline

Posts: 1715387381

View Profile Personal Message (Offline)

Ignore
1715387381
Reply with quote  #2

1715387381
Report to moderator
1715387381
Hero Member
*
Offline Offline

Posts: 1715387381

View Profile Personal Message (Offline)

Ignore
1715387381
Reply with quote  #2

1715387381
Report to moderator
1715387381
Hero Member
*
Offline Offline

Posts: 1715387381

View Profile Personal Message (Offline)

Ignore
1715387381
Reply with quote  #2

1715387381
Report to moderator
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
November 09, 2016, 10:41:49 AM
Merited by ABCbits (1)
 #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?

Im not really here, its just your imagination.
sophia martin
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
November 09, 2016, 11:00:29 AM
Last edit: November 12, 2016, 10:46:02 AM by sophia martin
 #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:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!