Created
December 4, 2020 13:56
-
-
Save mahdiidarabi/4941fa558f85d917954a2ebcc2b7951a to your computer and use it in GitHub Desktop.
dis asemble a bitcoin script to human readable one in go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/hex" | |
"github.com/btcsuite/btcd/txscript" | |
) | |
func DisAsembleScript() (string, error) { | |
// you can provide your locking script to dis asemble | |
lockingScript := "a914f63e2cbcc678236f683d267e7bb298ffdcd57b0487" | |
script, err := hex.DecodeString(lockingScript) | |
if err != nil { | |
return "", err | |
} | |
scriptStr, err := txscript.DisasmString(script) | |
if err != nil { | |
return "", err | |
} | |
return scriptStr, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment