コード例 #1
0
    'dd0dd23cd51460e6c42a154623df19372be332f0a61a51755603ab897f6ede39')
#alpha = PrivateKey.generate()
#bravo = PrivateKey.generate()
charlie = PrivateKey.generate()


def print_balances(rgov: rgovAPI):
    # get balance of vault
    admin_balance = rgov.checkBalance(admin.get_public_key().get_rev_address())
    print("admin Balance ", admin_balance, " REV ",
          admin.get_public_key().get_rev_address())
    charlie_balance = rgov.checkBalance(
        charlie.get_public_key().get_rev_address())
    print("charlie Balance ", charlie_balance, " REV ",
          charlie.get_public_key().get_rev_address())


rgov = rgovAPI(RCHAIN_SERVER[0])
balance = rgov.checkBalance(charlie.get_public_key().get_rev_address())
if balance < 100000000:
    result = rgov.transfer(admin.get_public_key().get_rev_address(),
                           charlie.get_public_key().get_rev_address(),
                           100000000, admin)

#time.sleep(1)
#rgov.propose()
#time.sleep(1)
inbox = rgov.newInbox(charlie)
print('Charlie Inbox', inbox)
rgov.close()
コード例 #2
0
#!/usr/bin/python

from rchain.crypto import PrivateKey
from pyrgov.rgov import rgovAPI

rgov = rgovAPI('localhost')
new1 = PrivateKey.generate()
new2 = PrivateKey.generate()
admin = rgov.get_private_key('bootstrap')

balance = rgov.checkBalance(admin.get_public_key().get_rev_address())
assert balance != 0

balance = rgov.checkBalance(new1.get_public_key().get_rev_address())
assert balance == 0

balance = rgov.checkBalance(new1.get_public_key().get_rev_address())
assert balance == 0

funds = 100000000
result = rgov.transfer(admin.get_public_key().get_rev_address(),
                       new1.get_public_key().get_rev_address(), funds, admin)
assert result[0]
result = rgov.transfer(admin.get_public_key().get_rev_address(),
                       new2.get_public_key().get_rev_address(), funds, admin)
assert result[0]

balance = rgov.checkBalance(new1.get_public_key().get_rev_address())
assert balance == funds
balance = rgov.checkBalance(new2.get_public_key().get_rev_address())
assert balance == funds