exbtc v0.1.4 Exbtc.Core
Link to this section Summary
Types
b58checked public address string
binary encoded key: “bin”, “bin_compressed”
use charlist to represent code strings
hex encoded key: “hex”, “hex_compressed”
jacobian number as a tuple
native decoded key in big integer, or “decimal”
point on the elliptic curve as a tuple
“bin” | “bin_compressed” | “bin_electrum” | “decimal” | “hex” | “hex_compressed” | “hex_electrum” | “wif” | “wif_compressed”
“bin” | “bin_compressed” | “bin_electrum” | “decimal” | “hex” | “hex_compressed” | “hex_electrum”
“wif”, “wif_compressed”
Functions
secp256k1 y^2 = x^3 + ax + b, a is 0
secp256k1 y^2 = x^3 + ax + b, b is 7
Convert encoded string between different base, e.g. base-2, base-10, base-16 etc
returns “bin_compressed” or “hex_compressed” version of the public key if possible
Decode a base-N encoded string into the equivalent integer
returns the un-compressed version of the public key, i.e. “bin” or “hex”
recover the public key
anything non base 256 is encoded as a string format of the target chars (base 16, base 10 or base 2); base 256 is encoded as a list(byte)
the term bytes in Python 3 is used as charlist in naming the method and argument here
secp256k1 base point (G) = (g_x, g_y)
secp256k1 base point (G) = (g_x, g_y)
secp256k1 base point (G) = (g_x, g_y)
extended Euclidean algo
secp256k1 number of points
secp256k1 prime
iex> C.sha256(‘784734adfids’) “ae616f5c8f6d338e4905f6170a90a231d0c89470a94b28e894a83aef90975557”
Link to this section Types
b58checked public address string
binary encoded key: “bin”, “bin_compressed”
use charlist to represent code strings
encoded_key() :: binary_encoded_key() | hex_encoded_key() | wif_encoded_key()
hex encoded key: “hex”, “hex_compressed”
jacobian_number() :: {non_neg_integer(), non_neg_integer(), non_neg_integer()}
jacobian number as a tuple
native decoded key in big integer, or “decimal”
point on the elliptic curve as a tuple
“bin” | “bin_compressed” | “bin_electrum” | “decimal” | “hex” | “hex_compressed” | “hex_electrum” | “wif” | “wif_compressed”
“bin” | “bin_compressed” | “bin_electrum” | “decimal” | “hex” | “hex_compressed” | “hex_electrum”
“wif”, “wif_compressed”
Link to this section Functions
secp256k1 y^2 = x^3 + ax + b, a is 0
add(p1 :: encoded_key(), p2 :: encoded_key()) :: encoded_private_key() | encoded_public_key()
add_privkeys(encoded_private_key(), encoded_private_key()) :: encoded_private_key()
add_pubkeys(encoded_public_key(), encoded_public_key()) :: encoded_public_key()
secp256k1 y^2 = x^3 + ax + b, b is 7
b58check_to_bin(hex_encoded_key() | wif_encoded_key()) :: binary_encoded_key()
bin_double_sha256([byte()] | binary() | bitstring() | String.t()) :: [byte()]
bin_ripemd160([byte()] | bitstring() | binary() | String.t()) :: [byte()]
bin_to_b58check(binary_encoded_key(), integer()) :: binary_encoded_key()
Convert encoded string between different base, e.g. base-2, base-10, base-16 etc
compress(encoded_public_key() | native_public_key()) :: encoded_public_key()
returns “bin_compressed” or “hex_compressed” version of the public key if possible.
Decode a base-N encoded string into the equivalent integer
iex> prime_70 = 4669523849932130508876392554713407521319117239637943224980015676156491
iex> assert decode("8s3gRRbpi7NyJH3sudQTtsygDHDyzzB5q3Xc6svA", 58) == prime_70
iex> assert decode("11111100101010110000110110010111001110001101001111111101010000101", 2) == prime_20
decode_privkey(encoded_private_key() | native_private_key(), private_key_format() | nil) :: native_private_key()
decode_pubkey(encoded_public_key(), public_key_format()) :: native_public_key_pair()
decode_sig(String.t()) :: {integer(), integer(), integer()}
decompress(encoded_public_key() | native_public_key()) :: encoded_public_key()
returns the un-compressed version of the public key, i.e. “bin” or “hex”
divide(encoded_public_key(), encoded_private_key() | native_private_key()) :: encoded_public_key() | native_public_key()
ecdsa_raw_recover(charlist(), {non_neg_integer(), non_neg_integer(), non_neg_integer()}) :: pair()
recover the public key
encode(non_neg_integer(), integer(), pos_integer()) :: String.t() | [byte()]
anything non base 256 is encoded as a string format of the target chars (base 16, base 10 or base 2); base 256 is encoded as a list(byte)
iex> prime_70 = 4669523849932130508876392554713407521319117239637943224980015676156491
iex> assert encode(prime_70, 58) == "8s3gRRbpi7NyJH3sudQTtsygDHDyzzB5q3Xc6svA"
iex> assert encode(prime_70, 32) == "cwthr5r3cy4jn6as3oouomr3ondgjigwie45geqegagy2sl"
iex> assert encode(prime_70, 256) == [173, 51, 199, 177, 216, 177, 196, 183, 192, 150, 220, 234, 57, 145, 219, 154, 51, 37, 6, 178, 9, 206, 152, 144, 33, 128, 108, 106, 75]
encode_privkey(encoded_private_key() | native_private_key(), private_key_format(), integer()) :: encoded_private_key()
encode_pubkey(native_public_key_pair(), public_key_format()) :: encoded_public_key() | native_public_key_pair()
the term bytes in Python 3 is used as charlist in naming the method and argument here
secp256k1 base point (G) = (g_x, g_y)
secp256k1 base point (G) = (g_x, g_y)
secp256k1 base point (G) = (g_x, g_y)
get_privkey_format(encoded_private_key() | native_private_key()) :: private_key_format()
get_pubkey_format(encoded_public_key() | native_public_key_pair()) :: public_key_format()
extended Euclidean algo
is_privkey(encoded_private_key() | native_private_key()) :: boolean()
is_pubkey(encoded_public_key() | native_public_key_pair()) :: boolean()
jacobian_add(jacobian_number(), jacobian_number()) :: jacobian_number()
jacobian_multiply(jacobian_number(), jacobian_number()) :: jacobian_number()
multiply(encoded_public_key(), encoded_private_key() | native_private_key()) :: encoded_public_key() | native_public_key()
multiply_privkeys(p1 :: encoded_private_key(), p2 :: encoded_private_key()) :: encoded_private_key()
secp256k1 number of points
neg_privkey(encoded_private_key() | native_private_key()) :: encoded_private_key() | native_private_key()
neg_pubkey(encoded_public_key() | native_public_key()) :: encoded_public_key()
secp256k1 prime
privkey_to_address(encoded_private_key() | native_private_key(), integer()) :: address()
privkey_to_pubkey(encoded_private_key() | native_private_key()) :: encoded_public_key() | native_public_key() | native_public_key_pair()
pubkey_to_address(native_public_key_pair() | encoded_public_key() | native_public_key(), non_neg_integer()) :: address()
iex> C.sha256(‘784734adfids’) “ae616f5c8f6d338e4905f6170a90a231d0c89470a94b28e894a83aef90975557”
substract(p1 :: encoded_private_key() | encoded_public_key() | native_private_key() | native_public_key(), p2 :: encoded_private_key() | encoded_public_key() | native_private_key() | native_public_key()) :: encoded_private_key() | encoded_public_key() | native_private_key() | native_public_key()
subtract_privkey(encoded_private_key() | native_private_key(), encoded_private_key() | native_private_key()) :: encoded_private_key() | native_private_key()
subtract_pubkeys(encoded_public_key(), encoded_public_key()) :: encoded_public_key()
to_jacobian(pair()) :: {non_neg_integer(), non_neg_integer(), 1}