<p>maybe this helps</p>

<pre><code>private void txHistory()
        {
            List&lt;Transaction&gt; txx = kit.wallet().getTransactionsByTime();
            if (!txx.isEmpty())
            {
                int i = 1;
                for (Transaction tx : txx)
                {
                    System.out.println(i + "  ________________________");
                    System.out.println("Date and Time: " + tx.getUpdateTime().toString());
                    System.out.println("From Address: " + tx.getOutput(1).getAddressFromP2PKHScript(params));
                    System.out.println("To Address: " + tx.getOutput(0).getAddressFromP2PKHScript(params));
                    System.out.println("Amount Sent to me: " + tx.getValueSentToMe(kit.wallet()).toFriendlyString());
                    System.out.println("Amount Sent from me: " + tx.getValueSentFromMe(kit.wallet()).toFriendlyString());
                    long fee = (tx.getInputSum().getValue() &gt; 0 ? tx.getInputSum().getValue() - tx.getOutputSum().getValue() : 0);
                    System.out.println("Fee: " + Coin.valueOf(fee).toFriendlyString());
                    System.out.println("Transaction Depth: " + tx.getConfidence().getDepthInBlocks());
                    System.out.println("Transaction Blocks: " + tx.getConfidence().toString());
                    System.out.println("Tx Hex: " + tx.getHashAsString());
                    System.out.println("Tx: " + tx.toString());
                    i++;
                }
            }
            else
            {

                System.err.println("No Transaction Found");
            }
        }
</code></pre>

CC BY-SA 4.0
2018-05-24T11:04:54.027Z
2018-05-24T11:04:54.027Z
Zombie
<p>I am trying to develop an application using <code>bitcoinj</code> library. I want to get the <code>bitcoin transaction</code> details.</p>

<p>The details, that I want to extract from a <code>transaction</code> includes the following. </p>

<p>1) Who send me the <code>transaction</code> (<code>Address</code> and <code>Public Key</code> of the sender).</p>

<p>2) The amount that I received.</p>

<p>3) When was the <code>transaction</code> issued.</p>

<p>4) Get the data stored in the transaction in <code>OP_RETURN</code>.</p>

CC BY-SA 3.0
2016-06-13T15:44:59.223Z
There is no single "sender" address in Bitcoin, a transaction may be funded from balances of multiple addresses.
Murch
<transactions><bitcoinj>
Get transaction details using bitcoinj library
jgm
# Get transaction details using bitcoinj library

(Asked by: username_0 on 2016-05-22)

I am trying to develop an application using `bitcoinj` library. I want to get the `bitcoin transaction` details.

The details, that I want to extract from a `transaction` includes the following.

1) Who send me the `transaction` (`Address` and `Public Key` of the sender).

2) The amount that I received.

3) When was the `transaction` issued.

4) Get the data stored in the transaction in `OP_RETURN`.

**Tags:** transactions, bitcoinj

> **Comments:**
> **username_1**: There is no single "sender" address in Bitcoin, a transaction may be funded from balances of multiple addresses.  

---

## 1 answers

### Answer by username_2 on 2018-05-24. Score: 2

maybe this helps

```
private void txHistory()
        {
            List<Transaction> txx = kit.wallet().getTransactionsByTime();
            if (!txx.isEmpty())
            {
                int i = 1;
                for (Transaction tx : txx)
                {
                    System.out.println(i + "  ________________________");
                    System.out.println("Date and Time: " + tx.getUpdateTime().toString());
                    System.out.println("From Address: " + tx.getOutput(1).getAddressFromP2PKHScript(params));
                    System.out.println("To Address: " + tx.getOutput(0).getAddressFromP2PKHScript(params));
                    System.out.println("Amount Sent to me: " + tx.getValueSentToMe(kit.wallet()).toFriendlyString());
                    System.out.println("Amount Sent from me: " + tx.getValueSentFromMe(kit.wallet()).toFriendlyString());
                    long fee = (tx.getInputSum().getValue() > 0 ? tx.getInputSum().getValue() - tx.getOutputSum().getValue() : 0);
                    System.out.println("Fee: " + Coin.valueOf(fee).toFriendlyString());
                    System.out.println("Transaction Depth: " + tx.getConfidence().getDepthInBlocks());
                    System.out.println("Transaction Blocks: " + tx.getConfidence().toString());
                    System.out.println("Tx Hex: " + tx.getHashAsString());
                    System.out.println("Tx: " + tx.toString());
                    i++;
                }
            }
            else
            {

                System.err.println("No Transaction Found");
            }
        }

```


---

