![](https://private-user-images.githubusercontent.com/26088946/259524771-2b13f312-ca96-44ae-aa04-b0db9471aadb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU0Mzg3MzAsIm5iZiI6MTcyNTQzODQzMCwicGF0aCI6Ii8yNjA4ODk0Ni8yNTk1MjQ3NzEtMmIxM2YzMTItY2E5Ni00NGFlLWFhMDQtYjBkYjk0NzFhYWRiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA0VDA4MjcxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTcwYzM0MmQ5MTg5YTA5ODE4NTMzZGYxZGI2OWE5NWNmMWRjZmIzY2JkZjZmNjZhOWRhYmU3MTFhZjY0Yjg5NmMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.iQppIzf0HuMur19d8WRmx-___tNy47-u4_uKnWZoaNM)
Warning
This project is still under active development, plz DO NOT use it in production.
The Zink project mainly provides a singlepass compiler zinkc
which compiles
WASM to EVM bytecode, the source code of your smart contract could be any language you
like!
flowchart LR
R{{Rust}} --> W(WebAssembly)
O[...] --> W
W --> Z{Zink Compiler}
Z --> V[(EVM)]
Here we highly recommend you to choose rust
as the language of your smart contracts
which will unlock all of the following features:
-
Safe:
rustc
is watching you! Furthermore, after compiling your rust code to WASM,zinkc
will precompute all of the stack and memory usage in your contracts to ensure they are safe in EVM bytecode as well! -
High Performance: The optimizations are provided by the three of
rustc
,wasm-opt
andzinkc
, your contracts will have the smallest size with strong performance in EVM bytecode at the end! -
Compatible: All of the
no_std
libraries in rust are your libraries, you can use your solidity contracts as part of your zink contracts and your zink contracts as part of your solidity contracts :) -
Easy Debugging: Developing your smart contracts with only one programming language! zink will provide everything you need for developing your contracts officially based on the stable projects in rust like the
foundry
tools.
Run cargo install zinkup
to install the toolchain!
fib(n) | Zink | Solidity@0.8.21 |
---|---|---|
0 | 110 | 614 |
1 | 110 | 614 |
2 | 262 | 1322 |
3 | 414 | 2030 |
4 | 718 | 3446 |
5 | 1174 | 5570 |
/// Calculates the nth fibonacci number using recursion.
#[no_mangle]
pub extern "C" fn recursion(n: usize) -> usize {
if n < 2 {
n
} else {
recursion(n - 1) + recursion(n - 2)
}
}
As an example for the benchmark, calculating fibonacci sequence with recursion, missed
vyper because it doesn't support recursion...Zink is 5x fast on this, but it is mainly
caused by our current implementation is not completed yet ( missing logic to adapt to more
situations ), let's keep tuned for v0.3.0
.
GPL-3.0-only