1

I'm using bitcoind. Now I would like to access the transactions list of a particular account using the bitcoin-cli.

I am using the listtransactions accountname command to get the transactions of a particular account.

Example:

listtransactions karthiktest

Result:

[
  {
    "account": "karthiktest",
    "address": "mnXEfvmLFWz7Exn9oGaEeTN8Ayu7Le5CCz",
    "category": "receive",
    "amount": 0.30000000,
    "label": "karthiktest",
    "vout": 1,
    "confirmations": 18,
    "blockhash": "000000009d17b7b32567f9730b50f2b7e8623ae6c9d20f84d4c414914e214283",
    "blockindex": 86,
    "blocktime": 1507963431,
    "txid": "c94307bef9ece4afe41384e2cd453f183aa7a438899723906e8967e624bc7d6f",
    "walletconflicts": [
    ],
    "time": 1507962288,
    "timereceived": 1507962288,
    "bip125-replaceable": "no",
    "comment": "hello karthik",
    "to": "from arun"
  }, 
  {
    "account": "karthiktest",
    "address": "miDMgiqduYevZMsRxX4qrY9BD5eXYFmEzg",
    "category": "send",
    "amount": -0.10000000,
    "label": "mahesh123",
    "vout": 0,
    "fee": -0.00000765,
    "confirmations": 17,
    "blockhash": "0000000079c79a5d21af138c80544b307d4ac764b4ed343b84752114c77fc893",
    "blockindex": 76,
    "blocktime": 1507964632,
    "txid": "516c64595c8b7be12419199dd81ae5edd3f4281aa3e52f88c7e3561b901bf881",
    "walletconflicts": [
    ],
    "time": 1507964172,
    "timereceived": 1507964172,
    "bip125-replaceable": "no",
    "comment": "hello mahesh",
    "to": "from karthik",
    "abandoned": false
  }
]

Here in the JSON, it is showing two transactions 1 receive and 1 send.

Now, My requirement is: for receive transaction, I need to get the sender address and for send transaction, I need to get the receiver address(this can be done using the account field). But I'm confused to get it with receive transaction.

Can anyone help me on this?

1 Answer 1

1

Bitcoin does not have "sender addresses". It has transactions, which spend coins you have authority to spend from, and creates new coins with potentially different owners.

Listing the previous owners of coins as senders is a practice used by some block explorer websites, but is at best uninteresting and at worst may result in monetary loss:

  • Not every script has a corresponding address.
  • The previous owner is not necessarily the sender (e.g. in the case of a service with multiple users, the addresses belong to the service, not the users).
  • You can't use these to refund coins (a property that is usually expected of a "sender address"), as in the case of a shared account, the address may be associated with a different user of the service.
  • Widely deployed privacy improvement techniques like CoinJoin result in transactions where only one of the transaction's inputs is related to the sender you care about, with no way to identify which.

So what listtransactions shows you are always receive addresses:

  • For a send entry, it lists the address the money was sent to.
  • For a receive entry, it lists the address the money was received on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.