Having informally discussed how Cartesi Compute represents Cartesi Machines on-chain, one can now describe in more details the API for requesting and retrieving computations in Cartesi Compute.
All interactions with the Cartesi Compute infrastructure are done through a single smart contract, conveniently called
CartesiCompute. In this contract, there are only two endpoints that a developer needs to access. These are the functions
getResult, and they are respectively responsible for starting a new computation and obtaining its output.
instantiate call is a little more elaborate, as it needs to specify all the details of the machine, including its hash, maximum running time and metadata about its input drives. This is explained in detail in the next section.
In contrast, the
getResult endpoint is very simple: in a typical situation it returns the output of the computation. Here, "output of the computation" refers to the contents of the output drive inside the Linux machine when it halted.
In exceptional cases, the
getResult function can return error codes, for example when one of the involved parties misbehaves and is proved wrong by the dispute resolution that followed.