Exemplo n.º 1
0
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"
Exemplo n.º 2
0
def test_solonet_from_xprivate_key():
    # Initialize bytom sender wallet
    bytom_testnet_wallet = Wallet(network="solonet",
                                  indexes=["2c000000", "99000000", "01000000", "00000000", "01000000"]) \
        .from_xprivate_key("205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee51ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b")

    xpublic_key = bytom_testnet_wallet.xpublic_key()
    assert xpublic_key == "16476b7fd68ca2acd92cfc38fa353e75d6103f828276f44d587e660a6bd7a5c5ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b"

    assert bytom_testnet_wallet.path() == "m/44/153/1/0/1"

    expand_xprivate_key = bytom_testnet_wallet.expand_xprivate_key()
    assert expand_xprivate_key == "205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee5102416c643cfb46ab1ae5a524c8b4aaa002eb771d0d9cfc7490c0c3a8177e053e"

    public_key = bytom_testnet_wallet.public_key()
    assert public_key == "91ff7f525ff40874c4f47f0cab42e46e3bf53adad59adef9558ad1b6448f22e2"

    assert bytom_testnet_wallet.indexes() == ["2c000000", "99000000", "01000000", "00000000", "01000000"]

    program = bytom_testnet_wallet.program()
    assert program == "00142cda4f99ea8112e6fa61cdd26157ed6dc408332a"

    address = bytom_testnet_wallet.address()
    assert address == "sm1q9ndylx02syfwd7npehfxz4lddhzqsve2gdsdcs"

    private_key = bytom_testnet_wallet.private_key()
    assert private_key == "e07af52746e7cccd0a7d1fba6651a6f474bada481f34b1c5bab5e2d71e36ee515803ee0a6682fb19e279d8f4f7acebee8abd0fc74771c71565f9a9643fd77141"
Exemplo n.º 3
0
def test_testnet_from_xprivate_key():
    # Initialize bytom sender wallet
    bytom_testnet_wallet = Wallet(network="testnet", path="m/44/153/1/0/1") \
        .from_xprivate_key("205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee51ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b")

    xpublic_key = bytom_testnet_wallet.xpublic_key()
    assert xpublic_key == "16476b7fd68ca2acd92cfc38fa353e75d6103f828276f44d587e660a6bd7a5c5ef4490504bd2b6f997113671892458830de09518e6bd5958d5d5dd97624cfa4b"

    assert bytom_testnet_wallet.path() == "m/44/153/1/0/1"

    expand_xprivate_key = bytom_testnet_wallet.expand_xprivate_key()
    assert expand_xprivate_key == "205b15f70e253399da90b127b074ea02904594be9d54678207872ec1ba31ee5102416c643cfb46ab1ae5a524c8b4aaa002eb771d0d9cfc7490c0c3a8177e053e"

    public_key = bytom_testnet_wallet.public_key()
    assert public_key == "91ff7f525ff40874c4f47f0cab42e46e3bf53adad59adef9558ad1b6448f22e2"

    program = bytom_testnet_wallet.program()
    assert program == "00142cda4f99ea8112e6fa61cdd26157ed6dc408332a"

    address = bytom_testnet_wallet.address()
    assert address == "tm1q9ndylx02syfwd7npehfxz4lddhzqsve2d2mgc0"
Exemplo n.º 4
0
# 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)
sender_path = sender_wallet.path()
print("Sender Path:", sender_path)
sender_guid = sender_wallet.guid()
print("Sender GUID:", sender_guid)
# sender_balance = sender_wallet.balance()
# print("Sender Balance:", sender_balance)

print("=" * 10, "Recipient Bytom Account")

# Initializing Bytom recipient wallet
recipient_wallet = Wallet(network=NETWORK)
# Initializing Bytom wallet from public key
Exemplo n.º 5
0
# 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)
sender_path = sender_bytom_wallet.path()
print("Sender Path:", sender_path)
sender_guid = sender_bytom_wallet.guid()
print("Sender GUID:", sender_guid)
# sender_balance = sender_bytom_wallet.balance()
# print("Sender Balance:", sender_balance)

print("=" * 10, "Recipient Bytom Account")

recipient_public = "ac13c0bb1445423a641754182d53f0677cd4351a0e743e6f10b35122c3d7ea01"
# Initialize bytom sender wallet
recipient_bytom_wallet = Wallet(network="mainnet").from_public_key(recipient_public)
Exemplo n.º 6
0
import pytest

network = "mainnet"

