Thank you for that, I was looking for those the other day! It still doesn’t seem to help me though. I’ve created a very specific scenario so hopefully it is clear what I’m asking.
TL;DR: I expected to be able to export transactions, sum them up and come up with a balance that matches the wallet UI. How do I do this?
I created a brand new wallet and made 3 transactions:
- Received 0.1234 XCH from another wallet. No fee.
- Sent 0.01 XCH to myself (this new wallet). Included fee of 0.000053709309.
- Sent 0.01 XCH back to the original sending wallet. Included fee of 0.000053709309.
The problem I’m having is that second transaction - I see the “debit” transaction but not the incoming “credit” transaction (since it is just making change). I would actually expect there to be 4 transactions total for this:
- Received 0.1234.
- Sent 0.1 to myself.
- Received 0.1 from myself.
- Sent 0.1 to another wallet.
So is my thinking wrong about using transactions for this and maybe I should be looking at “additions/removals” arrays? I tried various calculations with those too and couldn’t make it work.
I’ve noticed the wallet UI itself kind of has this same problem (note if you added these numbers up, it wouldn’t match UI balance either):
And finally here is the full JSON for these transactions:
{
"success": true,
"transactions": [
{
"additions": [
{
"amount": 123400000000,
"parent_coin_info": "0x2c41432886...2d25d1649",
"puzzle_hash": "0xc1a864cc...d3dd6facc"
}
],
"amount": 123400000000,
"confirmed": true,
"confirmed_at_height": 1599990,
"created_at_time": 1649999152,
"fee_amount": 0,
"memos": {},
"name": "0xe077751de9f0c25741412...b320ece25",
"removals": [],
"sent": 0,
"sent_to": [],
"spend_bundle": null,
"to_address": "xch1cx5xfnrh7pmze...wkltxqhzhzfc",
"to_puzzle_hash": "0xc1a864cc77f0762c8d6...ec749d477d3dd6facc",
"trade_id": null,
"type": 0,
"wallet_id": 1
},
{
"additions": [
{
"amount": 10000000000,
"parent_coin_info": "0x3542ab5c5e5efedb27...28ec5e91eca0",
"puzzle_hash": "0xc1a864cc77f0762c8d6b8a9d...77d3dd6facc"
},
{
"amount": 113346290691,
"parent_coin_info": "0x3542ab5c5e5efedb2...5e91eca0",
"puzzle_hash": "0x56de5dda6e7552d5215...08f6ea04df"
}
],
"amount": 10000000000,
"confirmed": true,
"confirmed_at_height": 1599995,
"created_at_time": 1649999238,
"fee_amount": 53709309,
"memos": {},
"name": "0x4a9cfd15f2e6c6e5593....7669d3ce40384b0",
"removals": [
{
"amount": 123400000000,
"parent_coin_info": "0x2c414328861355035489be...c219b8572d25d1649",
"puzzle_hash": "0xc1a864cc77f0762c8d6b8a9d...49d477d3dd6facc"
}
],
"sent": 1,
"sent_to": [
[
"5f439d406a12f5aa0eb42d...0a1f074a3bc8fe8",
3,
"DOUBLE_SPEND"
]
],
"spend_bundle": {
"aggregated_signature": "0xb1019cc5a0036e1bfe9f35a06ea81e...5256c",
"coin_spends": [
{
"coin": {
"amount": 123400000000,
"parent_coin_info": "0x2c414328861355...25d1649",
"puzzle_hash": "0xc1a864cc77f0762c8d6b...7d3dd6facc"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff...dff8080808080ffff01ff0bffff0101ff058080ff0180ff018080ffff04ffff01b0aded237f7d2ea020f11c89050f709315edef69661a566e9156f165e62c3f500ea05461c4ae309cc6827c18b9c61aeed3ff018080",
"solution": "0xff80ffff01ffff...b6ec27fbc29003a2758080ff8080"
}
]
},
"to_address": "xch1cx5xfnrh7p...ltxqhzhzfc",
"to_puzzle_hash": "0xc1a864cc77f0762c8d6b8...477d3dd6facc",
"trade_id": null,
"type": 1,
"wallet_id": 1
},
{
"additions": [
{
"amount": 10000000000,
"parent_coin_info": "0x009ceff6f68154f2...58b14c2f187e",
"puzzle_hash": "0x6795cebe1e5ad7ce...fc8f2cf73c8bf"
},
{
"amount": 103292581382,
"parent_coin_info": "0x009ceff6f68154f2110...4c2f187e",
"puzzle_hash": "0x01468af43ceefc8b92...85306ca406a7"
}
],
"amount": 10000000000,
"confirmed": true,
"confirmed_at_height": 1599995,
"created_at_time": 1649999620,
"fee_amount": 53709309,
"memos": {},
"name": "0xa9aa12f11230bb...17d21",
"removals": [
{
"amount": 113346290691,
"parent_coin_info": "0x3542ab5c5e5efed...ec5e91eca0",
"puzzle_hash": "0x56de5dda6e7552d52...2c0b08f6ea04df"
}
],
"sent": 1,
"sent_to": [
[
"5f439d406a12f5aa0eb4...74a3bc8fe8",
1,
null
]
],
"spend_bundle": {
"aggregated_signature": "0x824a8566128c13e...ed7ca4a935",
"coin_spends": [
{
"coin": {
"amount": 113346290691,
"parent_coin_info": "0x3542ab5c5e...8ec5e91eca0",
"puzzle_hash": "0x56de5dda6e7552d52...8f6ea04df"
},
"puzzle_reveal": "0xff02ffff01ff02ffff01ff02ffff03ff...7f4b787d805bac0ff151665d30f85a478dbc6e46e10ec19634fb6afd801ff018080",
"solution": "0xff80ffff01ffff33ffa06795cebe1e5...add0edeb7bb478080ff8080"
}
]
},
"to_address": "xch1v72ua0s7tttuu...vvhmq",
"to_puzzle_hash": "0x6795cebe1e5ad7c...f2cf73c8bf",
"trade_id": null,
"type": 1,
"wallet_id": 1
}
],
"wallet_id": 1
}