Registration of Smart Contracts
This functionality is in development
Conceptually all smart contracts exist in Coinweb. Or vice versa, the Coinweb VM
does not have a notion of whether a smart contract exists or not. When the
Coinweb VM encounters a call operation Call 0x1234 ...
, it understands that
the operation references a smart contract identity. The smart contract id is a
commitment, or a hash, of the smart contract. Whether a contract is found by the
provided identity is subject to the fact whether the contract was previously
registered (or published) in Coinweb.
In the context of Coinweb, "registration" of a smart contract can simplistically
be thought of as storing the smart contract in Coinweb by providing a StoreOp
or in other words providing a way for the Coinweb VM to load a smart contract
from the database.
For a developer this is not an actual restriction and it is possible to come up with individual ways of "loading" smart contracts. For example, one can create a smart contract that creates other smart contracts and then calls them.
However, if you want to call a typical smart contract where the code is stored somewhere in claims, the standard convention to name such a smart contract is referred to as the self-registration convention.
Self Registration
The self-registration
convention describes a process in which a smart contract
stores (=registers) a claim issued by itself that contains the required
information for someone to reconstruct the
virtual file system (VFS)
that is required by the smart contract in order to be executed.
The self-registration process is as well initiated by a CallOp
, but with
additionally added StoreOps
. In order to self-register the transaction must
provide some presets which indicate its intention. There is a SDK called
self-register
which
is described in detail here.