@layr-labs/ecloud-sdk 0.0.1-dev.3 → 0.1.0-dev
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/README.md +259 -47
- package/VERSION +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,92 +1,304 @@
|
|
|
1
|
-
# ECloud SDK
|
|
1
|
+
# ECloud SDK and CLI
|
|
2
2
|
|
|
3
|
-
A TypeScript SDK and CLI for deploying and managing applications on
|
|
3
|
+
A TypeScript SDK and CLI for deploying and managing applications on EigenCloud TEE (Trusted Execution Environment). This monorepo provides both programmatic SDK access and a command-line interface for interacting with ecloud's decentralized compute platform.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
ECloud SDK enables developers to:
|
|
7
|
+
ECloud SDK and CLI enables developers to:
|
|
8
8
|
|
|
9
9
|
- Deploy containerized applications to ecloud TEE
|
|
10
10
|
- Manage application lifecycle (start, stop, terminate)
|
|
11
11
|
- Build and push Docker images with encryption
|
|
12
|
-
- Interact with ecloud smart contracts on Ethereum networks
|
|
13
12
|
- Monitor application status and logs
|
|
14
13
|
|
|
15
|
-
##
|
|
14
|
+
## Prerequsites
|
|
15
|
+
* Docker - To package and publish application images ([Download](https://www.docker.com/get-started/))
|
|
16
|
+
* ETH for gas - For deployment transactions
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
## Mainnet Alpha Limitations
|
|
19
|
+
* Not recommended for customer funds - Mainnet Alpha is intended to enable developers to build, test and ship applications. We do not recommend holding significant customer funds at this stage in Mainnet Alpha.
|
|
20
|
+
* Developer is still trusted - Mainnet Alpha does not enable full verifiable and trustless execution. * A later version will ensure developers can not upgrade code maliciously, and liveness guarantees.
|
|
21
|
+
No SLA - Mainnet Alpha does not have SLAs around support, and uptime of infrastructure.
|
|
18
22
|
|
|
19
|
-
### `@layr-labs/ecloud-sdk`
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
## Quick Start
|
|
25
|
+
### Installation
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @layr-labs/ecloud-cli
|
|
29
|
+
```
|
|
24
30
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
- Environment configuration management
|
|
31
|
+
### Initial Setup
|
|
32
|
+
```bash
|
|
33
|
+
# Log in to your Docker registry (required to push images)
|
|
34
|
+
docker login
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
# Log in with an existing private key
|
|
37
|
+
ecloud auth login
|
|
38
|
+
```
|
|
32
39
|
|
|
33
|
-
|
|
40
|
+
**Don't have a private key?** Use `ecloud auth generate --store` instead
|
|
34
41
|
|
|
35
|
-
**
|
|
42
|
+
**Need ETH for gas?** Run `ecloud auth whoami` to see your address. For sepolia, get funds from [Google Cloud](https://cloud.google.com/application/web3/faucet/ethereum/sepolia) or [Alchemy](https://sepoliafaucet.com/)
|
|
36
43
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
44
|
+
### Get a billing account
|
|
45
|
+
This is required to create apps
|
|
46
|
+
```bash
|
|
47
|
+
ecloud billing subscribe
|
|
48
|
+
```
|
|
41
49
|
|
|
42
|
-
|
|
50
|
+
### **Create & Deploy**
|
|
43
51
|
|
|
44
|
-
|
|
52
|
+
```bash
|
|
53
|
+
# Create your app (choose: typescript | python | golang | rust)
|
|
54
|
+
ecloud compute app create my-app typescript
|
|
55
|
+
cd my-app
|
|
45
56
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
# Configure environment variables
|
|
58
|
+
cp .env.example .env
|
|
59
|
+
|
|
60
|
+
# Deploy to TEE
|
|
61
|
+
ecloud compute app deploy
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### **Working with Existing Projects**
|
|
49
65
|
|
|
50
|
-
|
|
66
|
+
Have an existing project? You don't need `ecloud compute app create` - the CLI works with any Docker-based project:
|
|
51
67
|
|
|
52
68
|
```bash
|
|
53
|
-
|
|
69
|
+
# From your existing project directory
|
|
70
|
+
cd my-existing-project
|
|
71
|
+
|
|
72
|
+
# Ensure you have a Dockerfile and .env file
|
|
73
|
+
# The CLI will prompt for these if not found in standard locations
|
|
74
|
+
|
|
75
|
+
# Deploy directly - the CLI will detect your project
|
|
76
|
+
ecloud compute app deploy
|
|
54
77
|
```
|
|
55
78
|
|
|
56
|
-
|
|
79
|
+
**What you need:**
|
|
80
|
+
- **Dockerfile** - Must target `linux/amd64` and run as root user
|
|
81
|
+
- **.env file** - For environment variables (optional but recommended)
|
|
82
|
+
|
|
83
|
+
The CLI will automatically prompt for the Dockerfile and .env paths if they're not in the default locations. This means you can use ecloud with any existing containerized application without restructuring your project.
|
|
84
|
+
|
|
85
|
+
**Need TLS/HTTPS?** Run `ecloud compute app configure tls` to add the necessary configuration files for domain setup with private traffic termination in the TEE.
|
|
86
|
+
|
|
87
|
+
### **View Your App**
|
|
57
88
|
|
|
58
89
|
```bash
|
|
59
|
-
|
|
90
|
+
# View app information and logs
|
|
91
|
+
ecloud compute app info
|
|
92
|
+
ecloud compute app logs
|
|
93
|
+
|
|
94
|
+
# Add --watch (or -w) to continuously poll for live updates
|
|
95
|
+
ecloud compute app info --watch
|
|
96
|
+
ecloud compute app logs --watch
|
|
60
97
|
```
|
|
61
98
|
|
|
62
|
-
|
|
99
|
+
That's it! Your starter app is now running in a TEE with access to a MNEMONIC that only it can access.
|
|
100
|
+
|
|
101
|
+
**Ready to customize?** Edit your application code, update `.env` with any API keys you need, then run `ecloud compute app upgrade my-app` to deploy your changes
|
|
102
|
+
|
|
103
|
+
## Application Environment
|
|
104
|
+
|
|
105
|
+
Your TEE application runs with these capabilities:
|
|
106
|
+
|
|
107
|
+
1. **Secure Execution** - Your code runs in an Intel TDX instance with hardware-level isolation
|
|
108
|
+
2. **Auto-Generated Wallet** - Access a private mnemonic via `process.env.MNEMONIC`
|
|
109
|
+
- Derive wallet accounts using standard libraries (e.g., viem’s `mnemonicToAccount(process.env.MNEMONIC)`)
|
|
110
|
+
- Only your TEE can decrypt and use this mnemonic
|
|
111
|
+
3. **Environment Variables** - All variables from your `.env` file are available in your container
|
|
112
|
+
- Variables with `_PUBLIC` suffix are visible to users for transparency
|
|
113
|
+
- Standard variables remain private and encrypted within the TEE
|
|
114
|
+
4. **Onchain Management** - Your app's lifecycle is controlled via Ethereum smart contracts
|
|
115
|
+
|
|
116
|
+
### Working with Your App
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# List all your apps
|
|
120
|
+
ecloud compute app list
|
|
121
|
+
|
|
122
|
+
# Stop/start your app
|
|
123
|
+
ecloud compute app stop my-app
|
|
124
|
+
ecloud compute app start my-app
|
|
125
|
+
|
|
126
|
+
# Terminate your app
|
|
127
|
+
ecloud compute app terminate my-app
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Authentication
|
|
131
|
+
|
|
132
|
+
Ecloud CLI needs a private key to sign transactions. Three options:
|
|
133
|
+
|
|
134
|
+
### 1. OS Keyring (Recommended)
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
ecloud auth generate --store # Generate new key and store it
|
|
138
|
+
ecloud auth login # Store an existing key securely
|
|
139
|
+
ecloud auth whoami # Check authentication
|
|
140
|
+
ecloud auth logout # Remove key
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 2. Environment Variable
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
export ECLOUD_PRIVATE_KEY=0x1234...
|
|
147
|
+
ecloud compute app deploy
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### 3. Command Flag
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
ecloud compute app deploy --private-key 0x1234...
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Priority:** Flag → Environment → Keyring
|
|
157
|
+
|
|
158
|
+
## TLS/HTTPS Setup
|
|
159
|
+
|
|
160
|
+
### Enable TLS
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
# Add TLS configuration to your project
|
|
164
|
+
ecloud compute app configure tls
|
|
63
165
|
|
|
64
|
-
|
|
166
|
+
# Add variables to .env
|
|
167
|
+
cat .env.example.tls >> .env
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Configure
|
|
171
|
+
|
|
172
|
+
Required in `.env`:
|
|
173
|
+
```bash
|
|
174
|
+
DOMAIN=yourdomain.com
|
|
175
|
+
APP_PORT=3000
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Recommended for first deployment:
|
|
179
|
+
```bash
|
|
180
|
+
ENABLE_CADDY_LOGS=true # Debug logs
|
|
181
|
+
ACME_STAGING=true # Test certificates (avoid rate limits)
|
|
182
|
+
```
|
|
65
183
|
|
|
66
|
-
|
|
184
|
+
### DNS Setup
|
|
67
185
|
|
|
186
|
+
Create A record pointing to instance IP:
|
|
187
|
+
- Type: A
|
|
188
|
+
- Name: yourdomain.com
|
|
189
|
+
- Value: `<instance-ip>` (get from `ecloud compute app info`)
|
|
190
|
+
|
|
191
|
+
### Deploy
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
ecloud compute app upgrade
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Production Certificates
|
|
198
|
+
|
|
199
|
+
To switch from staging to production:
|
|
68
200
|
```bash
|
|
69
|
-
#
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
201
|
+
# Set in .env:
|
|
202
|
+
ACME_STAGING=false
|
|
203
|
+
ACME_FORCE_ISSUE=true # Only if staging cert exists
|
|
204
|
+
|
|
205
|
+
# Deploy, then set ACME_FORCE_ISSUE=false for future deploys
|
|
74
206
|
```
|
|
75
207
|
|
|
76
|
-
**
|
|
208
|
+
**Notes:**
|
|
209
|
+
- Let's Encrypt rate limit: 5 certificates/week per domain
|
|
210
|
+
- Test with staging certificates first to avoid rate limits
|
|
211
|
+
- DNS changes may take a few minutes to propagate
|
|
212
|
+
|
|
213
|
+
## Advanced Usage
|
|
214
|
+
|
|
215
|
+
### Building and Pushing Images Manually
|
|
216
|
+
|
|
217
|
+
If you prefer to build and push Docker images yourself instead of letting the CLI handle it, or already have an existing image:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Build and push your image manually
|
|
221
|
+
docker build --platform linux/amd64 -t myregistry/myapp:v1.0 .
|
|
222
|
+
docker push myregistry/myapp:v1.0
|
|
223
|
+
|
|
224
|
+
# Deploy using the image reference
|
|
225
|
+
ecloud compute app deploy myregistry/myapp:v1.0
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**Requirements:**
|
|
229
|
+
|
|
230
|
+
- Image must target `linux/amd64` architecture
|
|
231
|
+
- Application must run as root user (TEE requirement)
|
|
232
|
+
|
|
233
|
+
## Telemetry
|
|
234
|
+
|
|
235
|
+
Ecloud collects anonymous usage data to help us improve the CLI and understand how it's being used. This telemetry is enabled by default but can be easily disabled.
|
|
236
|
+
|
|
237
|
+
### What We Collect
|
|
238
|
+
|
|
239
|
+
- Commands used (e.g., `ecloud compute app create`, `ecloud compute app deploy`)
|
|
240
|
+
- Error counts and types to identify common issues
|
|
241
|
+
- Performance metrics (command execution times)
|
|
242
|
+
- System information (OS, architecture)
|
|
243
|
+
- Deployment environment (e.g., sepolia, mainnet-alpha)
|
|
244
|
+
- User Ethereum address
|
|
245
|
+
|
|
246
|
+
### What We DON'T Collect
|
|
247
|
+
|
|
248
|
+
- Personal information or identifiers
|
|
249
|
+
- Private keys or sensitive credentials
|
|
250
|
+
- Application source code or configurations
|
|
251
|
+
- Specific file paths or project names
|
|
252
|
+
|
|
253
|
+
## Architecture
|
|
77
254
|
|
|
78
|
-
|
|
79
|
-
- `--environment`: Target environment (`sepolia` or `mainnet-alpha`)
|
|
80
|
-
- `--rpc-url`: Custom RPC URL (optional, or set `ECLOUD_RPC_URL` env var)
|
|
255
|
+
For a detailed understanding of how Ecloud enables verifiable applications with deterministic identities, see our [Architecture Documentation](docs/ECLOUD_ARCHITECTURE.md).
|
|
81
256
|
|
|
82
|
-
|
|
257
|
+
### Key Components
|
|
258
|
+
|
|
259
|
+
- **Hardware Isolation** - Intel TDX secure enclaves with memory encryption
|
|
260
|
+
- **Attestation** - Cryptographic proof of exact Docker image integrity
|
|
261
|
+
- **Deterministic Keys** - Apps receive consistent identities via KMS
|
|
262
|
+
- **Smart Contracts** - Onchain configuration and lifecycle management
|
|
263
|
+
|
|
264
|
+
## Development
|
|
265
|
+
|
|
266
|
+
### Prerequisites
|
|
267
|
+
|
|
268
|
+
- Node.js 18+
|
|
269
|
+
- pnpm (recommended) or npm
|
|
270
|
+
- Docker (for building and pushing images)
|
|
271
|
+
|
|
272
|
+
### Build from source
|
|
83
273
|
|
|
84
274
|
```bash
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
275
|
+
git clone https://github.com/Layr-Labs/ecloud
|
|
276
|
+
cd ecloud
|
|
277
|
+
pnpm install
|
|
278
|
+
pnpm build
|
|
279
|
+
pnpm ecloud version
|
|
88
280
|
```
|
|
89
281
|
|
|
282
|
+
|
|
283
|
+
## SDK Packages
|
|
284
|
+
|
|
285
|
+
This monorepo contains two main packages:
|
|
286
|
+
|
|
287
|
+
### `@layr-labs/ecloud-sdk`
|
|
288
|
+
|
|
289
|
+
The core TypeScript SDK for programmatic access to ecloud services.
|
|
290
|
+
|
|
291
|
+
**Features:**
|
|
292
|
+
|
|
293
|
+
- Type-safe client for ecloud operations
|
|
294
|
+
- Docker image building and pushing
|
|
295
|
+
- KMS encryption for secure deployments
|
|
296
|
+
- Smart contract interactions (EIP7702)
|
|
297
|
+
- Environment configuration management
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
## Usage
|
|
301
|
+
|
|
90
302
|
### SDK Usage
|
|
91
303
|
|
|
92
304
|
```typescript
|
|
@@ -95,7 +307,7 @@ import { createECloudClient } from "@layr-labs/ecloud-sdk";
|
|
|
95
307
|
// Create a client
|
|
96
308
|
const client = createECloudClient({
|
|
97
309
|
privateKey: "0x...",
|
|
98
|
-
environment: "sepolia", // or "sepolia
|
|
310
|
+
environment: "sepolia", // or "sepolia" or "mainnet-alpha"
|
|
99
311
|
rpcUrl: "https://sepolia.infura.io/v3/...",
|
|
100
312
|
});
|
|
101
313
|
|
package/VERSION
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
version=0.0
|
|
2
|
-
commit=
|
|
1
|
+
version=0.1.0-dev
|
|
2
|
+
commit=77a74ce3558ed2d1331016cab7356a0c36c2833f
|
package/dist/index.cjs
CHANGED
|
@@ -2512,7 +2512,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
2512
2512
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
2513
2513
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
2514
2514
|
function getDefaultClientId() {
|
|
2515
|
-
const version = true ? "0.0
|
|
2515
|
+
const version = true ? "0.1.0-dev" : "0.0.0";
|
|
2516
2516
|
return `ecloud-sdk/v${version}`;
|
|
2517
2517
|
}
|
|
2518
2518
|
var UserApiClient = class {
|