Esempio n. 1
0
def __get_encrypted_leaf(address, partner_secret=None):
    """Fetch encrypted leaf data from chain"""
    if partner_secret is None:
        raise AuthException
    ddict = RestClient(sawtooth_rest_host()).get_leaf(address)
    data = binascii.unhexlify(b64decode(ddict['data']).decode())
    ddict['data'] = STATE_CRYPTO.decrypt_object_with(data, partner_secret)
    return ddict
Esempio n. 2
0
def __get_encrypted_list_data(address, partner_secret=None):
    """Fetch encrypted list data from chain"""
    if partner_secret is None:
        raise AuthException
    ddict = RestClient(sawtooth_rest_host()).list_state(address)
    for entry in ddict['data']:
        s1 = binascii.unhexlify(b64decode(entry['data']).decode())
        entry['data'] = STATE_CRYPTO.decrypt_object_with(s1, partner_secret)
    return ddict
Esempio n. 3
0
def __get_list_data(address, partner_secret=None):
    """Fetch list data from chain"""
    ddict = RestClient(sawtooth_rest_host()).list_state(address)
    for entry in ddict['data']:
        entry['data'] = b64decode(entry['data'])
    return ddict
Esempio n. 4
0
def __get_leaf_data(address, partner_secret=None):
    """Fetch leaf data from chain"""
    ddict = RestClient(sawtooth_rest_host()).get_leaf(address)
    ddict['data'] = b64decode(ddict['data'])
    return ddict
Esempio n. 5
0
def get_node(address):
    return RestClient(sawtooth_rest_host()).get_leaf(address)
def submit_batch(batches):
    """Submit transaction batches using default client URL"""
    batch_list = create_batch_list(batches)
    client = RestClient(sawtooth_rest_host())
    return client.send_batches(batch_list)