This repository is a collection of docs and examples to help implement zkSync into Yagna
- Yagna is: An open platform and marketplace for distributed computations
- zkSync is: scaling and privacy engine for Ethereum
Yagna, as a marketplace, would like to use zkSync as a means of value transfer.
The main reasons are:
Compared to other tools investigated:
- set signing key ( how-to )
- monitor incoming payments( how-to - TODO: better way then check balance? )
- withdraw to any(?) mainnet address( how-to )
- set signing key( how-to )
- deposit funds to zkSync contract( how-to )
- send payments when computations are accepted( how-to )
- withdraw to any(?) mainnet address( how-to )
- Account unlocked -> check if signing key is set -> set signing key
- Requestor
- Before allocation is created, funds need to be deposited in zkSync contract
- Make allocation required for posting demand, options for allowance:
- Can be a "virtual" safe only inside Yagna ( current )
- Can be a safe inside the zkSync contract ( nice to have )
- Can be the funds deposited in zkSync ( not feasable )
- Send zkSync transaction on each debit note and invoice
- Provider
- Withdraw funds to any(?) mainnet ethereum wallet
- out of the box only own wallet seems possible ( TODO check )
- transaction fees will be payed from the withdrawn funds
- Example: withdraw 10$ in value, pay 0.05$ to the network, receive 9.95$ in ethereum wallet
- Withdraw funds to any(?) mainnet ethereum wallet
zkSync exists of the following components:
- Client library
- Contracts
- Provider
The client library is the gateway between yagna and the zkSync network. It is currently written in JavaScript, but the Rust version is on the roadmap ( At GF or ML ) The library providers easy to use methods to call the Provider.
The contracts are used to produce the blocks and govern the network. The Main contract handles new blocks, deposits/withdraws and exists The Gov contract handles what ERC20 tokens are available and management of validators
The provider is a server that serves the API's for the clients to use. It also serves as a back-bone for the zkSync network: collecting transactions, creating and validation of blocks. In the best case scenario we could run these Providers on the Golem network. But for now we can start with ML's infrastructure and upgrade to GF infrastructure when required.
- Describe happy user flow abstract and from yagna
- Describe
zkSync
components and their applicability to yagna - Write examples to use the javascript library like yagna would use it
- Write rust client library for zkSync
- Write examples to run a full local dev environment
- Describe worse case scenario exit strategy
- Decide on what provers we will use ( Matter Labs or Golem Factory)