Skip to content

Commit 1f31646

Browse files
Fixed Resvault SC deployment issues
1 parent 0fd75e8 commit 1f31646

File tree

5 files changed

+2603
-1384
lines changed

5 files changed

+2603
-1384
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ venv
1313
sdk_validator/venv
1414
__pycache__
1515
MODULE.*
16+
ecosystem/tools/resvault/build
1617
apache_release
1718
*.out.*
1819
*.data.*

ecosystem/tools/resvault/README.md

Lines changed: 71 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,81 @@ npm install --legacy-peer-deps
100100
CI= npm run build
101101
```
102102

103+
### Build and test in Chrome (this repo)
104+
To build ResVault from this repo and load it in Chrome for testing (before publishing to the Chrome Web Store):
105+
106+
1. **Install dependencies and build**
107+
```shell
108+
cd ecosystem/tools/resvault
109+
npm install --legacy-peer-deps
110+
npm run build
111+
```
112+
This produces a `build` folder with the extension (React app in `index.html` + `static/js/`, `manifest.json`, `content.js`, `background.js`, and icons). **You must run the full build**—loading only the `public` folder or an incomplete `build` will show a blank popup.
113+
114+
2. **Load the extension in Chrome**
115+
- Open [chrome://extensions/](chrome://extensions/) in Google Chrome.
116+
- Turn **Developer mode** on (toggle in the top-right).
117+
- Click **Load unpacked**.
118+
- Choose the **`build`** folder (e.g. `incubator-resilientdb/ecosystem/tools/resvault/build`).
119+
120+
3. **Test**
121+
- Use the ResVault icon in the toolbar to open the wallet popup and test flows.
122+
- After changes, run `npm run build` again, then in `chrome://extensions/` click the **Refresh** icon on the ResVault card to reload.
123+
124+
4. **Publish to Chrome Web Store**
125+
- When ready, zip the contents of the `build` folder (not the folder itself) and upload that zip in the [Chrome Web Store Developer Dashboard](https://chrome.google.com/webstore/devconsole).
126+
103127
## Smart Contract Usage
104128

129+
Compile/deploy uses the Smart Contract GraphQL server. That server must have **solc** installed (non-snap, e.g. the static binary from [Solidity releases](https://github.com/ethereum/solidity/releases)) and, when starting the server, set **SOLC_PATH** to that binary (e.g. `SOLC_PATH=/usr/local/bin/solc`). ResVault itself does not need any solc-related configuration.
130+
105131
### Deploying Contracts
106132
1. Navigate to the **Contract** tab in ResVault
107-
2. Enter your ResilientDB server URL:
108-
- **Mainnet**: Use the production ResilientDB endpoint
109-
- **Local Development**: Use your local server (e.g., `http://localhost:8400`)
110-
- **Custom Server**: Use any ResilientDB instance (e.g., `http://your-server:8400`)
111-
3. Paste your Solidity contract code
112-
4. Provide constructor arguments if needed
113-
5. Click **Deploy** - the contract will be deployed using your wallet address
133+
2. Enter your ResilientDB GraphQL server URL (e.g. `http://your-server:8400/graphql`)
134+
3. Upload two files:
135+
- **Solidity contract (`.sol`)** – your contract source
136+
- **Configuration (`.json`)** – deployment config (see format below)
137+
4. Click **Deploy** – the contract is compiled on the server and deployed using your wallet address
138+
139+
#### Contract file (`.sol`)
140+
Standard Solidity source. No special naming; the config file references the contract by `filename:ContractName`.
141+
142+
Example (`SimpleStorage.sol`):
143+
```solidity
144+
pragma solidity >=0.5.0;
145+
146+
contract SimpleStorage {
147+
uint256 public value;
148+
149+
constructor(uint256 _value) public {
150+
value = _value;
151+
}
152+
153+
function setValue(uint256 _value) public {
154+
value = _value;
155+
}
156+
157+
function getValue() public view returns (uint256) {
158+
return value;
159+
}
160+
}
161+
```
162+
163+
#### Configuration file (`.json`)
164+
Must be valid JSON with exactly these fields:
165+
166+
| Field | Description |
167+
|------------------|-------------|
168+
| `contract_name` | `"<filename>:<ContractName>"` – the `.sol` filename and the contract name (e.g. `"simple.sol:SimpleStorage"`) |
169+
| `arguments` | Constructor arguments as a single string; comma-separated if multiple (e.g. `"100"` or `"100,0x123..."`) |
170+
171+
Example (`config.json`):
172+
```json
173+
{
174+
"arguments": "100",
175+
"contract_name": "simple.sol:SimpleStorage"
176+
}
177+
```
114178

115179
## Example Usage
116180
#### Demo Video

0 commit comments

Comments
 (0)