Open qui8t opened 1 month ago
Use Script.FromHex
for parsing a hex string, new Script(str)
treats str
as an asm.
Do you mean the following? if so, it returns null
address.
var script = Script.FromHex(hex);
var address = script.GetDestinationAddress(Network.Main);
It is because this is P2PK script pubkey, and p2pk does not have an defined address format. Reading your comment from previous issue, https://github.com/MetacoSA/NBitcoin/issues/1219#issuecomment-2224407074 you must either do the following depending on your goal.
I don't know your goal, so I cannot give any advice more than this.
Thanks! Is option 3
the approach implemented by the chain explorers similar to the one I linked above?
Is option 3 the approach implemented by the chain explorers similar to the one I linked above?
Yes, I suppose.
Any thoughts how I can do that with NBitcoin?
Thanks! Have you tried the method in the link you suggested on the specific output I mentioned above? I tried, and still I get zero destination public keys, and not sure how I can get the same address as the online explorers for that specific output.
I am trying to get the destination address of txout
n=1
in the following TX.Using the following code:
I get:
However, the online explorers, such as this, return the following address for this transaction.