SideVM is the core extension of Phat Contract. Despite the advantages above, the raw Phat Contract still has limitations compared with current Web2 backend programs:
- Lifecycle limitation. The Phat Contract execution is triggered when users send on-chain transactions or off-chain queries to it, and the instance is destroyed when the execution finishes. This makes it impossible to do async requests or keep a long-live network connection;
- Program environment limitation. The Phat Contract inherits the limitations of Ink! and only supports
no_stdcrates. This also limits the resources a contract can use (e.g. listening to a port for connections).
SideVM is proposed to tackle these limitations. It runs in a different runtime. This means it can continuously execute, support
stdlibrary, and listen to the port.
The SideVM support is already equipped to our public testnet. But it requires manual authorization to your contract to enable it to call the
start_sidevm()function. Contact us is the
#devchannel in our Discord server to get support.
Also, you can run your local testnet following our tutorial and then do the testing.
makeunder the folder and it will give you
- 1.SideVM program
- 2.Phat contract under
SidevmCode, and drag your
Submit the transaction and you shall see its success.
Interact with Phat UI
Uploadand drag your
target/ink/start_sidevm.contract. Choose the default constructor and Cluster
Submit. You should see something like
Start SideVM with Query
You can directly interact with your contract with Contract UI.
From the Worker log, we can see
We do not have many documents on SideVM yet, feel free to ask us directly.