With the use of segwit, signature data is no longer part of transaction body and thus can’t be retrieved from block explorers. So is there a Bitcoin rpc method in order to get it directly without having to extract it from transaction manually?

My aim is to retrieve the public key behind segwit Bitcoin addresses from EC signature which requires the signature along signed data.


With the use of segwit, transaction data is no longer part of transaction body

That's incorrect. It's just not covered by the txid, but it's still an integral part of a transaction. Every updated full node will download the witness data, and if they're storing blocks, also remember the witness data.

and thus can’t be retrieved from block explorers.

That would only be the case of the block explorer doesn't support segwit.

For example, here is a recent segwit transaction (with witness data included) on blockstream.info.

So is there a Bitcoin rpc method in order to get it.

Sure, getrawtransaction will give it to you (it needs the txindex=1 config option, though).

  • I wanted to mean signature data of course. Not transaction data. Please see my last edit. Sep 15 '20 at 23:51
  • I assumed so; signature data is what my answer is about. Sep 15 '20 at 23:52
  • but getrawtransaction is for finding the signature manually. Something I don’t know how to do. I just want to perform pay to pubkey transactions wothout asking the pubkey to addresses and as far I understand, recovering the pubkey from EC signature is the only way to do that. Sep 16 '20 at 0:06
  • You're confused in multiple ways. 1) You don't need to recover public keys from the signature - they're directly revealed in the witness (scriptSig for non-segwit transactions, witness stack for segwit ones). 2) You'll need getrawtransaction regardless of what you want to learn about a transaction. 3) You absolutely shouldn't be trying to determine the "sender's public key" of a transaction and use it for anything but debugging. Multiple parties can collaborate to construct a transaction, and there is no way (intentionally) of telling who is who. If you need a pubkey, ask them. Sep 16 '20 at 0:11
  • this is for figuring the answer to this question bitcoin.stackexchange.com/q/98779 myself. About your concerned about who is who, this is of course about used adresses. Sep 16 '20 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.