nebula.addons.blockchain.oracle.app#

Attributes#

Classes#

Functions#

Module Contents#

nebula.addons.blockchain.oracle.app.app#
nebula.addons.blockchain.oracle.app.error_handler(func)#

Adds default status and header to all REST responses used for Oracle

class nebula.addons.blockchain.oracle.app.Oracle#
acc#
contract_obj#
property contract_abi#
property contract_address#
wait_for_blockchain()#

Executes REST post request for a selected RPC method to check if blockchain is up and running Returns: None

Return type:

bool

transfer_funds(address)#

Creates transaction to blockchain network for assigning funds to Cores :param address: public wallet address of Core to assign funds to

Returns: Transaction receipt

deploy_chaincode()#

Creates transaction to deploy chain code on the blockchain network by sending transaction to non-validator node Returns: address of chain code on the network

get_balance(addr)#

Creates transaction to blockchain network to request balance for parameter address :param addr: public wallet address of account

Returns: current balance in ether (ETH)

report_gas(amount, aggregation_round)#

Experiment method for collecting and reporting gas usage statistics :param aggregation_round: Aggregation round of sender :param amount: Amount of gas spent in WEI

Returns: None

Parameters:
  • amount (int)

  • aggregation_round (int)

Return type:

None

get_gas_report()#

Experiment method for requesting the summed up records of reported gas usage Returns: JSON with name:value (WEI/USD) for every reported node

Return type:

Mapping[str, str]

property gas_store#
Experiment method for requesting the detailed records of the gas reports
Returns: list of records of type: list[(node, timestamp, gas)]
report_time(time_s, aggregation_round)#

Experiment method for collecting and reporting time statistics :param aggregation_round: Aggregation round of node :param method: Name of node which reports time :param time_s: Amount of time spend on method

Returns: None

Parameters:
  • time_s (float)

  • aggregation_round (int)

Return type:

None

report_reputation(records, aggregation_round, sender)#

Experiment method for collecting and reporting reputations statistics :param aggregation_round: Current aggregation round of sender :param records: list of (name:reputation) records :param sender: node reporting its local view

Returns: None

Parameters:
  • records (list)

  • aggregation_round (int)

  • sender (str)

Return type:

None

property time_store: list#

Experiment method for requesting all records of nodes which reported timings Returns: JSON with method:(sum_time, n_calls) for every reported node

Return type:

list

property reputation_store: list#

Experiment method for requesting all records of reputations Returns: list with (name, reputation, timestamp)

Return type:

list

property ready: bool#

Returns true if the Oracle is ready itself and the chain code was deployed successfully Returns: True if ready False otherwise

Return type:

bool

nebula.addons.blockchain.oracle.app.home()#
nebula.addons.blockchain.oracle.app.rest_transfer_funds()#
nebula.addons.blockchain.oracle.app.rest_report_gas()#
nebula.addons.blockchain.oracle.app.rest_get_balance()#
nebula.addons.blockchain.oracle.app.rest_status()#
nebula.addons.blockchain.oracle.app.rest_contract()#
nebula.addons.blockchain.oracle.app.rest_get_gas_report()#
nebula.addons.blockchain.oracle.app.rest_get_gas_series()#
nebula.addons.blockchain.oracle.app.rest_report_time()#
nebula.addons.blockchain.oracle.app.rest_get_time_report()#
nebula.addons.blockchain.oracle.app.rest_report_reputation()#
nebula.addons.blockchain.oracle.app.rest_get_reputation_timeseries()#
nebula.addons.blockchain.oracle.app.oracle#