-
Notifications
You must be signed in to change notification settings - Fork 615
feat(docs): Docs on shared mutable, contract classes, and injecting data #12043
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 10 commits
6a44cf3
4d5ba80
37eb236
5fcf843
d269645
2718a03
7f14cad
e34a65d
df18b00
ba9bb1f
8eb2f12
6721d2b
92784c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| title: Contract Classes | ||
| tags: [contracts, protocol] | ||
| sidebar_position: 0 | ||
| --- | ||
|
|
||
| Aztec defines a difference between contract *classes* and contract *instances*. This is different from Ethereum, where every contract's bytecode is deployed to the network and has a unique address. | ||
|
|
||
| ## Contract classes | ||
|
|
||
| A contract class defines the contract's bytecode and is uniquely identified by a hash. A contract class doesn't have its own storage or state, but is more of a template that outlines the contract's code. | ||
|
|
||
| ## Contract instances | ||
|
|
||
| A contract instance is a deployed version of a contract class with its own storage and state. Each instance operates independently. This separation allows for multiple deployments of the same contract logic without interference between instances. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| --- | ||
| title: Injecting Data | ||
| tags: [functions, oracles, capsules] | ||
| --- | ||
|
|
||
| There are multiple ways to inject data into smart contracts. | ||
|
|
||
| 1. **Oracles** - fetching data from the outside world | ||
| 2. **Authwits (Authentication Witnesses)** - authorizing an arbitrary action (or piece of data) | ||
| 3. **Capsules** - local data storage in the PXE | ||
|
|
||
| ## Oracles | ||
|
|
||
| In the world of EVM, you can read data directly from storage. However, when we are working with circuits for private execution, this becomes more tricky as you cannot just read the storage directly from your state tree, because there are only commitments (e.g. hashes) there. The pre-images (content) of your commitments need to be provided to the function to prove that you actually allowed to modify them. | ||
|
|
||
| If we fetch the notes using an oracle call, we can keep the function signature independent of the underlying data and make it easier to use. See [oracles](./oracles.md) for more information. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With this statement, it isn't clear to me what it means that "we can keep the function signature independent of the underlying data". This concept isn't only relevant for notes, right? I know it's liisted on the linked page, but it might provide clarity to list what things oracles are used for so readers get a sense (e.g. fetch notes from pxe, cross-chain messages, private logs). Also, noticing that this line is missing a word (maybe "data"?) |
||
|
|
||
| ## Authentication Witnesses (authwit) | ||
|
|
||
| The same mechanism used in oracles is also used for the Authentication Witnesses that allow us to have a single function signature for any wallet implementation. See [AuthWit](../../concepts/advanced/authwit.md) for more information on this. | ||
|
|
||
| ## Capsules | ||
|
|
||
| Capsules are used to store data in the PXE and inject this data into smart contracts. They can be useful for arbitrary data that does not have a dedicated oracle. | ||
|
catmcgee marked this conversation as resolved.
Outdated
|
||
|
|
||
| You can learn more about using capsules in contracts in the [reference docs](../../../developers/reference/smart_contract_reference/aztec-nr/aztec/oracle/capsules.md) | ||
Uh oh!
There was an error while loading. Please reload this page.