Ich versuche, eine Anwendung mit bitcoinj
Bibliothek zu entwickeln. Ich möchte die bitcoin transaction
Details erfahren.
Die Details, die ich aus a extrahieren möchte, transaction
umfassen Folgendes.
1) Wer schickt mir die transaction
( Address
und Public Key
des Absenders).
2) Der Betrag, den ich erhalten habe.
3) Wann wurde die transaction
ausgestellt.
4) Holen Sie sich die in der Transaktion gespeicherten Daten in OP_RETURN
.
vielleicht hilft das
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");
}
}
Murch