Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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
recipient_wallet.from_public_key(public=RECIPIENT_PUBLIC_KEY)
# Getting recipient wallet information's
recipient_public_key = recipient_wallet.public_key()
print("Recipient Public Key:", recipient_public_key)
recipient_program = recipient_wallet.program()
print("Recipient Program:", recipient_program)
Exemplo n.º 3
0
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)
# Recipient wallet information's
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()
Exemplo n.º 4
0
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)
recipient_path = recipient_wallet.path()
print("Recipient Path:", recipient_path)
recipient_guid = recipient_wallet.guid()
print("Recipient GUID:", recipient_guid)
# recipient_balance = recipient_wallet.balance()
# print("Recipient Balance:", recipient_balance)

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

# Initializing Bytom sender wallet
sender_wallet = Wallet(network=NETWORK)
# Initializing Bytom wallet from public key
sender_wallet.from_public_key(public=SENDER_PUBLIC_KEY)
# Getting sender wallet information's
sender_public_key = sender_wallet.public_key()
print("Sender Public Key:", sender_public_key)
sender_program = sender_wallet.program()
print("Sender Program:", sender_program)
Exemplo n.º 5
0
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)
recipient_path = recipient_bytom_wallet.path()
print("Recipient Path:", recipient_path)
recipient_guid = recipient_bytom_wallet.guid()
print("Recipient GUID:", recipient_guid)
# recipient_balance = recipient_bytom_wallet.balance()
# print("Recipient Balance:", recipient_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)

print("=" * 10, "Unsigned Claim Transaction")

# Initialization claim transaction
unsigned_claim_transaction = ClaimTransaction(network="mainnet")
# Building claim transaction