0G compute network adopts a free marketplace where users and service providers decide the prices of the services through a peer-to-peer fashion. The service provider is free to quote their services, and then users are free to choose the services that are priced appropriately for them to use. The service provider can decide at any point to send the request traces with user’s signature to the smart contract for settlement. Once settlement is done, the corresponding portion of the pre-charged fee can be sent to service provider’s account.
Users and service providers conduct off-chain service transactions, and service providers can consume the request traces generated from each service transaction to settle service fees on-chain and update user balances.
As shown in the figure above, on-chain nodes need to execute all complete state transition processes sequentially, which is often costly. With the introduction of zk:
- Multiple state transition processing can be batched into one init to final state transition.
- On-chain nodes only need to execute the proof verification process, which is often relatively cheap.
For more details on the design and implementation, please see our Design Documentation.
yarn compile
yarn setup
We also provide a more efficient implementation for costy generating proof and calldata operations using Rust language.
cd rust_backend
cargo build --release
# A example on Mac OS, the surfix of library on different OS may be different.
cp target/release/librust_prover.dylib ../build/
yarn start
You can also start service using docker.
# Build image
docker build --target runner -t zk-settlement-runner . 2>&1 | tee build_log.txt
# Run
docker run -d -p 3000:3000 --name prover zk-settlement-runner
You can use the zkSettlement prover agent's functionalities by directly calling the API. For detailed API documentation and usage examples, please refer to our API Documentation.
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License