I am new to BitcoinJ, but it seems like a good tool for building Java 
applications around Bitcoin. I am trying to use BitcoinJ to try and parse 
information from the blockchain. A lot of fields are pretty easy to fetch, 
but I can't seem to get a couple of things.

I'll provide some code below that I have written just to kind of give some 
context as to the types of things I have been trying. As a note, I am using 
Scala for this, but hopefully the code should be somewhat intuitive.

// importing too many things
import org.bitcoinj.core._
import org.bitcoinj.params._
import org.bitcoinj.utils._
import org.bitcoinj.store._
import java.io.File
import java.util.ArrayList

// init
val params = new MainNetParams()
new Context(params)

// load the blockchain files..only loading the first .dat file
val files = new ArrayList[File]()
files.add(new File("blk00000.dat"))
val bfl = new BlockFileLoader(params, files)

// this line will create an array of the first 10,000 blocks
val b = (1 to 10000).map(_ => bfl.next) 

// trying to inspect a transaction..the outputs are below
val ts = b(3888).getTransactions
val t = ts.get(10)
t.getFee
// res34: org.bitcoinj.core.Coin = null
t.getInputSum
// res35: org.bitcoinj.core.Coin = 0

It makes sense that I am unable to get the fee or input sum of the 10th 
transaction of the 3889th block because it doesn't have a link to the 
previous transactions. How can I add these links so I can use functionality 
like getFee and getInputSum?

I have tried to create a MemoryBlockStore object and BlockChain object in 
hopes that these would link up the transactions, but apparently 
StoredBlocks only store the headers of blocks but not the transactions 
themselves. so I am unable to access them. 

Does anyone have any idea how I can accomplish this?

-- 
You received this message because you are subscribed to the Google Groups 
"bitcoinj" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to