Skip to content

iiinnniii/cardano-csv-generator

Repository files navigation

Cardano CSV Generator

This program generates a .csv file containing all Cardano transaction data for a specific wallet. Simply provide the transaction hashes of all transactions of your wallet and a list of addresses associated with your wallet (or at least the addresses that have been used so far), as described below. The generated .csv file provides a structured overview of your transaction history, making it easier to analyze your activity and handle tax reporting.

Output example:

Example CSV

This is the raw CSV file content of the example output mentioned above:

Id,Transaction ID,Date (UTC),Amount (ADA),Net amount sent (ADA),Balance (ADA),Fee (ADA),Inputs,Outputs,Spent staking rewards,Stake key registration cost (ADA),Stake key deregistration refund (ADA),Description
9,035bb8856ccac49187ef1bb8ee28c0ca9d613e6020d36c858c8f478e957ea211,2024-03-01 12:30:37,-92.217689,-92.04,1.965999,0.177689,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 4.856782 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 86.858719 ADA","addr1q96ymlkgx6sa3y9y7tr33x4wqwzgvjp8wzvavstsymg95mlrzr27g03klu862usxqsru794d03gzkk8n86ta34n85z0s4g33r8: 92.040000 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1.965999 ADA",stake1u94esxj0zjp85wh5g6a2vlf6wuln5fpyelwcjm4tahd0ssq9ge8um: 2.468187 ADA,,,
8,4f068599544228666e28d1ac7270a6c4ee31026e53f80595b7d92192636cf769,2024-03-01 12:29:43,+4.856782,,91.715501,,Multiple Inputs,addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 4.856782 ADA,,,,
7,ce3670ce6645bd1af162d8828d83979a4b4bf19e693c9ded625d530fc8509615,2024-03-01 12:29:29,-2.85435,-2.65,86.858719,0.204350,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1.896510 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1000000 MILKv2,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 87.816559 ADA","addr1zyq0kyrml023kwjk8zr86d5gaxrt5w8lxnah8r6m6s4jp4g3r6dxnzml343sx8jweqn4vn3fz2kj8kgu9czghx0jrsyqqktyhv: 2.650000 ADA,
addr1zyq0kyrml023kwjk8zr86d5gaxrt5w8lxnah8r6m6s4jp4g3r6dxnzml343sx8jweqn4vn3fz2kj8kgu9czghx0jrsyqqktyhv: 1000000 MILKv2,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 86.858719 ADA",,,,
6,b1867d13d0b8f56af444559e47558868ea1bf7e67f90ad4fccb6133b08fa5ac2,2024-03-01 12:28:30,+1.89651,,89.713069,,Multiple Inputs,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1.896510 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1000000 MILKv2",,,,
5,b2adcc5344912d0f8714c8e408f07426df94997aa8409c4a0ffc9750ae0cb7c9,2024-03-01 12:26:54,-2.857078,-2.65,87.816559,0.207078,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 88.973637 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1.700000 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1 MILK","addr1zyq0kyrml023kwjk8zr86d5gaxrt5w8lxnah8r6m6s4jp4g3r6dxnzml343sx8jweqn4vn3fz2kj8kgu9czghx0jrsyqqktyhv: 2.650000 ADA,
addr1zyq0kyrml023kwjk8zr86d5gaxrt5w8lxnah8r6m6s4jp4g3r6dxnzml343sx8jweqn4vn3fz2kj8kgu9czghx0jrsyqqktyhv: 1 MILK,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 87.816559 ADA",,,,
4,c281e4f538e34a68a867d59bebd39c903fc3fa30cf961e277ce59a63b00dcf24,2023-05-09 03:30:42,+1.7,,90.673637,,Multiple Inputs,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1.700000 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 1 MILK",,,,
3,5511879700cc654498439a547ef3a98b156efc88806ed292bc44a2d56f21bcf7,2023-05-09 03:29:48,-6.852062,-6.65,88.973637,0.202062,"addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 89.825699 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 6.000000 ADA","addr1zyq0kyrml023kwjk8zr86d5gaxrt5w8lxnah8r6m6s4jp4g3r6dxnzml343sx8jweqn4vn3fz2kj8kgu9czghx0jrsyqqktyhv: 6.650000 ADA,
addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 88.973637 ADA",,,,
2,726c8c2163f5a1291f7c23fe781c49dab8ad51daa5dd75ec21c32499fbb815a5,2023-04-13 21:47:18,-2.174301,-2,95.825699,0.174301,addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 92.000000 ADA,addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 89.825699 ADA,,2,,
1,e66aced683d91f1240a60188fdbe011451cc0c7d973a3674a70848a9a125dd13,2023-04-13 21:46:21,+92,,98,,Input,addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 92.000000 ADA,,,,
0,a70c825c5e94e2065cc77126cef4bb324d139d8d88b523ce461791a8d74080c3,2023-04-13 21:42:13,+6,,6,,Input,addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm: 6.000000 ADA,,,,

In order to get the addresses of your Daedalus wallet go to the transactions tab and press the "Export CSV" button.

