Skip to content

Commit c14a9c2

Browse files
committed
docs: how to run example
1 parent a37d7ef commit c14a9c2

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed

examples/circom/.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
ETH_RPC_URL=<RPC_URL>
2+
# Make sure it has founds on Aligned
3+
PRIVATE_KEY=<PRIVATE_KEY>
4+
# Deploy the contract with make deploy_contract_devnet
5+
FIBONACCI_CONTRACT_ADDRESS=<FIBONACCI_CONTRACT_ADDRESS>
6+
NETWORK=<devnet|holesky|holeksy-stage|mainnet>

examples/circom/README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,77 @@ A Rust program is used to:
3333
- [circom compiler](https://docs.circom.io/)
3434

3535
## How to run it
36+
37+
1. Generate the trusted setup:
38+
39+
```shell
40+
make generate_circom_groth16_bn256_setup
41+
```
42+
43+
This command will output the vk commitment like this:
44+
45+
```shell
46+
VK COMMITMENT IS: `0xd8aeedbdfc90bfc0f61d81efdd23bcf119d7825f74d2af7071fee8fa144a3cb1`
47+
```
48+
49+
2. Fill the `.env` variables in `contracts/.env`
50+
51+
Follow the `contracts/.env.example`.
52+
53+
3. Deploy the contract
54+
55+
```shell
56+
make deploy_contract
57+
```
58+
59+
4. Fill the program env variable:
60+
61+
Follow the `contracts/.env.example`.
62+
63+
5. Run the program:
64+
65+
```shell
66+
make run
67+
```
68+
69+
## How to run it locally
70+
71+
Set up all the components of aligned locally following the [aligned setup guide](../../docs/3_guides/6_setup_aligned.md).
72+
73+
1. Generate the trusted setup:
74+
75+
```shell
76+
make generate_circom_groth16_bn256_setup
77+
```
78+
79+
This command will output the vk commitment like this:
80+
81+
```shell
82+
VK COMMITMENT IS: `0xd8aeedbdfc90bfc0f61d81efdd23bcf119d7825f74d2af7071fee8fa144a3cb1`
83+
```
84+
85+
2. Complete the `VK_COMMITMENT` variables in `contracts/.env.example`
86+
87+
3. Deploy the contract
88+
89+
```shell
90+
make deploy_contract_devnet
91+
```
92+
93+
This command will output the contract address like this:
94+
95+
```shell
96+
##### anvil-hardhat
97+
✅ [Success] Hash: 0x37679e098b58e952f3e4ec7f228f6a2b95d62608bcaa54585d1be2ef71ddc9ff
98+
Contract Address: 0xDC11f7E700A4c898AE5CAddB1082cFfa76512aDD
99+
Block: 2001
100+
Paid: 0.000000000005023288 ETH (627911 gas * 0.000000008 gwei)
101+
```
102+
103+
4. Complete the `FIBONACCI_CONTRACT_ADDRESS` variable in the program env at `.env.devnet`:
104+
105+
5. Run the program:
106+
107+
```shell
108+
make run_devnet
109+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
RPC_URL=<RPC_URL>
2+
# Make sure you have enough funds to pay for the deployment
3+
PRIVATE_KEY=<YOUR_PRIVATE_KEY>
4+
ALIGNED_SERVICE_MANAGER_ADDRESS=<ALIGNED_SERVICE_MANAGER_ADDRESS>
5+
PAYMENT_SERVICE_ADDRESS=<PAYMENT_SERVICE_ADDRESS>
6+
# generate it by setting up the circuit with make generate_circom_groth16_bn256_setup
7+
VK_COMMITMENT=<THE_GENERATED_VK_COMMITMENT>

0 commit comments

Comments
 (0)