This is a simple example of how to calculate a message hash and output the results formatted as a hex string
Using Truebit to encrypt sha256 using bun.js
To get a verified result, we can use Truebit to execute the sha256 task.
The code
You can find the Encrypt sha256 using bun.js example within the folder truebit-nextgen-examples/function-tasks/js/sha256-bunjs
📄 main.js
Try out
We will use the to and our source code. Once the code is finished, we will it to the coordination hub so that everyone who knows the namespace and taskname.
Step 1: Create the sha256 source code
You will find a file called main.js in the root folder
Building the function task
Your function task is ready.
Use the following TaskId for execution or deployment:
js_dde5e0b4faa67253fce5efb6d8b7bc87c0662813f00de78ac6128fdee0db9a96/1.0.0
The function task has been deployed successfully.
The Task <taskName> version <version> was registered successfully in namespace <namespace>
Execute the command against Truebit node to get an instrumented Truebit task
Execute the command against the Truebit node to test our Algorithm.
Last, but not least, Execute the command to deploy our task to the coordination hub, so that anyone with the namespace, taskname and the can execute it.