Walkthrough Question


In " Secret Auction Smart Contracts With Enigma: A Walkthrough", the writer mentions about the callable and callback functions.

How are functions getHighestBidder and updateWinner assigned as the callable and callback functions?

Which line(s) of code submits the task to execute getHighestBidder() to the Enigma network?


Hi @EnigmaamginE,

Great questions! This Secret Auctions post demonstrates how you can write secret auction smart contracts, but in order to assign the callable/callback functions and execute the tasks, there needs to be a JS portion (not presented in this guide at the moment, sorry for any confusion!). I encourage you to look at the recent Getting Started Guide (https://blog.enigma.co/getting-started-with-the-enigma-protocol-a-complete-developers-guide-170b7dfa5c0f) as a precursor to the secret auctions post you are referencing here as it should make things a lot clearer!

Regarding the first question:

Nothing in the secret contract itself assigns these two functions as the callable and callback functions per se, those are assigned from the front end/JS side. However, I just want to point out some notable features of these functions that make them interesting compared to some of the other functions in the contract. The callable function is a pure function, since it never reads or writes to contract state, only from the arguments passed to it. The callback function has the onlyEnigma modifier specified and will modify contract state. Take special note of the relationship between the two, where the output arguments of the callable directly map to the input arguments for the callback. While the signatures of these functions are unique in the contract, these functions are only “assigned” as the callable and callback functions from the JS side. The Getting Started Guide, in particular this gist (https://gist.github.com/apalepu23/b6f7623c2136bbb9461c69a4f731e060#file-millionairesproblemwrapper-js), demonstrates how you can actually specify these contract functions as the callable and callback (lines 9-10).

Regarding the second question:

Once again, the secret contract code itself doesn’t include the submission of the task, but that is achieved via the JS code you write to complement your secret contracts. The Getting Started Guide, or more specifically lines 68-109 of the same gist from above demonstrates how you call the enigma task, using the callable and callable functions you’ve specified above.

Hope this helps, happy to clarify things any further if need be :slight_smile:



Thank you for the very clear and amazing explanation! As a follow up I am working through the linked Getting Started guide that you have published.

However I have encountered my first problem at the step where we edit App.js of the React app. If I were to use your App.js code straight from the gist, this will result in the error

Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object. You likely forgot to export your component from the file it’s defined in, or you might have mixed up default and named imports. Check the render method of App.

Hope you can provide some insight into this!


looking into this, will get back to you asap!!