zencashjs icon indicating copy to clipboard operation
zencashjs copied to clipboard

How to convert deserialized script into address

Open 1029219814 opened this issue 1 year ago • 4 comments

About outs when eg using zencashjs.transaction.deserializeTx method. I can only get satoshis and script, I want to know how to get the real address through script

{ version: 1, locktime: 0, ins: [{ output: [Object], script: '', sequence: 'ffffffff', prevScriptPubKey: '' }], outs: [{ satoshis: 100000, script: '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac200206260143838b5ff52dc2eb7b4b8099d4e4c99dc3ef19794289a2cd4c10070000b4' }] }

example:How to get the corresponding address through 76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac200206260143838b5ff52dc2eb7b4b8099d4e4c99dc3ef19794289a2cd4c10070000b4

1029219814 avatar Jul 25 '23 11:07 1029219814

You can use: zen-cli decodescript '76a914da46f44467949ac9321b16402c32bbeede5e3e5f88ac200206260143838b5ff52dc2eb7b4b8099d4e4c99dc3ef19794289a2cd4c10070000b4'

ADumaine avatar Jul 25 '23 20:07 ADumaine

Thanks. Is there no sdk at present? Is there a js version or a java version? I don’t know much about the c language.

1029219814 avatar Jul 26 '23 02:07 1029219814

The only way to decode is with the zend cli as far as I know.
It can be called from a node.js project using rpc calls. It just means having a local node available.

ADumaine avatar Jul 26 '23 02:07 ADumaine

OK, thanks. I'll try to see if I can convert the decrypted c code into js or java

1029219814 avatar Jul 26 '23 03:07 1029219814