Yes, you could probably do that. The API for connecting outputs with
inputs is public. And who knows, maybe we could add a "FullBlockStore"
to bitcoinj in future?


On 03/22/2017 10:57 PM, Sidd S wrote:
> Hi Andreas,
> 
> Thanks for the information! At this point, I guess the solution will be
> write some code manually that will connect transaction inputs and
> outputs together to calculate those fields, which hopefully shouldn't be
> super painful.
> 
> Sidd
> 
> On Wednesday, March 22, 2017 at 5:42:21 PM UTC-4, Andreas Schildbach wrote:
> 
>     Welcome to bitcoinj!
> 
>     The input values and the fee is only known for transactions that were
>     created by bitcoinj's Wallet (which you're likely not using anyway).
>     For
>     incoming transactions there values are missing, it's a known limitation
>     of the Bitcoin protocol.
> 
>     Yes, MemoryBlockStore only stores headers. Afaik there is no block
>     store
>     in bitcoinj that actually stores the transactions. Bitcoinj is mainly
>     designed for wallets and as a wallet you'd only keep what's relevant
>     to you.
> 
> 
>     On 03/22/2017 08:46 PM, Sidd S wrote:
>     > 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]
>     > <mailto:[email protected]>.
>     > For more options, visit https://groups.google.com/d/optout
>     <https://groups.google.com/d/optout>.
> 
> 
> -- 
> 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]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.


-- 
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