If you're using a different wallet, the process may vary, but you can usually find a similar option in the wallet's console or interface. If not, manually copying and pasting the addresses might be the best option.

Note: CSV files for Byron Legacy wallets and Shelley wallets must be exported separately from your wallet (e.g., Daedalus). Exporting the CSV from a Shelley wallet in Daedalus does not include the transaction history of its associated Byron wallet. If you want a complete history, you must export the CSV for each wallet type individually.

IMPORTANT: The CSV files generated by this program, must be created separately for Byron Legacy wallets and Shelley wallets. For Byron Legacy wallets, do not define Shelley addresses in data/addresses.txt, and vice versa.

Next, replace the contents of data/addresses.txt with your addresses, ensuring you use the same format as shown in this example:

addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm
stake1u94esxj0zjp85wh5g6a2vlf6wuln5fpyelwcjm4tahd0ssq9ge8um

IMPORTANT: As can be seen in the example addresses above it is also important to add the Stake Key in addition to your addresses (addr1....).

In order to get the transaction hashes of your Daedalus wallet go to the transactions tab and press the "Export CSV" button.

If you're using a different wallet, the process may vary, but you can usually find a similar option in the wallet's console or interface. If not, manually copying and pasting the transaction hashes might be the best option.

IMPORTANT: The CSV files generated by this program, must be created separately for Byron Legacy wallets and Shelley wallets. For Byron Legacy wallets, do not define transaction hashes from Shelley transactions in data/transaction-ids.txt, and vice versa.

Next, replace the contents of data/transaction-ids.txt with your transaction hashes, ensuring you use the same format as shown in this example:

035bb8856ccac49187ef1bb8ee28c0ca9d613e6020d36c858c8f478e957ea211
4f068599544228666e28d1ac7270a6c4ee31026e53f80595b7d92192636cf769
ce3670ce6645bd1af162d8828d83979a4b4bf19e693c9ded625d530fc8509615
b1867d13d0b8f56af444559e47558868ea1bf7e67f90ad4fccb6133b08fa5ac2
b2adcc5344912d0f8714c8e408f07426df94997aa8409c4a0ffc9750ae0cb7c9
c281e4f538e34a68a867d59bebd39c903fc3fa30cf961e277ce59a63b00dcf24
5511879700cc654498439a547ef3a98b156efc88806ed292bc44a2d56f21bcf7
726c8c2163f5a1291f7c23fe781c49dab8ad51daa5dd75ec21c32499fbb815a5
e66aced683d91f1240a60188fdbe011451cc0c7d973a3674a70848a9a125dd13
a70c825c5e94e2065cc77126cef4bb324d139d8d88b523ce461791a8d74080c3

Important: It is essential to place the transaction hashes of the newest transactions first and the oldest last. For example, 035bb8856ccac49187ef1bb8ee28c0ca9d613e6020d36c858c8f478e957ea211 is the newest transaction, while a70c825c5e94e2065cc77126cef4bb324d139d8d88b523ce461791a8d74080c3 is the oldest.

Only relevant data will be displayed in the input and output columns. Below is a detailed explanation of the mechanics:

  • If none of your addresses are present in a transaction's inputs, the input field will display "Multiple Inputs" or simply "Input". Otherwise, it will show only the inputs associated with your addresses.

  • If none of your addresses are present in a transaction's inputs, the output field will display only the outputs related to your addresses. However, if your addresses are included in the inputs, all outputs will be shown.

To avoid overwhelming the API with requests, a very conservative sleep interval of 1 second between requests has been implemented. This helps to ensure smooth operation without hitting rate limits.

If you have many transactions to process, you can decrease the sleep interval to speed up the process. However, keep in mind that reducing the sleep time too much could result in exceeding the rate limit of the API, potentially causing errors.

This program uses the Cardanoscan API to fetch transaction details, therefore you must obtain a free API key from Cardanoscan.

  1. Visit: https://console.cardanoscan.io/#/apikeys

  2. Log in or create an account.

  3. Generate a new API key.

  4. Paste only your API key into data/API_KEY.txt (no extra spaces or newlines).

There are generally two ways to execute this program.

You can use Docker (the recommended approach) by installing Docker Desktop and running the following commands in the root directory of this project:

docker build --target production -t cardano-csv-generator .
docker run -it -v $(pwd)/output:/usr/src/app/output cardano-csv-generator

Alternatively, you can install Node.js and pnpm on your system, then run the following commands:

pnpm install
pnpm start

In both cases, the generated .csv file will be located at output/transactions.csv.

If this program saved you a ton of time, please consider donating. Your contribution would mean a lot to me, I'd appriciate it so much.

You can support me through the following donation addresses:

Cardano (ADA):

addr1q9lcymwvwxny2m5tp7vah9lqcl3qwzznz2zgtfzl4wam8hntnqdy79yz0ga0g3465e7n5ael8gjzfn7a39h2hmw6lpqq4fekrm

Cardano QR Code

Bitcoin (BTC):

1CYACQBKztsZha8Ea3ze9CmjZYfGRHMTox

Bitcoin QR Code

Thank you so much.

About

This program generates a CSV file with the complete transaction history of a specified Cardano wallet.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published