Coding Qubics in QL

Qubic Functions



Return: quorum based result (any type possible)

This command fetches the consensus/quorum based result of a qubic at a certain epoch. The pre-initialized variables qubic (containing the qubic ID as string) and epoch (the current epoch in your qubic as integer) might come in handy in case that you are fetching results from the very qubic you are programming:

if(epoch >= 1) {
    res_last_epoch = qubic_fetch(qubic, epoch-1);

some_epoch = 17;
res_extern = qubic_fetch(my_external_qubic, some_epoch);

The result will be null in case no quorum was reached. Since null behaves as false in conditions, you can find the last existent result like this:

e = epoch;

while(!result) {
    result = qubic_fetch(qubic, e);

    'last result': result,
    'age': epoch-e