Ejemplo n.º 1
0
def chain_loop(chain):
    os.system('clear')
    try:
        rpc_connection = stakerlib.def_credentials(chain)
        dummy = rpc_connection.getbalance()  # test connection
    except:
        os.system('clear')
        error = 'Error: Could not connect to daemon. ' + chain + ' is not running or rpc creds not found.'
        select_loop(error)
    while True:
        print_menu(chain_menu, chain, '')
        selection = selectRangeInt(0, len(chain_menu), "make a selection:")
        if int(selection) == 0:
            os.system('clear')
            select_loop('')
        elif int(selection) == 1:
            stakerlib.sendmany64_TUI(chain, rpc_connection)
        elif int(selection) == 2:
            stakerlib.RNDsendmany_TUI(chain, rpc_connection)
        elif int(selection) == 3:
            stakerlib.genaddresses(chain, rpc_connection)
        elif int(selection) == 4:
            stakerlib.import_list(chain, rpc_connection)
        elif int(selection) == 5:
            stakerlib.withdraw_TUI(chain, rpc_connection)
        elif int(selection) == 6:
            stakerlib.startchain(chain, rpc_connection)
        else:
            print('BUG!')
Ejemplo n.º 2
0
import os
import sys
from stakerlib import def_credentials
from doom import make_wad

# FIXME this should use notarization hashes instead of block hashes as they can be considered "final" as soon as they are confirmed
# use notarization db as it cannot be changed once notarization enters it

blockhash = sys.argv[1]
rpc = def_credentials('PYDOOM')
height = rpc.getblock(blockhash)['height']
print('height, hash', height, blockhash)
if height % 10 == 0:
    seed = int(blockhash,16) >> 225
    wad_path = make_wad(seed)
    if wad_path:
        print('created ' + wad_path + ' at height ' + str(height))
        sys.exit(0)
    else:
        print('did not create ' + str(seed) + '.wad , already exists or error')
        sys.exit(0)
else:
    print('not height % 10, do not need to generate wad')
    sys.exit(0)
Ejemplo n.º 3
0
        sys.exit(e)
    return (lockunspent_result)


def extract_segid(_segid, unspents):
    ret = []
    for unspent in unspents:
        if unspent['segid'] == _segid:
            unspent['amount'] = float(unspent['amount'])
            ret.append(unspent)
    return (ret)


CHAIN = input('Please specify chain: ')
try:
    rpc_connection = stakerlib.def_credentials(CHAIN)
except Exception as e:
    sys.exit(e)
balance = float(rpc_connection.getbalance())
print('Balance: ' + str(balance))

PERC = int(input("Please specify the percentage of balance to lock: "))
if PERC < 1:
    sys.exit('Cant lock 0%. Exiting.')

# get listunspent
try:
    listunspent_result = rpc_connection.listunspent()
except Exception as e:
    sys.exit(e)