0

Is there an easy way, without writing code, to export a CSV file of all transactions from a specific address or wallet? (not Daedalus)

1

2 Answers 2

0

Address or wallet?

The distinction is important for UTXO chains following the BIP-44 standard, because a single extended public key (wallet key) can generate a virtually infinite number of addresses. Are you looking to query a single one of these addresses, or all of the addresses associated with a single wallet?

In the case of the former, I am unaware of any easy third party solution for TX export by individual addresses. If there are none, the only option would be to query from an API endpoint like Blockfrost, or to query from your own db-sync instance.

In the case of the latter however, light wallets (like Eternl) have easy export options for the entire wallet history. You do not have to fully restore your wallet to access these features. You can instead import your wallet as read-only (requiring only the extended public key of the wallet, no signing keys), and export TX history in CSV format.

0

There are two ways of doing this. One is with cardano-db-sync as mentioned in @zhekson's response.

The other way is by querying the cardano-wallet executable (bundled with Daedalus) as per the documentation at https://input-output-hk.github.io/cardano-wallet/api/edge/

I have a script like this:

#!/bin/bash -eu

# https://input-output-hk.github.io/cardano-wallet/api/edge/

progname=$(basename "$0")

curl --version > /dev/null 2>&1 || { echo "${progname}: 'curl' program is missing." >&2 ; exit 1 ; }
jq --version > /dev/null 2>&1 || { echo "${progname}: 'jq' program is missing." >&2 ; exit 1 ; }

wallet_pid=$(pidof cardano-wallet)
http_port=$(lsof -Pan -iTCP -sTCP:LISTEN -p "${wallet_pid}" | tail -1 | sed 's/.*://;s/ .*//')


function api () {
  curl --silent --cert ~/.local/share/Daedalus/mainnet/tls/client/client.crt \
    --cacert ~/.local/share/Daedalus/mainnet/tls/client/ca.crt \
    --key ~/.local/share/Daedalus/mainnet/tls/client/client.key \
    "https://localhost:${http_port}/v2/$1"
}

function wallets () {
  api wallets | jq '.[] | {name: .name, id: .id, state:.state.status, pool:.delegation.active.target, balance: (.balance.total.quantity / 1000000) }'
}

function transactions () {
  echo "TransactionId,Timestamp,Direction,AmountAda"
  api "wallets/$1/transactions" \
    | jq -r '.[] | [.id, .inserted_at.time, .direction, .amount.quantity / 1000000] | @csv' \
    | sort --field-separator=',' --key 2
}

function usage_exit {
  echo
  echo "Usage:"
  echo "  $progname wallets                   - List the known wallets."
  echo "  $progname transactions <wallet>     - List all transactions for a given wallet."
  echo
  exit 0
}

case "${1:-""}" in
  wallets)
    wallets
    ;;
  transactions)
    shift
    if test $# -eq 1 ; then
      transactions "$1"
    else
      echo
      echo "Error: A wallet needs to be specified."
      usage_exit
      fi
    ;;
  *)
    usage_exit
  esac

Your Answer

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

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