jellyfishsdk icon indicating copy to clipboard operation
jellyfishsdk copied to clipboard

Efficiently get addressFrom from the transaction list

Open sandrich opened this issue 3 years ago • 5 comments

Hi

I was wondering what an efficient way is to get the fromAddress from the transaction list?

ie. from endpoint https://ocean.defichain.com/v0/testnet/address/tf1q74jn0ddazjlw6nmra4a40fcquqhrqhlf92egd8/transactions

As of now I have to go through each transaction and load the vin? Then from there translate the address from script hex? Seems very inefficient if I have to do that for lots of transactions.

I see here that hid is a hashed verison that contains addressFrom. But not sure this can be extracted.

https://github.com/JellyfishSDK/jellyfish/blob/c6a5a4fc1020f4032b06f8a6c785a1f9f704f85b/apps/whale-api/src/module.api/address.controller.ts#L214

Any help is appreciated

sandrich avatar Sep 19 '22 19:09 sandrich

@sandrich: Thanks for opening an issue, it is currently awaiting triage.

The triage/accepted label can be added by foundation members by writing /triage accepted in a comment.

Details

I am a bot created to help the JellyfishSDK developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

jellyfishsdk-bot avatar Sep 19 '22 19:09 jellyfishsdk-bot

@sandrich: There are no 'area' labels on this issue. Adding an appropriate label will greatly expedite the process for us. You can add as many area as you see fit. If you are unsure what to do you can ignore this!

You can add area labels by leaving a /area comment.

Details

I am a bot created to help the JellyfishSDK developers manage community feedback and contributions. You can check out my manifest file to understand my behavior and what I can do. If you want to use this for your project, you can check out the BirthdayResearch/oss-governance-bot repository.

jellyfishsdk-bot avatar Sep 19 '22 19:09 jellyfishsdk-bot

/area packages

Hey, I'm assuming the data type is encoded as Script Hex?

You can use this package to parse and decode/encode them https://github.com/JellyfishSDK/jellyfish/tree/main/packages/jellyfish-address

fuxingloh avatar Sep 21 '22 04:09 fuxingloh

Thanks this I know. The problem is that v0/testnet/address/xxx/transactions does not include the sender address which means I have to do a second request to v0/testnet/transaction/xxx/vins and I was wondering if I can prevent that and capture a utxo transaction including its sender address in one API call?

sandrich avatar Sep 21 '22 09:09 sandrich

Thanks this I know. The problem is that v0/testnet/address/xxx/transactions does not include the sender address which means I have to do a second request to v0/testnet/transaction/xxx/vins and I was wondering if I can prevent that and capture a utxo transaction including its sender address in one API call?

I am exploring the API and not very familiar with it. But I think your idea is good as it compile more useful data in 1 request. However, I can't figure out how you get address from v0/testnet/transaction/xxx/vins. I try also v0/testnet/transactions/tttt/vouts but not geting address either. Any suggestion ?

arnaudom avatar Oct 10 '22 10:10 arnaudom