mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-13 15:45:01 +00:00
18 lines
356 B
Go
18 lines
356 B
Go
package address
|
|
|
|
import (
|
|
"encoding/hex"
|
|
|
|
"github.com/CityOfZion/neo-go/pkg/crypto/base58"
|
|
)
|
|
|
|
func ToScriptHash(address string) string {
|
|
|
|
decodedAddressAsBytes, err := base58.Decode(address)
|
|
if err != nil {
|
|
return ""
|
|
}
|
|
decodedAddressAsHex := hex.EncodeToString(decodedAddressAsBytes)
|
|
scriptHash := (decodedAddressAsHex[2:42])
|
|
return scriptHash
|
|
}
|