Beispiel #1
0
#!/usr/bin/env python3

from pythereum import generate_wallet, Pythereum

print("Creating two wallets")
w1 = generate_wallet("bob", "the", "builder")
w2 = generate_wallet()

pth = Pythereum(0)

print("Initial balance of W1 and W2")
print("W1:", pth.get_balance(w1["public_key"]))
print("W2:", pth.get_balance(w2["public_key"]))

input("\n...\n")

print("Sending 5 PTH from W1 to W2 using three transactions ( 5PTH/tx )")
for i in range(3):
    pth.send_pth(w1["public_key"], w2["public_key"], 5, w1["private_key"])
    pth.mine_block()

input("\n...\n")

print("Updated balances")
print("W1:", pth.get_balance(w1["public_key"]))
print("W2:", pth.get_balance(w2["public_key"]))

print("\n\nW2 utxos")
utxos = pth.get_utxo(w2["public_key"])
print("W2:", utxos)
Beispiel #2
0
#!/usr/bin/env python3

from pythereum import generate_wallet, sign_item

wallet = generate_wallet()

print(wallet)

input("\n...\n")
print("Signing the following string -> 'Hello World'")

sign = sign_item(w["private_key"], "Hello World")

print(sign)