Closed pnowosie closed 5 years ago
I love this, some question before we go further:
transaction
to transactionItem
Yeah - sorry it's a little hard to think of it from git-diff.
So Transaction
is there as well and contains mostly the same data but nicely structured.
TransactionItem
is a new structure for items of the list of transactions (e.g.: /transactions?address=
) and is limited to most important data.
I understand that you want to reduce the amount of data returned for each transaction in the list, but I wonder if the reduced data is useful at all?
I can think of 2 reasons you would want to get a list of txs for an account: a BlockExplorer and a Wallet. In both cases you would want to show the value (and currency) of the tx, and whether it's incoming or outgoing e.g. 0x742d35cc6634c0532925a3b844bc454e4438f44e
It's a lot of traffic if the client has to make separate call for each transaction to get the missing details...
You could try to calculate the value in the watcher and add that to TransactionItem. But I'd be inclined to just send the entire Transaction and let the client do it.
I can agree to the point that whether transaction list is filtered by particular account address, at least direction currency and amount of value (sent/received) by address is the interesting part. However in more general case with n-inputs and k-outputs this is probably a waste of throughput as we couldn't present these data on the list.
Ok, so if the address is passed in, then the server can calculate value
, currency
and direction
and include them in the returned data. value
is the amount sent or received by the address.
If the address isn't passed in then direction
is meaningless, and value
is the sum of all the outputs.
Note that value
is slightly different in each case...
Yeah, what adds even more complexity here is there could be different currencies used in the inputs & outputs - so summing them up isn't possible...
Closing as API specification already defines data for the Watcher endpoints
I'd like to start a discussion to redefine data WatcherAPI returns to make it align better for new database structure.
Proposed changes
Block
definitionTransaction
definition for 4in/4out and reuse other definitionsTransactionItem
- list of transaction items with less dataUtxo
definition - addedowner
and removedtxbytes
You can take a look at swagger definition changes in commit or review it in SwaggerUI