def test_mainnet_from_mnemonic(): # Initialize bytom sender wallet bytom_wallet = Wallet(network="mainnet")\ .from_mnemonic("indicate warm sock mistake code spot acid ribbon sing over taxi toast") seed = bytom_wallet.seed() assert seed == "baff3e1fe60e1f2a2d840d304acc98d1818140c79354a353b400fb019bfb256bc392d7aa9047adff1f14bce0342e14605c6743a6c08e02150588375eb2eb7d49" xprivate_key = bytom_wallet.xprivate_key() assert xprivate_key == "205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee51ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b" xpublic_key = bytom_wallet.xpublic_key() assert xpublic_key == "16476b7fd68ca2acd92cfc38fa353e75d6103f828276f44d587e660a6bd7a5c5ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b" expand_xprivate_key = bytom_wallet.expand_xprivate_key() assert expand_xprivate_key == "205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee5102416c643cfb46ab1ae5a524c8b4aaa002eb771d0d9cfc7490c0c3a8177e053e" public_key = bytom_wallet.public_key() assert public_key == "91ff7f525ff40874c4f47f0cab42e46e3bf53adad59adef9558ad1b6448f22e2" program = bytom_wallet.program() assert program == "00142cda4f99ea8112e6fa61cdd26157ed6dc408332a" address = bytom_wallet.address() assert address == "bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7"
def test_bytom_wallet_tools(): wallet = Wallet(network="mainnet", indexes=["2c000000", "99000000", "01000000", "00000000", "01000000"]) wallet.from_xpublic_key("16476b7fd68ca2acd92cfc38fa353e75d6103f828276f44d587e660a6bd7a5c5ef4490504bd2b" "6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b") assert wallet.address() == "bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7" assert wallet.path() == "m/44/153/1/0/1" assert isinstance(wallet.guid(), str) wallet = Wallet(network="solonet") wallet.from_entropy("063679ca1b28b5cfda9c186b367e271e") assert wallet.address() == "sm1qzq3k0cg89qudwnlxs7frykxg0r357kupzccnzv" assert wallet.path() == "m/44/153/1/0/1" wallet = Wallet(network="testnet") wallet.from_guid(guid="f0ed6ddd-9d6b-49fd-8866-a52d1083a13b") wallet = Wallet(network="mainnet") wallet.from_public_key("91ff7f525ff40874c4f47f0cab42e46e3bf53adad59adef9558ad1b6448f22e2") assert wallet.address() == "bm1q9ndylx02syfwd7npehfxz4lddhzqsve2fu6vc7" assert wallet.path() is None assert wallet.seed() is None assert wallet.xprivate_key() is None assert wallet.xpublic_key() is None assert wallet.expand_xprivate_key() is None assert isinstance(wallet.balance(), int)
SENDER_MNEMONIC = "indicate warm sock mistake code spot acid ribbon sing over taxi toast" # Recipient Bytom public key RECIPIENT_PUBLIC_KEY = "3e0a377ae4afa031d4551599d9bb7d5b27f4736d77f78cac4d476f0ffba5ae3e" # Bytom fund asset id ASSET = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" # Bytom fund amount AMOUNT = 10_000 print("=" * 10, "Sender Bytom Account") # Initializing Bytom sender wallet sender_wallet = Wallet(network=NETWORK) # Initializing Bytom wallet from mnemonic sender_wallet.from_mnemonic(mnemonic=SENDER_MNEMONIC) # Getting sender wallet information's sender_seed = sender_wallet.seed() print("Sender Seed:", sender_seed) sender_xprivate_key = sender_wallet.xprivate_key() print("Sender XPrivate Key:", sender_xprivate_key) sender_xpublic_key = sender_wallet.xpublic_key() print("Sender XPublic Key:", sender_xpublic_key) sender_expand_xprivate_key = sender_wallet.expand_xprivate_key() print("Sender Expand XPrivate Key:", sender_expand_xprivate_key) sender_private_key = sender_wallet.private_key() print("Sender Private Key:", sender_private_key) sender_public_key = sender_wallet.public_key() print("Sender Public Key:", sender_public_key) sender_program = sender_wallet.program() print("Sender Program:", sender_program) sender_address = sender_wallet.address() print("Sender Address:", sender_address)
from shuttle.providers.bytom.transaction import FundTransaction from shuttle.providers.bytom.solver import FundSolver from shuttle.providers.bytom.signature import FundSignature from shuttle.utils import sha256 import json print("=" * 10, "Sender Bytom Account") sender_mnemonic = "indicate warm sock mistake code spot acid ribbon sing over taxi toast" print("Sender Mnemonic:", sender_mnemonic) # Initialize bytom sender wallet sender_bytom_wallet = Wallet(network="mainnet").from_mnemonic(sender_mnemonic) # Sender wallet information's sender_seed = sender_bytom_wallet.seed() print("Sender Seed:", sender_seed) sender_xprivate_key = sender_bytom_wallet.xprivate_key() print("Sender XPrivate Key:", sender_xprivate_key) sender_xpublic_key = sender_bytom_wallet.xpublic_key() print("Sender XPublic Key:", sender_xpublic_key) sender_expand_xprivate_key = sender_bytom_wallet.expand_xprivate_key() print("Sender Expand XPrivate Key:", sender_expand_xprivate_key) sender_private_key = sender_bytom_wallet.private_key() print("Sender Private Key:", sender_private_key) sender_public_key = sender_bytom_wallet.public_key() print("Sender Public Key:", sender_public_key) sender_program = sender_bytom_wallet.program() print("Sender Program:", sender_program) sender_address = sender_bytom_wallet.address() print("Sender Address:", sender_address)
RECIPIENT_MNEMONIC = "hint excuse upgrade sleep easily deputy erase cluster section other ugly limit" # Sender Bytom public key SENDER_PUBLIC_KEY = "91ff7f525ff40874c4f47f0cab42e46e3bf53adad59adef9558ad1b6448f22e2" # Bytom fund asset id ASSET = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" # Bytom fund amount AMOUNT = 10_000 print("=" * 10, "Recipient Bytom Account") # Initializing Bytom recipient wallet recipient_wallet = Wallet(network="mainnet") # Initializing Bytom wallet from mnemonic recipient_wallet.from_mnemonic(mnemonic=RECIPIENT_MNEMONIC) # Getting recipient wallet information's recipient_seed = recipient_wallet.seed() print("Recipient Seed:", recipient_seed) recipient_xprivate_key = recipient_wallet.xprivate_key() print("Recipient XPrivate Key:", recipient_xprivate_key) recipient_xpublic_key = recipient_wallet.xpublic_key() print("Recipient XPublic Key:", recipient_xpublic_key) recipient_expand_xprivate_key = recipient_wallet.expand_xprivate_key() print("Recipient Expand XPrivate Key:", recipient_expand_xprivate_key) recipient_private_key = recipient_wallet.private_key() print("Recipient Private Key:", recipient_private_key) recipient_public_key = recipient_wallet.public_key() print("Recipient Public Key:", recipient_public_key) recipient_program = recipient_wallet.program() print("Recipient Program:", recipient_program) recipient_address = recipient_wallet.address() print("Recipient Address:", recipient_address)
from shuttle.providers.bytom.wallet import Wallet from shuttle.providers.bytom.transaction import ClaimTransaction from shuttle.providers.bytom.solver import ClaimSolver from shuttle.providers.bytom.signature import ClaimSignature import json print("=" * 10, "Recipient Bytom Account") recipient_mnemonic = "indicate warm sock mistake code spot acid ribbon sing over taxi toast" print("Recipient Mnemonic:", recipient_mnemonic) # Initialize bytom recipient wallet recipient_bytom_wallet = Wallet(network="mainnet").from_mnemonic(recipient_mnemonic) # Recipient wallet information's recipient_seed = recipient_bytom_wallet.seed() print("Recipient Seed:", recipient_seed) recipient_xprivate_key = recipient_bytom_wallet.xprivate_key() print("Recipient XPrivate Key:", recipient_xprivate_key) recipient_xpublic_key = recipient_bytom_wallet.xpublic_key() print("Recipient XPublic Key:", recipient_xpublic_key) recipient_expand_xprivate_key = recipient_bytom_wallet.expand_xprivate_key() print("Recipient Expand XPrivate Key:", recipient_expand_xprivate_key) recipient_private_key = recipient_bytom_wallet.private_key() print("Recipient Private Key:", recipient_private_key) recipient_public_key = recipient_bytom_wallet.public_key() print("Recipient Public Key:", recipient_public_key) recipient_program = recipient_bytom_wallet.program() print("Recipient Program:", recipient_program) recipient_address = recipient_bytom_wallet.address() print("Recipient Address:", recipient_address)