Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

golemfactory/yagna-zksync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 

Repository files navigation

zkSync in Yagna

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

Introduction

Yagna, as a marketplace, would like to use zkSync as a means of value transfer.

The main reasons are:

Compared to other tools investigated:

  • Native support for ERC20 tokens
  • Quick exit possible ( 10 min ) src
  • Security like the main chain src

Happy user flow ( no yagna )

Provider

  • set signing key ( how-to )
  • monitor incoming payments( how-to - TODO: better way then check balance? )
  • withdraw to any(?) mainnet address( how-to )

Requestor

  • 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 )

Happy user flow with yagna

  • 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

Components

zkSync exists of the following components:

  • Client library
  • Contracts
  • Provider

Client library

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.

Contracts

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

Provider

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.

Steps

  • 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

Remarks

  • Decide on what provers we will use ( Matter Labs or Golem Factory)

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages