2019-09-27 17:58:08 +00:00
|
|
|
# `embark-snark`
|
2019-09-12 23:55:36 +00:00
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
> Snark plugin for Embark
|
2019-09-12 23:55:36 +00:00
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
Compiles circom circuits and generate solidity proofs in an Embark DApp.
|
|
|
|
|
|
|
|
## Installation
|
2019-09-12 23:55:36 +00:00
|
|
|
|
|
|
|
In your embark dapp directory:
|
2019-09-27 17:58:08 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
npm install embark-snark --save
|
|
|
|
```
|
|
|
|
|
|
|
|
Then add embark-snark to the plugins section in `embark.json`:
|
|
|
|
|
|
|
|
```json
|
|
|
|
"plugins": {
|
|
|
|
"embark-snark": {
|
|
|
|
"circuits": ["app/circuits/**"],
|
|
|
|
"inputs": {
|
|
|
|
"multiplier": {
|
|
|
|
"a": 3,
|
|
|
|
"b": 11
|
2019-09-12 23:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-27 17:58:08 +00:00
|
|
|
}
|
2019-09-12 23:55:36 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
You can defined where your circuits will be and what are the inputs.
|
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
Now you can create your first circuits, for example,
|
|
|
|
`app/circuits/multiplier.circom`:
|
2019-09-12 23:55:36 +00:00
|
|
|
|
|
|
|
```
|
2019-09-27 17:58:08 +00:00
|
|
|
template Multiplier() {
|
|
|
|
signal private input a;
|
|
|
|
signal private input b;
|
|
|
|
signal output c; c <== a*b;
|
|
|
|
}
|
2019-09-12 23:55:36 +00:00
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
component main = Multiplier();
|
2019-09-12 23:55:36 +00:00
|
|
|
```
|
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
Embark will now compile the circuits and generate a solidity contracts to
|
|
|
|
verify the proof as well as deploy it.
|
2019-09-12 23:55:36 +00:00
|
|
|
|
2019-09-27 17:58:08 +00:00
|
|
|
## Requirements
|
2019-09-12 23:55:36 +00:00
|
|
|
|
|
|
|
- Embark 5.0.0-alpha.0 or later
|
2019-09-27 17:58:08 +00:00
|
|
|
|
2020-01-19 20:19:30 +00:00
|
|
|
Visit [framework.embarklabs.io](https://framework.embarklabs.io/) to get started with
|
2020-01-16 19:37:59 +00:00
|
|
|
[Embark](https://github.com/embarklabs/embark).
|