-
Notifications
You must be signed in to change notification settings - Fork 2
Utils
- Generate entropy
- Generate mnemonic
- Check mnemonic
- Get mnemonic language
- Bytom address checker
- Bytom sidechain vapor address checker
generate_entropy()
- Generate entropy hex string.
Parameter
strength (int) - Entropy strength, [default to 128
].
Return
entropy (str) - Entropy hex string.
>>> from pybytom.utils import generate_entropy
>>> generate_entropy(strength=128)
"ee535b143b0d9d1f87546f9df0d06b1a"
generate_mnemonic()
- Generate 12 word mnemonic.
Parameter
language (str) - Mnemonic language, [default to english
].
strength (int) - Entropy strength, [default to 128
].
Return
mnemonic (str) - 12 word mnemonic.
>>> from pybytom.utils import generate_mnemonic
>>> generate_mnemonic(language="french")
"sceptre capter séquence girafe absolu relatif fleur zoologie muscle sirop saboter parure"
check_mnemonic()
- Check 12 word mnemonic.
Parameter
mnemonic (str) - 12 word mnemonic., [required].
language (str) - Mnemonic language, [default to None
].
Return
mnemonic (bool) - True/False.
>>> from pybytom.utils import check_mnemonic
>>> check_mnemonic("sceptre capter séquence girafe absolu relatif fleur zoologie muscle sirop saboter parure")
True
get_mnemonic_language()
- Get mnemonic language.
Parameter
mnemonic (str) - 12 word mnemonic., [required].
Return
language (str) - Mnemonic language.
>>> from pybytom.utils import get_mnemonic_language
>>> get_mnemonic_language("sceptre capter séquence girafe absolu relatif fleur zoologie muscle sirop saboter parure")
"french"
is_address()
- Check Bytom address.
Parameter
address (str) - Bytom address. [required]
network (str) - Bytom network. [default to None
]
Return
address (bool) - Bytom valid/invalid address.
>>> from pybytom.utils import is_address
>>> print(is_address("bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7"))
True
>>> print(is_address("bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7", "mainnet"))
True
>>> print(is_address("bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7", "solonet"))
False
>>> print(is_address("bm1qul37cmn85j9m0f8wxglsfsj3jyl8w4g8hdw8wjsh4g8eqhg925xqheeud2"))
True
is_vapor_address()
- Check Bytom sidechain vapor address.
Parameter
address (str) - Bytom sidechain vapor address. [required]
network (str) - Bytom network. [default to None
]
Return
address (bool) - Bytom sidechain vapor valid/invalid address.
>>> from pybytom.utils import is_vapor_address
>>> print(is_vapor_address("vp1q9ndylx02syfwd7npehfxz4lddhzqsve2za23ag"))
True
>>> print(is_vapor_address("vp1q9ndylx02syfwd7npehfxz4lddhzqsve2za23ag", "mainnet"))
True
>>> print(is_vapor_address("vp1q9ndylx02syfwd7npehfxz4lddhzqsve2za23ag", "testnet"))
False