Hi,

When I look at the block explorer for block #1 
https://blockexplorer.com/block/00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048

it shows that 50 BTC was credited to 
address 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX.

In the code, I tried to use both getAddressFromP2PKHScript() and 
getAddressFromP2SH() but they all return null.

Below is the code snippet:

List<Transaction> transactions = block.getTransactions();

for (Transaction t: transactions) {
  List<TransactionOutput> outputs = t.getOutputs();
  for (TransactionOutput output: outputs) {
    Address address = output.getAddressFromP2PKHScript(MainNetParams.get());
    address = output.getAddressFromP2SH(MainNetParams.get());
  }
}

How could I get the address as in blockexplorer?

Thanks

-- 
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 bitcoinj+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to