Deploy spin-operator
spin-operator consists of an Express.js server that accepts player submission and then relay the submission to the blockchain.
Fill in the environments
Create a new file .env
and use .env.template
as example to fill it in.
Reference provides details on filling the environments: spin-operator reference
Configure wallets
A note about transaction nonce on EVM
The operator write to the chain in two most common ways. settle
a submission and submit
a submission. In order to handle concurrent requests from many different players, the operator cannot reliably rely on a single wallet to submit all the transactions on-chain. This is due to each on-chain transaction needs to have an unique nonce to prevent replay attacks. Thus, a good practice is to confirm a transaction is mined, then submit the second one.
One way to scale the operator's concurrency is to let the operator own multiple wallets.
Create a file name wallets.json
wallets.json
should expect a list of EVM addresses and their corresponding private keys like so:
Make sure all of the wallets has enough ETH to pay for gas fee.
Run spin-operator
There're few options running a spin-operator. To quickly run an instance, we recommend direly run the image from docker-hub.
Run from source
Prerequisite
Node.js >= 20
Build from source
Clone the OPZK repo.
Install the NPM packages
Fill in
.env
following instruction from above
Run the server
Run from docker
Prerequisite
Docker version > 25.0.0
Build the docker image
We already build a latest image of the spin-operator.
The image is under docker pull zkspin/spin-operator:latest
Run the server
Make sure you have .env
and wallets.json
ready
Add the docker run option --network host
if your chain RPC is on localhost
Last updated