Skip to content

An example repo of how to use/create a rollup using gnark and its rollup example.

License

Notifications You must be signed in to change notification settings

Engeloid/gnark-rollup-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rollup_TXs

Facilitation of rollup transactions with basic zk-rollups by gnark.

Setup

Run solc locally using docker to generate solidity contract

First bind local path, so that docker container has the repo to work with the files.

docker run -v .\:/sources ethereum/solc:stable -o /sources/bindings --abi --bin /sources/contracts/Rollup.sol --overwrite 

Create Contract binding

Move the abi and .bin files to bindings/ and then to create the contract binding:

abigen --abi .\bindings\Rollup.abi --pkg main --type Rollup --out .\src\Rollup.go

To then inject the contract binding Verifier.go for deployment:

abigen --abi .\bindings\Rollup.abi --pkg main --type Rollup --out .\src\Rollup.go --bin .\bindings\Rollup.bin

When having depencies, use --combined-json

docker run -v ${PWD}:/sources ethereum/solc:stable --combined-json abi,bin,bin-runtime /sources/contracts/Rollup.sol -o /sources/bindings/RollupCombined.json
abigen --abi .\bindings\Rollup.abi --pkg main --type Rollup --out .\src\Rollup.go
abigen --combined-json ./bindings/RollupCombined.json/combined.json --pkg main --type Rollup --out ./src/Rollup.go

On laptop abigen:

C:\Users\docla\go\pkg\mod\github.com\ethereum\g[email protected]\cmd\abigen

Truffle and Ganache for contract delpoyment

Deploy all contracts from scratch

truffle migrate --reset

Run Go main and all other necessary go scripts

go run .\src\.

Sol file updates

.sol files should be UTF-8, not UTF-8 with BOM!

The automaticly created gnark_verifier.sol comes with some issues:

  • the error keyword was introduced in solidity v0.8.4 therefore pragma solidity ^0.8.4; is needed
  • memory-safe keyword does not exist for the assembly instructions, i.e., it needs to be removed

About

An example repo of how to use/create a rollup using gnark and its rollup example.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published