Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inputs and Outputs are null or "" #591

Open
AndroDevcd opened this issue Oct 13, 2022 · 8 comments
Open

Inputs and Outputs are null or "" #591

AndroDevcd opened this issue Oct 13, 2022 · 8 comments

Comments

@AndroDevcd
Copy link

AndroDevcd commented Oct 13, 2022

When calling the following:

localWallet!!.walletKit!!.transactions(type = null).subscribe { txList: List<TransactionInfo> ->
     _transactions.postValue(txList)
}.let {
    disposables.add(it)
}

The transactions that are returned have the correct data but it is a toss-up on wether or not they have an address within the transaction inputs or outputs. I have noticed that when a transaction message comes through the address field is "" after it is processed. Where in the code and how are we populating the addresses from a given transaction?

@AndroDevcd
Copy link
Author

@abdrasulov Would this be an easy fix?

@AndroDevcd
Copy link
Author

AndroDevcd commented Oct 13, 2022

It also appears that TransactionSerializer.serialize() is not working properly which may lead to the issue stated above. I have tested trying to deserialize transactions using raw hex returned from the network and it did not return a transaction where the txid != transaction.hash, my understanding is that the transaction id from the network should match the generated hash from the received transaction.

I have also tested the Test directory with tests testing the library and deserializing transactions and the expected tx hash was incorrect and failed the test. I think this may be the culprit or at the very least a good starting point.

@AndroDevcd
Copy link
Author

Okay nevermind the TransactionSerializer not working i didn't realize the toReversedHex() function was needed to view the human-readable hex value. However the problem still remains of the input and out put addresses being null or ""

@AndroDevcd
Copy link
Author

It actually looks like after further digging that fun extract(transaction: FullTransaction) { .. } may be the reason we have weirdness with addresses.

Is there a reason we only assign addresses and update the transaction if it is "Our" transaction? This seems like an easy thing to spot by the user hat incoming transactions will have a blank received from address.

@esen
Copy link
Member

esen commented Oct 13, 2022

Hey @AndroDevcd ,

Not all the inputs and outputs may be filled with address field. Sometimes it's impossible. For example, if the input being sent is not in our storage, then we don't try to obtain it from the node. So we try to derive it from the input's signatureScript. For some input/output types like P2PKH or P2WPKHSH it's possible. For others it's not.

The reason why we extract addresses only for isMine transactions is that if it's not isMine, then it means it doesn't have any inputs or outputs concerning my wallet. So we just ignore it.

@AndroDevcd
Copy link
Author

Ahh okay, so then that basically means there's no way to know where the sender's bitcoin address was? I just wanted to be able to show on my app the address that the inbound sats came from but it sounds like this wouldn't be possible?

@esen
Copy link
Member

esen commented Oct 14, 2022

Yes. For some (I’d say the most) inputs it’s impossible

@AndroDevcd
Copy link
Author

Okay sounds good, also @esen I will be submitting some PR's today for your wallet kit and bitcoin kit libraries that I think adds some nice touches and bug fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants