Hi, I'm developing a block explorer in java using BITCOINJ version 0.14.4.
There is a problem that can not be answered on the internet or in the forum, I can not access information in the Transaction Input as the fee or sum of the inputs. I tried to use the *SPVBlockStore* to *MySQLFullPrunedBlockStore* for a complete copy of the blockchain, even though the information remains "hidden". I need this information to develop services like: https://blockchain.info | https://live.blockcypher.com | https://blockexplorer.com/ Below is part of the application code: public static MySQLFullPrunedBlockStore createStore(NetworkParameters params, int blockCount) throws BlockStoreException { return new MySQLFullPrunedBlockStore(params, blockCount, DB_HOSTNAME, DB_NAME, DB_USERNAME, DB_PASSWORD); } private static NetworkParameters networkParameters = TestNet3Params.get (); public static void main(String[] args) throws Exception { MySQLFullPrunedBlockStore chainStore = createStore( networkParameters, 1000); FullPrunedBlockChain chain = new FullPrunedBlockChain( networkParameters, chainStore); PeerGroup peerGroup = new PeerGroup(networkParameters, chain); peerGroup.addPeerDiscovery(new DnsDiscovery(networkParameters)); BlockDownloadedManager blockDM = new BlockDownloadedManager(); peerGroup.startAsync(); peerGroup.addBlocksDownloadedEventListener(blockDM); peerGroup.downloadBlockChain(); blockDM.wait(); peerGroup.stop(); } public class BlockDownloadedManager implements BlocksDownloadedEventListener { @Override public void onBlocksDownloaded(Peer peer, Block block, FilteredBlock filteredBlock, int blocksLeft) { System.out.println( "-------------------------------------------------------------------------------------" ); System.out.println("hash - "+block.getHashAsString()); System.out.println("transactions numer - " + block. getTransactions().size()); blockDetail(block); } static void blockDetail(Block block) { List<Transaction> tx_list = block.getTransactions(); for(Transaction t : tx_list){ System.out.println("hash - "+t.getHashAsString()); System.out.println("input sum -" +t.getInputSum()); System.out.println("output sum -" +t.getOutputSum()); System.out.println("fee calc - "+(t.getInputSum(). getValue() > 0 ? t.getInputSum().getValue() - t.getOutputSum().getValue() : 0)); System.out.println("fee -"+ t.getFee()); System.out.println("size - "+t.getMessageSize()); } } } *LOGS:* ------------------------------------------------------------------------------------- hash - 00000000e95fbedad07b7f95fa56e95ba11ed40f6a9f4b74fa2e0ce128ff6a42 transactions numer - 1 hash - d2e1049b895946525eb480070bcf678d94f709d6d621d79415dacb5ce73ac9db input sum -0 output sum -5000000000 fee calc - 0 fee -null size - 96 ------------------------------------------------------------------------------------- hash - 00000000409087525f6977c2634e636509e20bc61bc1c6e86eb6d17a394d7a7a transactions numer - 2 hash - 1b93146ca6ec328b8f9e976fd49cd8dd4b74f2c1277807c75e941991948701bb input sum -0 output sum -5000000000 fee calc - 0 fee -null size - 96 hash - e2e5b1e29596105817b74f50cfde585baeeddb6125f9e03e8a22858def9293f2 input sum -0 output sum -4900000000 fee calc - 0 fee -null size - 192 ------------------------------------------------------------------------------------- hash - 00000000d986f90a094b707e9ef4bf412d9a2a14df872e9409ddca7e0865bde6 transactions numer - 2 hash - 5ccf7e3494f5f05398b04f6bb3a72b635b2de6c494572c3e2078c8d89532abb3 input sum -0 output sum -5000050000 fee calc - 0 fee -null size - 96 hash - 23cc5dadd87f91c1fdce9c0ad090ce8f6e7fd7f79834ad1e579cd5a952c7c6b1 input sum -0 output sum -4904431364 fee calc - 0 fee -null size - 373 ------------------------------------------------------------------------------------- hash - 000000004480dd8aa5a351cb8d66fb332496f4d54c97fb87584322ab05342144 transactions numer - 1 hash - 848771ee8e27418ec8af0c08ecfa61d6af230dfd6ab25809f5792565b4f57b85 input sum -0 output sum -5000000000 fee calc - 0 fee -null size - 108 *OBS. I would like, if is possible, a solution to work only with BITCOINJ, without using the API of the existing explorer.* -- 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.
