-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# Bonsai Solidity Contracts | ||
# Solidity Contracts | ||
|
||
This directory contains the Solidity contract for deploying a [Bonsai] application. | ||
This directory contains the Solidity contract for deploying an application with [RISC Zero] on Ethereum. | ||
There are two primary starter template contracts included. | ||
|
||
<!-- TODO: Change this link once the new repo is live --> | ||
|
||
The Solidity libraries for Bonsai can be found at [github.com/risc0/risc0](https://github.com/risc0/risc0/tree/main/bonsai/ethereum). | ||
|
||
Contracts are built and tested with [forge], which is part of the [Foundry] toolkit. | ||
Tests are defined in the `tests` directory in the root of this template. | ||
|
||
[Foundry]: https://getfoundry.sh/ | ||
[forge]: https://github.com/foundry-rs/foundry#forge | ||
[Bonsai]: https://dev.bonsai.xyz | ||
[offloading the computation]: https://twitter.com/RiscZero/status/1677316664772132864 | ||
[RISC Zero]: https://risczero.com | ||
[guest]: https://github.com/risc0/bonsai-foundry-template/tree/main/methods/guest/src/bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
## zkVM Methods | ||
# zkVM Methods | ||
|
||
This directory contains the [zkVM] portion of your [Bonsai] application. | ||
This directory contains the [zkVM] portion of your [RISC Zero] application. | ||
This is where you will define one or more [guest programs] to act as a coprocessor to your [on-chain logic]. | ||
|
||
> In typical use cases, the only code in this directory that you will need to edit is inside [`guest/src/bin`]. | ||
> In typical use cases, the only code in this directory that you will need to edit is inside [`guest/src/bin`]. | ||
[zkVM]: https://dev.risczero.com/zkvm | ||
[RISC Zero]: https://www.risczero.com/ | ||
[guest programs]: https://dev.risczero.com/terminology#guest-program | ||
[on-chain logic]: ../contracts/ | ||
[`guest/src/bin`]: ./guest/src/bin/ | ||
|
||
### Writing Guest Code | ||
To learn to write code for the zkVM, we recommend [Guest Code 101]. | ||
|
||
To learn to write code for the zkVM, we recommend [Guest Code 101]. | ||
|
||
Examples of what you can do in the guest can be found in the [RISC Zero examples]. | ||
|
||
[Guest Code 101]: https://dev.risczero.com/zkvm/developer-guide/guest-code-101 | ||
[RISC Zero examples]: https://github.com/risc0/tree/v0.18.0/examples | ||
|
||
### From Guest Code to Binary File | ||
|
||
Code in the `methods/guest` directory will be compiled into one or more [RISC-V] binaries. | ||
Code in the `methods/guest` directory will be compiled into one or more binaries. | ||
|
||
Build configuration for the methods is included in `methods/build.rs`. | ||
|
||
Each will have a corresponding image ID, which is a hash identifying the program. | ||
|
||
### Uploading Binary to Bonsai | ||
|
||
<!-- TODO: This should have practical instructions on how to actually upload to Bonsai --> | ||
|
||
When [deploying] your application, you will upload your binary to Bonsai where the guest will run when requested. | ||
The image ID will be included in the deployment of the smart contracts to reference your guest program living in Bonsai. | ||
|
||
[deploying]: ../deployment-guide | ||
[RISC Zero examples]: https://github.com/risc0/tree/v0.18.0/examples | ||
[Guest Code 101]: https://dev.risczero.com/zkvm/developer-guide/guest-code-101 | ||
[on-chain logic]: ../contracts/readme | ||
[`guest/src/bin`]: ./guest/src/bin/ | ||
[guest program]: https://dev.risczero.com/terminology#guest-program | ||
[guest programs]: https://dev.risczero.com/terminology#guest-program | ||
[developer documentation]: https://dev.risczero.com | ||
[zkVM]: https://dev.risczero.com/zkvm | ||
[Bonsai]: https://dev.risczero.com/bonsai/ |