We are trying to figure out how to identify the sender (source address) of a given transaction retrieved using cardano-wallet
.
Here is an example datastructure from the api. Be aware the field values are randomized (not real):
{
inserted_at: {
height: { quantity: 4263, unit: "block" },
time: "2021-11-21T18:00:39Z",
epoch_number: 190,
absolute_slot_number: 4323,
slot_number: 132423,
},
status: "in_ledger",
withdrawals: [],
amount: { quantity: 2000000, unit: "lovelace" },
inputs: [
{
id: "80b4ab2773da9bccdb62d8bbf22f339bf041f0ff082f34acc6614f6a759e58e",
index: 0,
},
],
direction: "incoming",
fee: { quantity: 0, unit: "lovelace" },
outputs: [
{
amount: { quantity: 2000000, unit: "lovelace" },
address:
"addr_test1qzwtzc4vrase42ytaj8nqam6z4322x5dx08gj2gxtjqy05wl5feqsw9lgy9askcyzjemw4d8x94n25nq204j6kqfpmhsn64us7",
assets: [],
},
{
amount: { quantity: 56, unit: "lovelace" },
address: "addr_test1vqd00tpc537seq9hy64pupcu7s88x5w9jdln4lqyfees3swgmk",
assets: [],
},
],
metadata: None,
depth: { quantity: 370, unit: "block" },
id: "d6c29eb3a8865b1e79d5cf2beb4d04b6685145a2c73d910d70e8f80080384",
deposit: { quantity: 0, unit: "lovelace" },
collateral: [],
mint: [],
};
Now, the source address is listed in one of the outputs, since the transaction must send the remainder of the balance to it. However, this isn't a great way to identify the source address because it might not be there if there is no remainder, or there may be 3 or more outputs.
I expected the inputs
to contain the address, but it just has an id.
I see no other mentions of the source address. How does one figure out who sent a transaction?