- Constants
- Function
from_ascii_bytes
- Function
from_ascii_bytes_option
- Function
to_string
- Function
sha256d
use 0x1::hash;
use 0x1::option;
use 0x1::string;
use 0x1::vector;
use 0x2::address;
use 0x2::hex;
const ErrorInvalidHex: u64 = 1;
Convert an ascii hex string bytes to Bitcoin Hash Because Bitcoin Hash hex is reversed, we need to reverse the bytes Abort if the input is not a valid hex
public fun from_ascii_bytes(bytes: &vector<u8>): address
Convert an ascii hex string bytes to Bitcoin Hash Because Bitcoin Hash hex is reversed, we need to reverse the bytes Return None if the input is not a valid hex
public fun from_ascii_bytes_option(bytes: &vector<u8>): option::Option<address>
Convert Bitcoin Hash to hex string Because Bitcoin Hash hex is reversed, we need to reverse the bytes
public fun to_string(hash: address): string::String
Bitcoin hash is double sha256 of the input