create-leo-app 0.7.0 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/template-extension/README.md +0 -4
- package/template-nextjs-ts/README.md +0 -19
- package/template-node/README.md +0 -5
- package/template-node-ts/README.md +0 -5
- package/template-offline-public-transaction-ts/README.md +0 -52
- package/template-react-leo/README.md +0 -90
- package/template-react-managed-worker/README.md +0 -8
- package/template-react-ts/README.md +0 -90
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
This is a [Next.js](https://nextjs.org/) example project showing Aleo
|
|
2
|
-
integration via Web Workers.
|
|
3
|
-
|
|
4
|
-
This template is based off the default TypeScript configuration from
|
|
5
|
-
[`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app)
|
|
6
|
-
|
|
7
|
-
## Getting Started
|
|
8
|
-
|
|
9
|
-
First, run the development server:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
yarn dev
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the
|
|
16
|
-
result.
|
|
17
|
-
|
|
18
|
-
You can start editing the page by modifying `app/page.tsx`. The page
|
|
19
|
-
auto-updates as you edit the file.
|
package/template-node/README.md
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Offline Transaction Builder
|
|
2
|
-
|
|
3
|
-
## 1. Overview
|
|
4
|
-
### 1.1 Proving Keys for Zero Knowledge Function Execution
|
|
5
|
-
To achieve zero knowledge execution, all Aleo functions require a `ProvingKey` and `VerifyingKey` in order to build a
|
|
6
|
-
zero knowledge ZkSnark proof of execution. If a user does not possess these keys for a function, they are normally
|
|
7
|
-
downloaded from the internet when the function is called.
|
|
8
|
-
|
|
9
|
-
### 1.2 Key Providers
|
|
10
|
-
They `KeyProvider` interface is designed to allow users to provide their own implementations for providing key material
|
|
11
|
-
to Aleo function executions.
|
|
12
|
-
|
|
13
|
-
### 1.3 Building Transactions Offline
|
|
14
|
-
|
|
15
|
-
The `OfflineKeyProvider` enables Transaction Building without connection to the internet.
|
|
16
|
-
|
|
17
|
-
The `OfflineKeyProvider` and `OfflineSearchParams` are concrete implementations of the `KeyProvider` and `KeySearchParams`
|
|
18
|
-
interfaces. They are designed to fetch proving key material for Aleo functions from a local machine instead of contacting
|
|
19
|
-
the internet for it. This provides a way to build Aleo execution transactions without being connected to the internet.
|
|
20
|
-
|
|
21
|
-
This pathway is suitable for use-cases such as hardware wallets or air-gapped machines used
|
|
22
|
-
for building secure transactions.
|
|
23
|
-
|
|
24
|
-
### 1.4 Assumptions
|
|
25
|
-
|
|
26
|
-
The key material in this example is assumed to be pre-downloaded onto the machine performing the
|
|
27
|
-
construction of the offline transaction.
|
|
28
|
-
|
|
29
|
-
## 2. Usage
|
|
30
|
-
|
|
31
|
-
### 2.1 Pre-Download the Keys
|
|
32
|
-
First run this command online to download the key material to disk:
|
|
33
|
-
|
|
34
|
-
`npm start`
|
|
35
|
-
|
|
36
|
-
Once this command is run, all proving keys for the `transfer_public`, `bond_public`, `unbond_public`, and
|
|
37
|
-
`claim_unbond_public` functions will be downloaded to the `./keys` folder. The machine can then be disconnected from
|
|
38
|
-
the internet and the `OfflineKeyProvider` will search this directory for the function proving keys when building the
|
|
39
|
-
transaction instead of connecting to the internet. Alternatively you can skip the online step entirely by adding the proving key creating this directory manually and
|
|
40
|
-
adding the key material yourself.
|
|
41
|
-
|
|
42
|
-
### 2.2 Build the Transaction Offline
|
|
43
|
-
|
|
44
|
-
Once the key material is downloaded, turn off your internet connection and run the following command:
|
|
45
|
-
|
|
46
|
-
`npm start`
|
|
47
|
-
|
|
48
|
-
You should see the transactions being built and the resulting transaction IDs printed to the console.
|
|
49
|
-
|
|
50
|
-
## 3. Notes
|
|
51
|
-
|
|
52
|
-
Node.js 20+ is recommended for best performance.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# React + Aleo + Leo
|
|
2
|
-
|
|
3
|
-
[](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react-leo)
|
|
4
|
-
|
|
5
|
-
This template provides a minimal setup to get React and Aleo working in Vite
|
|
6
|
-
with HMR and some ESLint rules.
|
|
7
|
-
|
|
8
|
-
This template includes a Leo program that is loaded by the web app located in
|
|
9
|
-
the `helloworld` directory.
|
|
10
|
-
|
|
11
|
-
Note: Webpack is currently used for production builds due to a
|
|
12
|
-
[bug](https://github.com/vitejs/vite/issues/13367) with Vite related to nested
|
|
13
|
-
workers.
|
|
14
|
-
|
|
15
|
-
### Start in development mode
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Your app should be running on http://localhost:5173/
|
|
22
|
-
|
|
23
|
-
### Build Leo program
|
|
24
|
-
|
|
25
|
-
1. Copy the `helloworld/.env.example` to `helloworld/.env` (this will be ignored
|
|
26
|
-
by Git):
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
cd helloworld
|
|
30
|
-
cp .env.example .env
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
2. Replace `PRIVATE_KEY=user1PrivateKey` in the `.env` with your own key (you
|
|
34
|
-
can use an existing one or generate your own at https://provable.tools/account)
|
|
35
|
-
|
|
36
|
-
3. Follow instructions to install Leo here: https://github.com/ProvableHQ/leo
|
|
37
|
-
|
|
38
|
-
4. You can edit `helloworld/src/main.leo` and run `leo run` to compile and update the
|
|
39
|
-
Aleo instructions under `build` which are loaded by the web app.
|
|
40
|
-
|
|
41
|
-
## Deploy program from web app
|
|
42
|
-
|
|
43
|
-
> [!WARNING]
|
|
44
|
-
> This is for demonstration purposes or local testing only, in production applications you
|
|
45
|
-
> should avoid building a public facing web app with private key information
|
|
46
|
-
|
|
47
|
-
Information on generating a private key, seeding a wallet with funds, and finding a spendable record can be found here
|
|
48
|
-
if you are unfamiliar: https://developer.aleo.org/testnet/getting_started/deploy_execute_demo
|
|
49
|
-
|
|
50
|
-
Aleo programs deployed require unique names, make sure to edit the program's name to something unique in `helloworld/src/main.leo`, `helloworld/program.json`, rename `helloworld/inputs/helloworld.in` and rebuild.
|
|
51
|
-
|
|
52
|
-
1. In the `worker.js` file modify the privateKey to be an account with available
|
|
53
|
-
funds
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
// Use existing account with funds
|
|
57
|
-
const account = new Account({
|
|
58
|
-
privateKey: "user1PrivateKey",
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
2. (Optional) Provide a fee record manually (located in commented code within `worker.js`)
|
|
63
|
-
|
|
64
|
-
If you do not provide a manual fee record, the SDK will attempt to scan for a record starting at the latest block. A simple way to speed this up would be to make a public transaction to this account right before deploying.
|
|
65
|
-
|
|
66
|
-
3. Run the web app and hit the deploy button
|
|
67
|
-
|
|
68
|
-
## Production deployment
|
|
69
|
-
|
|
70
|
-
### Build
|
|
71
|
-
|
|
72
|
-
`npm run build`
|
|
73
|
-
|
|
74
|
-
Upload `dist` folder to your host of choice.
|
|
75
|
-
|
|
76
|
-
### ⚠️ Header warnings
|
|
77
|
-
|
|
78
|
-
`DOMException: Failed to execute 'postMessage' on 'Worker': SharedArrayBuffer transfer requires self.crossOriginIsolated`
|
|
79
|
-
|
|
80
|
-
If you get a warning similar to this when deploying your application, you need
|
|
81
|
-
to make sure your web server is configured with the following headers:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
Cross-Origin-Opener-Policy: same-origin
|
|
85
|
-
Cross-Origin-Embedder-Policy: require-corp
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
We've included a `_headers` file that works with some web hosts (e.g. Netlify)
|
|
89
|
-
but depending on your host / server setup you may need to configure the headers
|
|
90
|
-
manually.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
# React + Aleo + Managed Worker
|
|
2
|
-
|
|
3
|
-
> [!NOTE]
|
|
4
|
-
> This is an experimental template not recommended for use
|
|
5
|
-
|
|
6
|
-
This template provides a minimal setup to get React and Aleo working in Vite with HMR and some ESLint rules.
|
|
7
|
-
|
|
8
|
-
Note: Webpack is currently used for production builds due to a [bug](https://github.com/vitejs/vite/issues/13367) with Vite related to nested workers.
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# React + Aleo + Leo
|
|
2
|
-
|
|
3
|
-
[](https://stackblitz.com/fork/github/ProvableHQ/sdk/tree/testnet3/create-leo-app/template-react)
|
|
4
|
-
|
|
5
|
-
This template provides a minimal setup to get React and Aleo working in Vite
|
|
6
|
-
with HMR and some ESLint rules.
|
|
7
|
-
|
|
8
|
-
This template includes a Leo program that is loaded by the web app located in
|
|
9
|
-
the `helloworld` directory.
|
|
10
|
-
|
|
11
|
-
Note: Webpack is currently used for production builds due to a
|
|
12
|
-
[bug](https://github.com/vitejs/vite/issues/13367) with Vite related to nested
|
|
13
|
-
workers.
|
|
14
|
-
|
|
15
|
-
### Start in development mode
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm run dev
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
Your app should be running on http://localhost:5173/
|
|
22
|
-
|
|
23
|
-
### Build Leo program
|
|
24
|
-
|
|
25
|
-
1. Copy the `helloworld/.env.example` to `helloworld/.env` (this will be ignored
|
|
26
|
-
by Git):
|
|
27
|
-
|
|
28
|
-
```bash
|
|
29
|
-
cd helloworld
|
|
30
|
-
cp .env.example .env
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
2. Replace `PRIVATE_KEY=user1PrivateKey` in the `.env` with your own key (you
|
|
34
|
-
can use an existing one or generate your own at https://provable.tools/account)
|
|
35
|
-
|
|
36
|
-
3. Follow instructions to install Leo here: https://github.com/ProvableHQ/leo
|
|
37
|
-
|
|
38
|
-
4. You can edit `helloworld/src/main.leo` and run `leo run` to compile and update the
|
|
39
|
-
Aleo instructions under `build` which are loaded by the web app.
|
|
40
|
-
|
|
41
|
-
## Deploy program from web app
|
|
42
|
-
|
|
43
|
-
> [!WARNING]
|
|
44
|
-
> This is for demonstration purposes or local testing only, in production applications you
|
|
45
|
-
> should avoid building a public facing web app with private key information
|
|
46
|
-
|
|
47
|
-
Information on generating a private key, seeding a wallet with funds, and finding a spendable record can be found here
|
|
48
|
-
if you are unfamiliar: https://developer.aleo.org/testnet/getting_started/deploy_execute_demo
|
|
49
|
-
|
|
50
|
-
Aleo programs deployed require unique names, make sure to edit the program's name to something unique in `helloworld/src/main.leo`, `helloworld/program.json`, rename `helloworld/inputs/helloworld.in` and rebuild.
|
|
51
|
-
|
|
52
|
-
1. In the `worker.js` file modify the privateKey to be an account with available
|
|
53
|
-
funds
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
// Use existing account with funds
|
|
57
|
-
const account = new Account({
|
|
58
|
-
privateKey: "user1PrivateKey",
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
2. (Optional) Provide a fee record manually (located in commented code within `worker.js`)
|
|
63
|
-
|
|
64
|
-
If you do not provide a manual fee record, the SDK will attempt to scan for a record starting at the latest block. A simple way to speed this up would be to make a public transaction to this account right before deploying.
|
|
65
|
-
|
|
66
|
-
3. Run the web app and hit the deploy button
|
|
67
|
-
|
|
68
|
-
## Production deployment
|
|
69
|
-
|
|
70
|
-
### Build
|
|
71
|
-
|
|
72
|
-
`npm run build`
|
|
73
|
-
|
|
74
|
-
Upload `dist` folder to your host of choice.
|
|
75
|
-
|
|
76
|
-
### ⚠️ Header warnings
|
|
77
|
-
|
|
78
|
-
`DOMException: Failed to execute 'postMessage' on 'Worker': SharedArrayBuffer transfer requires self.crossOriginIsolated`
|
|
79
|
-
|
|
80
|
-
If you get a warning similar to this when deploying your application, you need
|
|
81
|
-
to make sure your web server is configured with the following headers:
|
|
82
|
-
|
|
83
|
-
```
|
|
84
|
-
Cross-Origin-Opener-Policy: same-origin
|
|
85
|
-
Cross-Origin-Embedder-Policy: require-corp
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
We've included a `_headers` file that works with some web hosts (e.g. Netlify)
|
|
89
|
-
but depending on your host / server setup you may need to configure the headers
|
|
90
|
-
manually.
|