Invoice, Review & Payment

The JSON schemas for render offer documents and render request documents on this page are still under development and subject to change.

After completion of a render job, the user has 24 to 72 h (not decided yet) to evaluate the render result and the render invoice. After this period, render nodes can call the smart contract to get their render invoices paid without the confirmation of the client node.

Render Invoice

After successful execution of the render job, each render node calculates the render time from the consensus times of its submitted start and end transactions in the render job topic. Based on its own render offer document and the calculated render times, the render node calculates its final costs (may include local VAT, etc.). The node creates a render invoice in form of a JSON document and writes all relevant information of the rendering process (e.g., CID of the Blender file, Blenders render metrics, CIDs of the render results, costs, etc.) to it and stores it on the IPFS.

// JSON schema for the render invoice
// NOTE: This is not a final version of the schema! This is still under development!
render_invoice = {
    ID: int                      // a unique ID of the render invoice
    blend_file: CID              // CID of the Blender file
    render_metric: {             // the render metrics of the node's rendering process
        render_time: int
    }
    render_result_review: CIDs  // CIDs of the watermarked render results for review
    render_costs: hbar          // costs of the rendering process in hbar
    ...
    
}

Finally, it sends a consensus submit message with the CID of the render invoice in the memo field to the render job's HCS topic and calls the Renderhive Smart Contract to notify it about the end of the rendering process. The smart contract updates the status variables of the node and calculates a new render power based on the render time of the node and the render work it conducted in this job. That way, over time, the real render power of the node is determined by real world values instead of benchmark renders.

While waiting for the payment, the render node can now continue to process other render jobs, but it keeps subscribed to the render job topic until the job is paid and the final result is delivered.

Due to Hedera’s fast consensus mechanism, a consensus transaction usually takes not more than five seconds. That guarantees that render start and render end messages accurately mark the render time a render node required. Furthermore, since these messages are stored in an immutable way on the hashgraph, they are also verifiable by everyone.

Result Review

The client node will check for the existence of a HCS topic with the CID of its render request document. It will then request all messages on this topic and download the watermarked render result(s) of all render nodes, decrypt them with its private key (in case they were encrypted), and puts them together to the final render result. Furthermore, the client node downloads the render invoices and verifies that the cost calculations of the render nodes are correct.

The client node user has the opportunity to review the render result within 24 to 72 h (not decided yet) prior to payment. In this process the user of the client node checks if the rendering was performed correctly without render artifacts and if the invoice details of all render nodes are correct. If the client node user accepts the render results and the render invoice, the Renderhive Smart Contract is called and the render job is marked as accepted.

Payments

As soon as a render result is marked as accepted, the smart contract will internally reduce the balance of the client node and increases the balance of the render nodes. Render nodes will get notified and their owners may withdraw the added funds from the smart contract at any time.

Finally, the client node will also send a transaction to delete the render job topic. This will prevent anyone from posting further messages on the topic, but old messages will still be available. The topic deletion will also mark the end of the render job.

Last updated