How to calculate bakingRewards from tx_logging db entry?

Please have a look at the output of the wallet-proxy API for a baker (json). For a [‘details’][‘type’] == bakingReward ‘transaction’, there is a ‘total’ field defined. This is the baking Reward for this particular baker for baking this block.

When we request transactions from the tx_logging db, we get the following output (for one of the bakingRewards):

'{"Right": {"tag": "BakingRewards", 
"remainder": "134", 
"bakerRewards": [
{"amount": "284426592", "address": "35AGYQC9ArExG1XsQtYrRgzNAMAeq9WN1mH7X2f7q5m7FmfZqx"}, 
{"amount": "284426592", "address": "37S5Q3bDDaZr278vwK4Z1T9rbMoNSVFPjkos48W9Kz3kGJAiNg"}, 
{"amount": "568853184", "address": "38DmwVuAwtCpscipaKGgAY1fs1huZS66LNqgyiMPTNk1NrgTzN"}, 
{"amount": "1422132960", "address": "3B85HEnBzjFcLm2ZN6Ggb9ig7CWT4vsBXM9j46v8o94stmzv9L"}, 
{"amount": "10808210496", "address": "3CbvrNVpcHpL7tyT2mhXxQwNWHiPNYEJRgp3CMgEcMyXivms6B"}, 
{"amount": "568853184", "address": "3DLD6CpYYa41FmvYdjxTKBhgkM63NtHZGBjBPZgzgSArm1sueS"}, 
{"amount": "6257385024", "address": "3EctbG8WaQkTqZb1NTJPAFnqmuhvW62pQbywvqb9VeyqaFZdzN"}, 
{"amount": "284426592", "address": "3Q6auaCXY27S9cw7wWxnL9NLRKeZ98BuhxNSwogkHEbApxt18C"}, 
{"amount": "284426592", "address": "3TaiWkXL3MwhaqcdKwqmM9s7Fq8xMynArjJDwUrrUPnFejxMzk"}, 
{"amount": "568853184", "address": "3USgJaoLTTtLF7o23qjPP2Tuis3X6PTwCTbkCNd8B3nTvtVoSW"}, 
{"amount": "9954930720", "address": "3XSLuJcXg6xEua6iBPnWacc3iWh93yEDMCqX8FbE3RDSbEnT9P"}, 
{"amount": "2275412736", "address": "3Xhdwp4Y2dXTTKaCs1G4QNy7vtUtmZDRzwtex1hSqw2ekUK7ZE"}, 
{"amount": "1422132960", "address": "3bYDf2e6ijKCSctqkdLDTuwJ41zpZXrVyHu8ErJ75VBH4h24yR"},
{"amount": "853279776", "address": "3d4tsSiBrJXn2aiNHdfqMq2b9oGttoKn2LDCZbHHMm1WZi2c95"}, 
{"amount": "1137706368", "address": "3eUA4NnWufEqTBXR2QtTwjPxHZRGZvoqHaVjybmzZSqbuG32vJ"}, 
{"amount": "284426592", "address": "3mjMA3xo3hnKfMHi4Mt9GKf8F5oZhNZoer4HpSySShipEkAsT3"}, 
{"amount": "568853184", "address": "3nHTHHrit4wNgCRFkdvfFnLTL6AhViUE143eR7a6pMfWiazGKZ"}, 
{"amount": "1137706368", "address": "3nxFD3fqtUG6YGAPbg2zBGa81Pt1SvNNTDjvvVakjvHVYw1biN"}, 
{"amount": "284426592", "address": "3oTmYTDG683bJvhMBCZd29SPcwpPsKmF8wc7XDL9zrsqpXC7mq"}, 
{"amount": "9954930720", "address": "3ofwYFAkgV59BsHqzmiWyRmmKRB5ZzrPfbmx5nup24cE53jNX5"}, 
{"amount": "284426592", "address": "3rhr56fc7eawshcPX16PSicQKnQaj8xp4n9x4iEkK3GMVJa7Sj"}, 
{"amount": "853279776", "address": "3taQTr2vfAQmaKgStN6qWBwqAYpjCJatcugY7NK8SHQvUscCA8"}, 
{"amount": "284426592", "address": "42MHeV4QcNVtidnUdDPdM2LedPb2QLKa7k1MQCXiRRPAZK3NtX"}, 
{"amount": "284426592", "address": "43sPTsozscn3d2RbxHiaWy6Pp23KthNeNV6LKBhrco5SqoB3YW"}, 
{"amount": "7110664800", "address": "44bxoGippBqpgseaiYPFnYgi5J5q58bQKfpQFeGbY9DHmDPD78"}, 
{"amount": "2275412736", "address": "47uKy77Ds7AEsTd7AAnyeesWL5wAyraVvafPEfhFw9dveuGym6"}, 
{"amount": "11661490272", "address": "47xTHwtFra1d4Mq4DYZuZYJEYrDXY34C4CGkTTzT6eiwjEczuT"}, 
{"amount": "568853184", "address": "494XRkeP9mRHAe7o4bHWm5MEazuyJh9iZ2Nsn14bC1seNZ8yKR"}, 
{"amount": "5119678656", "address": "49SJ6R6T9zo1C5cLVyxbwAuZC3EcDB9a78vSQYm3ZLA2y2eojM"},
{"amount": "284426592", "address": "4CeYuqont4zhTEbaofUPT9EueDGvrhnSf3XSTEKzanchdLC3pN"}, 
{"amount": "568853184", "address": "4D1xtS8ztmxvuHy3ddiVQDnv96nwDRBj5bgWZx9uixMppgndzv"}, 
{"amount": "568853184", "address": "4D44RYigFqPkABrRAHXSBBQqG4VNhXEsyJrt2GH6V2H8tS1tN3"},
{"amount": "284426592", "address": "4K131fvpEYQmT6cp67ZZEquRPfuUKdkAnpmtMwEAeAJ6qmtvFC"}, 
{"amount": "9101650944", "address": "4MPJybKC9Kz7kw9KNyLHhuAEt4ZTxLsd3DBDbxtKdUiv4fXqVN"}, 
{"amount": "284426592", "address": "4Ras4xAx3zSo3gBC3ktzNSz81D51ugQbUurMYPAEj1se51ARLj"}, 
{"amount": "284426592", "address": "4V8QA1Cekwta3RJrXxuGyqPxEuBp4r2ws9xpiVevXbhP2hhNcC"}, 
{"amount": "284426592", "address": "4a1weEUcaPka7ZPBEyZ6AndcdaxwKkUahZoABKYNWSYZ6eFtFT"}, 
{"amount": "284426592", "address": "4bEqdbhvMbcktqhQsiuaRA46ZEe7o8PNTuGj5KhwYhStcgbGde"}, 
{"amount": "8532797760", "address": "4d13WVDNKVGDUxRUb1PRQAJyTwWSVcjWS7uwZ1oqmDm5icQEPT"}, 
{"amount": "284426592", "address": "4h8GXzDYjXwkPfFibHVUTxEP4rKwUB35M9ffA8pyrqZi7uHZTy"}, 
{"amount": "1422132960", "address": "4qL7HmpqdKpYufCV7EvL1WnHVowy1CrTQS7jfYgef5stzpftwS"}, 

{"amount": "284426592", "address": "4sY2m6R4hu5V5mGLF4DUv51YoNfLM9LGXDwePu9ypvfqbeUzMx"}]}}'

Note that there is no ‘total’ field, unfortunately.
What is the correct way (if possible at all) to re-calculate the ‘total’ field from this list of bakerRewards?

The BakingRewards event lists the amount sent to each rewarded account. (That is to say, it’s a single event in which multiple accounts are credited.) When you query transactions for a specific account, the wallet proxy extracts the amount for the requested account and shows that as the total in its response.

That was much easier than expected, thanks!