@@ -13,34 +13,38 @@ On-chain governance adds:
1313
1414- Production dstack deployment with KMS and Gateway as CVMs (see [ Deployment Guide] ( ./deployment.md ) )
1515- Ethereum wallet with funds on Sepolia testnet (or your target network)
16- - Node.js and npm installed
17- - Alchemy API key (for Sepolia) - get one at https://www.alchemy.com/
16+ - [ Foundry ] ( https://book.getfoundry.sh/getting-started/installation ) installed
17+ - Node.js and npm installed (for the bootAuth server)
1818
1919## Deploy DstackKms Contract
2020
2121``` bash
2222cd dstack/kms/auth-eth
23- npm install
24- npx hardhat compile
25- PRIVATE_KEY=< your-key> ALCHEMY_API_KEY=< your-key> npx hardhat kms:deploy --with-app-impl --network sepolia
23+ npm install # Install Node.js dependencies
24+ forge install # Install Foundry dependencies
25+
26+ # Deploy contracts (deploys both DstackApp implementation and DstackKms proxy)
27+ PRIVATE_KEY=< your-key> forge script script/Deploy.s.sol:DeployScript \
28+ --broadcast --rpc-url https://eth-sepolia.g.alchemy.com/v2/< your-alchemy-key>
2629```
2730
28- The command will prompt for confirmation. Sample output:
31+ Sample output:
2932
3033```
31- ✅ DstackApp implementation deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
32- DstackKms Proxy deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
33- Implementation deployed to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
34+ Deploying with account: 0x...
35+ DstackApp implementation deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3
36+ DstackKms implementation deployed to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
37+ DstackKms proxy deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0
3438```
3539
3640Note the proxy address (e.g., ` 0x9fE4... ` ).
3741
3842Set environment variables for subsequent commands:
3943
4044``` bash
41- export KMS_CONTRACT_ADDRESS =" <DstackKms-proxy-address>"
45+ export KMS_CONTRACT_ADDR =" <DstackKms-proxy-address>"
4246export PRIVATE_KEY=" <your-private-key>"
43- export ALCHEMY_API_KEY= " <your-alchemy-key>"
47+ export RPC_URL= " https://eth-sepolia.g.alchemy.com/v2/ <your-alchemy-key>"
4448```
4549
4650## Configure KMS for On-Chain Auth
@@ -52,42 +56,45 @@ KMS_CONTRACT_ADDR=<your-dstack-kms-contract-address>
5256ETH_RPC_URL=< ethereum-rpc-endpoint>
5357```
5458
55- Note: The auth-api uses ` KMS_CONTRACT_ADDR ` , while Hardhat tasks use ` KMS_CONTRACT_ADDRESS ` .
56-
5759The auth-api validates boot requests against the smart contract. See [ Deployment Guide] ( ./deployment.md#2-deploy-kms-as-cvm ) for complete setup instructions.
5860
5961## Whitelist OS Image
6062
6163``` bash
62- npx hardhat kms:add-image --network sepolia 0x< os-image-hash>
64+ OS_IMAGE_HASH=0x< os-image-hash> \
65+ forge script script/Manage.s.sol:AddOsImage --broadcast --rpc-url $RPC_URL
6366```
6467
65- Output: ` Image added successfully `
68+ Output: ` Added OS image hash: 0x... `
6669
6770The ` os_image_hash ` is in the ` digest.txt ` file from the guest OS image build (see [ Building Guest Images] ( ./deployment.md#building-guest-images ) ).
6871
6972## Register Gateway App
7073
7174``` bash
72- npx hardhat kms:create-app --network sepolia --allow-any-device
75+ # Create a new app with allowAnyDevice=true
76+ ALLOW_ANY_DEVICE=true \
77+ forge script script/Manage.s.sol:DeployApp --broadcast --rpc-url $RPC_URL
7378```
7479
7580Sample output:
7681
7782```
78- ✅ App deployed and registered successfully!
79- Proxy Address (App Id): 0x75537828f2ce51be7289709686A69CbFDbB714F1
83+ Deployed new app at: 0x75537828f2ce51be7289709686A69CbFDbB714F1
84+ Owner: 0x...
85+ Allow any device: true
8086```
8187
82- Note the App ID (Proxy Address ) from the output.
88+ Note the App ID (deployed app address ) from the output.
8389
8490Set it as the gateway app:
8591
8692``` bash
87- npx hardhat kms:set-gateway --network sepolia < app-id>
93+ GATEWAY_APP_ID=< app-id> \
94+ forge script script/Manage.s.sol:SetGatewayAppId --broadcast --rpc-url $RPC_URL
8895```
8996
90- Output: ` Gateway App ID set successfully `
97+ Output: ` Set gateway app ID: <app-id> `
9198
9299Add the gateway's compose hash to the whitelist. To compute the compose hash:
93100
@@ -98,10 +105,11 @@ sha256sum /path/to/gateway-compose.json | awk '{print "0x"$1}'
98105Then add it:
99106
100107``` bash
101- npx hardhat app:add-hash --network sepolia --app-id < app-id> < compose-hash>
108+ APP_CONTRACT_ADDR=< app-id> COMPOSE_HASH=< compose-hash> \
109+ forge script script/Manage.s.sol:AddComposeHash --broadcast --rpc-url $RPC_URL
102110```
103111
104- Output: ` Compose hash added successfully `
112+ Output: ` Added compose hash: 0x... `
105113
106114## Register Apps On-Chain
107115
@@ -110,7 +118,8 @@ For each app you want to deploy:
110118### Create App
111119
112120``` bash
113- npx hardhat kms:create-app --network sepolia --allow-any-device
121+ ALLOW_ANY_DEVICE=true \
122+ forge script script/Manage.s.sol:DeployApp --broadcast --rpc-url $RPC_URL
114123```
115124
116125Note the App ID from the output.
@@ -126,7 +135,8 @@ sha256sum /path/to/your-app-compose.json | awk '{print "0x"$1}'
126135Then add it:
127136
128137``` bash
129- npx hardhat app:add-hash --network sepolia --app-id < app-id> < compose-hash>
138+ APP_CONTRACT_ADDR=< app-id> COMPOSE_HASH=< compose-hash> \
139+ forge script script/Manage.s.sol:AddComposeHash --broadcast --rpc-url $RPC_URL
130140```
131141
132142### Deploy via VMM
0 commit comments