# Initialize bytom sender wallet
sender_mnemonic = "indicate warm sock mistake code spot acid ribbon sing over taxi toast"
sender_bytom_wallet = Wallet(network=network).from_mnemonic(sender_mnemonic)
sender_xprivate_key = sender_bytom_wallet.xprivate_key()

# Initialize bytom recipient wallet
recipient_public = "ac13c0bb1445423a641754182d53f0677cd4351a0e743e6f10b35122c3d7ea01"
recipient_bytom_wallet = Wallet(
    network=network).from_public_key(recipient_public)
recipient_public_key = recipient_bytom_wallet.public_key()
recipient_program = recipient_bytom_wallet.program()


UNSIGNED_FUND = \
       "eyJmZWUiOiAxMDAwMDAwMCwgImd1aWQiOiAiZjBlZDZkZGQtOWQ2Yi00OWZkLTg4NjYtYTUyZDEwODNhMTNiIiwgInVuc2lnbmVk" \
       "IjogW3siZGF0YXMiOiBbImIxYzVlYTFkNjAwNjY0Y2U4MTAwNzMxNmQ2Zjg5NThlMjQ4ZWZhNjk3YWRhN2Q0M2E4YzI2YjJkNjE1" \
       "NjAxNDgiXSwgInB1YmxpY19rZXkiOiAiOTFmZjdmNTI1ZmY0MDg3NGM0ZjQ3ZjBjYWI0MmU0NmUzYmY1M2FkYWQ1OWFkZWY5NTU4" \
       "YWQxYjY0NDhmMjJlMiIsICJuZXR3b3JrIjogIm1haW5uZXQiLCAicGF0aCI6ICJtLzQ0LzE1My8xLzAvMSJ9LCB7ImRhdGFzIjog" \
       "WyIyNTFmYmQ4YTAzMmM3MmJmMjkwN2VjNGFmYzk1ZGYxZTE2Mzg5NDZiODE5MGQwYjIxZTk1MjA2YmU2YzZhOTYyIl0sICJwdWJs" \
       "aWNfa2V5IjogIjkxZmY3ZjUyNWZmNDA4NzRjNGY0N2YwY2FiNDJlNDZlM2JmNTNhZGFkNTlhZGVmOTU1OGFkMWI2NDQ4ZjIyZTIi" \
       "LCAibmV0d29yayI6ICJtYWlubmV0IiwgInBhdGgiOiAibS80NC8xNTMvMS8wLzEifV0sICJoYXNoIjogImM2YjMyYjk1ODEwYTEw" \
       "MDIzZDA3ODk2ODczNTI3NGQwMWU4YjVmZjhjNTU3NjNkODM3OGZhZjZhZjI5YTY2NjYiLCAicmF3IjogIjA3MDEwMDAyMDE2MTAx" \
       "NWY4MWU1MGUxMmY4MjM2ZjkxYzg4NDJkM2Y0OTU1MDJiOTc1MmZjMzVkMDE1MDA5MWVhNWIyYzI2NjA1MTVjM2I1ZjM3ZGVhNjJl" \
       "ZmQyOTY1MTc0Yjg0YmJiNTlhMGJkMGE2NzFjZjVmYjI4NTczMDNmZmQ3N2MxYjQ4MmI4NGJkZmE4Y2JkYmMzZjQwMjAxMDExNjAw" \
       "MTQyY2RhNGY5OWVhODExMmU2ZmE2MWNkZDI2MTU3ZWQ2ZGM0MDgzMzJhMjIwMTIwOTFmZjdmNTI1ZmY0MDg3NGM0ZjQ3ZjBjYWI0" \
       "MmU0NmUzYmY1M2FkYWQ1OWFkZWY5NTU4YWQxYjY0NDhmMjJlMjAxNjAwMTVlM2ZiZjI0YjQwYzlhNzhiNWY3NmJlZTVlNmIyNDI4" \
Exemplo n.º 7
0
# 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)
sender_path = sender_bytom_wallet.path()
print("Sender Path:", sender_path)
sender_guid = sender_bytom_wallet.guid()
print("Sender GUID:", sender_guid)
# sender_balance = sender_bytom_wallet.balance()
# print("Sender Balance:", sender_balance)

print("=" * 10, "Hash Time Lock Contract (HTLC) Fund Transaction Id")

# Funded hash time lock contract transaction id/hash
fund_transaction_id = "9059cd0d03e4d4fab70a415169a45be47583f7240115c36cf298d6f261c0a1ac"
print("HTLC Fund Transaction Id:", fund_transaction_id)