Define a Resource
In this page, we're defining a resource object and giving it a custom label, "Hello World!".
Defining the Resource Object
Let's start by creating a new file that will contain our resource definition.
Next, we preface our HelloWorld.juvix
file with the standard module
and import
s.
We now start defining our resource which we call mkHelloWorldResource
by giving it values for logic
, label
, value
, quantity
, ephemeral
, nonce
, randSeed
and nullifierKeyCommitment
. You can find more detailed information on the resource and its parameters in Resources.
Let's start by putting default values for logic
and value
and pass the message
parameter to label
.
In the context of our HelloWorld application, this implies that we're passing the "Hello World!" message
when we're creating the resource. This allows us to set any string, like "Hello Anomages!". In addition to that we assign true
to the logic
, implying that this resource will not have any logic constraints. Similarly, we assign zero for value
which is an arbitrary default.
Let's continue adding missing parameters:
In the above code, we
assign
quantity
of 1pass function parameter
nonce
pass function parameter
ephemeral
assign default parameter 0 to
randSeed
assign default parameter 0 to
nullifierKeyCommitment
These default values are artifacts of the current devnet implementation.
Next, we're going to build the transaction function which will be used to initialize the resource object via transaction we manually prepare with our code.
Last updated