Deploy the Semaphore protocol on zkSync #365
Replies: 7 comments 8 replies
-
Hi @vplasencia
zkSync is not EVM bytecode compatible, but source-code compatible. This means that you can have the same source code that you'd use in other EVM protocols, but zkSync has its own compilers (zksolc and zkvyper), that generate a different bytecode compatible with zkSync's ZKEVM. You'd need to get the source code of the contract, compile it with
Not sure if I understand this correctly. You could deploy the library first and then reference it by its address in a separate contract.
Are you getting any errors? |
Beta Was this translation helpful? Give feedback.
-
Hey @uF4No! Thank you so much for the answers.
vivian@mbp-de-vivian my-zksync-project % npm run compile
> compile
> hardhat compile
Compiling contracts for zkSync Era with zksolc v1.4.0 and solc v0.8.17
Compiling 1 Solidity file
An unexpected error occurred:
Error: Command failed: /Users/vivian/Library/Caches/hardhat-nodejs/compilers-v2/zksolc/zksolc-v1.4.0 --standard-json --solc /Users/vivian/Library/Caches/hardhat-nodejs/compilers-v2/macosx-amd64/solc-macosx-amd64-v0.8.17+commit.8df45f5f --detect-missing-libraries
/Users/vivian/Library/Caches/hardhat-nodejs/compilers-v2/macosx-amd64/solc-macosx-amd64-v0.8.17+commit.8df45f5f error:
at ChildProcess.exithandler (node:child_process:421:12)
at ChildProcess.emit (node:events:514:28)
at ChildProcess.emit (node:domain:489:12)
at maybeClose (node:internal/child_process:1105:16)
at Socket.<anonymous> (node:internal/child_process:457:11)
at Socket.emit (node:events:514:28)
at Socket.emit (node:domain:489:12)
at Pipe.<anonymous> (node:net:337:12) {
code: 1,
killed: false,
signal: null,
cmd: '/Users/vivian/Library/Caches/hardhat-nodejs/compilers-v2/zksolc/zksolc-v1.4.0 --standard-json --solc /Users/vivian/Library/Caches/hardhat-nodejs/compilers-v2/macosx-amd64/solc-macosx-amd64-v0.8.17+commit.8df45f5f --detect-missing-libraries'
} |
Beta Was this translation helpful? Give feedback.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
-
Hi @vplasencia |
Beta Was this translation helpful? Give feedback.
-
Which compiler are you using?
Which version of Solidity or Vyper?
0.8.4 / 0.8.23
zksolc/zkvyper version?
v1.3.23
Explain the issue
Hello 👋
I'm trying to deploy the Semaphore protocol on zkSync. I'm trying with Semaphore v3 which is the latest stable version and also Semaphore v4 which is the new version.
I have some questions:
To deploy Semaphore v3, it is necessary to get the Poseidon code from a JavaScript library: https://github.com/semaphore-protocol/semaphore/blob/main/packages/hardhat/src/tasks/deploy-semaphore.ts#L59-L73
I'm trying to deploy Poseidon and I get the following error:
Error: The bytecode length in bytes must be divisible by 32!
Here is the code of the script: https://github.com/vplasencia/semaphore-zksync/blob/main/semaphorev3/deploy/poseidon/deploy-poseidon.ts
More info:
This is the Hardhat task to deploy Semaphore v3: https://github.com/semaphore-protocol/semaphore/blob/main/packages/hardhat/src/tasks/deploy-semaphore.ts
After deploying the Poseidon bytecode, it is necessary to link the library, how can I recreate this code: https://github.com/semaphore-protocol/semaphore/blob/main/packages/hardhat/src/tasks/deploy-semaphore.ts#L76-L80
If the code of the library is already there in the
.sol
file, I can deploy the library usingyarn hardhat deploy-zksync:libraries --private-key <PRIVATE_KEY>
and everything should be fine when I want to compile. But what would be the flow when not all the code is in the.sol
file?https://github.com/vimwitch/poseidon-solidity/blob/main/contracts/PoseidonT3.sol
Link to your repo?
https://github.com/vplasencia/semaphore-zksync
Beta Was this translation helpful? Give feedback.
All reactions