Skip to content

Commit 74b42a2

Browse files
nuke-web3capossele
andauthored
BM-197: Update Sepolia Requestor docs (github#36)
First pass as updating the Book to discuss using public deployments of the Boundless Market. Before merge, it would be best to do these, but should not block if we need docs surfaced ASAP: - [ ] Test the local CLI workflow works on Sepolia manually - [ ] Test a github#31 style workflow Also includes a nit to replace `WALLET_PRIVATE_KEY` with `REQUESTOR_PRIVATE_KEY` to avoid ambiguity as multiple accounts may be at play for various parties in testing and deployment soon. --------- Co-authored-by: capossele <angelocapossele@gmail.com>
1 parent 3b6921b commit 74b42a2

File tree

10 files changed

+133
-102
lines changed

10 files changed

+133
-102
lines changed

.env

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
# URL RPC node
2+
23
RPC_URL="http://localhost:8545"
34

5+
# Sepolia (https://www.alchemy.com/chain-connect/chain/sepolia)
6+
#RPC_URL="https://rpc.sepolia.org"
7+
48
### Contracts ###
59

6-
SET_VERIFIER_ADDRESS="0x261D8c5e9742e6f7f1076Fa1F560894524e19cad"
7-
PROOF_MARKET_ADDRESS="0xCE3478A9E0167a6Bc5716DC39DbbbfAc38F27623"
10+
# Defaults to Sepolia, more details in
11+
12+
SET_VERIFIER_ADDRESS="0x6860e6cC6E4705309b3e946947706b4a346422DB"
13+
PROOF_MARKET_ADDRESS="0xb3e579794B6ce24bC7233713289790d9bBEB656c"
814

915
### Wallets private keys ###
1016

1117
PROVER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
12-
WALLET_PRIVATE_KEY="0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"
18+
REQUESTOR_PRIVATE_KEY="0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6"

contracts/scripts/Deploy.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {ImageID as SetBuidlerId} from "../src/SetBuilderImageID.sol";
1919
contract Deploy is Script, RiscZeroCheats {
2020
function run() external {
2121
// load ENV variables first
22-
uint256 adminKey = vm.envUint("WALLET_PRIVATE_KEY");
22+
uint256 adminKey = vm.envUint("REQUESTOR_PRIVATE_KEY");
2323

2424
vm.startBroadcast(adminKey);
2525

crates/boundless-market/src/bin/cli.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ struct SubmitOfferRequirements {
146146
struct MainArgs {
147147
#[clap(short, long, env, default_value = "http://localhost:8545")]
148148
rpc_url: Url,
149-
#[clap(short, long, env)]
150-
wallet_private_key: PrivateKeySigner,
149+
#[clap(long, env)]
150+
requestor_private_key: PrivateKeySigner,
151151
#[clap(short, long, env)]
152152
proof_market_address: Address,
153153
#[clap(short, long, env)]
@@ -164,9 +164,9 @@ async fn main() -> Result<()> {
164164
dotenvy::dotenv()?;
165165
let args = MainArgs::try_parse()?;
166166

167-
let caller = args.wallet_private_key.address();
168-
let signer = args.wallet_private_key.clone();
169-
let wallet = EthereumWallet::from(args.wallet_private_key.clone());
167+
let caller = args.requestor_private_key.address();
168+
let signer = args.requestor_private_key.clone();
169+
let wallet = EthereumWallet::from(args.requestor_private_key.clone());
170170
let provider =
171171
ProviderBuilder::new().with_recommended_fillers().wallet(wallet).on_http(args.rpc_url);
172172
let market = ProofMarketService::new(args.proof_market_address, provider.clone(), caller);

crates/boundless-market/src/sdk/client.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,15 +161,15 @@ impl Client<Http<HttpClient>, ProviderWallet, BuiltinStorageProvider> {
161161
/// Create a new client from environment variables
162162
///
163163
/// The following environment variables are required:
164-
/// - WALLET_PRIVATE_KEY: The private key of the wallet
164+
/// - REQUESTOR_PRIVATE_KEY: The private key of the wallet
165165
/// - RPC_URL: The URL of the RPC server
166166
/// - PROOF_MARKET_ADDRESS: The address of the proof market contract
167167
/// - SET_VERIFIER_ADDRESS: The address of the set verifier contract
168168
pub async fn from_env() -> Result<Self, ClientError> {
169-
let wallet_private_key_str =
170-
env::var("WALLET_PRIVATE_KEY").context("WALLET_PRIVATE_KEY not set")?;
171-
let wallet_private_key = PrivateKeySigner::from_str(&wallet_private_key_str)
172-
.context("Invalid WALLET_PRIVATE_KEY")?;
169+
let requestor_private_key_str =
170+
env::var("requestor_private_key").context("requestor_private_key not set")?;
171+
let requestor_private_key = PrivateKeySigner::from_str(&requestor_private_key_str)
172+
.context("Invalid requestor_private_key")?;
173173
let rpc_url_str = env::var("RPC_URL").context("RPC_URL not set")?;
174174
let rpc_url = Url::parse(&rpc_url_str).context("Invalid RPC_URL")?;
175175
let proof_market_address_str =
@@ -181,9 +181,9 @@ impl Client<Http<HttpClient>, ProviderWallet, BuiltinStorageProvider> {
181181
let set_verifier_address =
182182
Address::from_str(&set_verifier_address_str).context("Invalid SET_VERIFIER_ADDRESS")?;
183183

184-
let caller = wallet_private_key.address();
185-
let signer = wallet_private_key.clone();
186-
let wallet = EthereumWallet::from(wallet_private_key.clone());
184+
let caller = requestor_private_key.address();
185+
let signer = requestor_private_key.clone();
186+
let wallet = EthereumWallet::from(requestor_private_key.clone());
187187
let provider =
188188
ProviderBuilder::new().with_recommended_fillers().wallet(wallet).on_http(rpc_url);
189189

@@ -202,14 +202,14 @@ impl Client<Http<HttpClient>, ProviderWallet, BuiltinStorageProvider> {
202202
/// The proof market address is the address of the proof market contract.
203203
/// The set verifier address is the address of the set verifier contract.
204204
pub async fn from_parts(
205-
wallet_private_key: PrivateKeySigner,
205+
requestor_private_key: PrivateKeySigner,
206206
rpc_url: Url,
207207
proof_market_address: Address,
208208
set_verifier_address: Address,
209209
) -> Result<Self, ClientError> {
210-
let caller = wallet_private_key.address();
211-
let signer = wallet_private_key.clone();
212-
let wallet = EthereumWallet::from(wallet_private_key.clone());
210+
let caller = requestor_private_key.address();
211+
let signer = requestor_private_key.clone();
212+
let wallet = EthereumWallet::from(requestor_private_key.clone());
213213
let provider =
214214
ProviderBuilder::new().with_recommended_fillers().wallet(wallet).on_http(rpc_url);
215215

docs/src/SUMMARY.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
- [Boundless Market RFC](./market/rfc.md)
1010
- [Market Matching](./market/matching.md)
11-
- [Local Development Configuration](./market/local-development.md)
11+
- [Local Development](./market/local-development.md)
12+
- [Public Deployments](./market/deployments.md)
1213

1314
- [🙋 Requestor Manual](./requestor-manual/README.md)
1415

docs/src/market/deployments.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Boundless Market Contract Deployments
2+
3+
The Boundless Market's contracts are deployed only on [Sepolia](#sepolia) so far, with more to be determined.
4+
5+
## Sepolia ⚠TESTNET⚠
6+
7+
| Contract Name | Contract Address |
8+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------- |
9+
| `ProofMarket` | [0xb3e579794B6ce24bC7233713289790d9bBEB656c](https://sepolia.etherscan.io/address/0xb3e579794B6ce24bC7233713289790d9bBEB656c) |
10+
| `SetVerifier` | [0x6860e6cC6E4705309b3e946947706b4a346422DB](https://sepolia.etherscan.io/address/0x6860e6cC6E4705309b3e946947706b4a346422DB) |
11+
| `RiscZeroVerifierRouter` | [0x925d8331ddc0a1F0d96E68CF073DFE1d92b69187](https://sepolia.etherscan.io/address/0x925d8331ddc0a1F0d96E68CF073DFE1d92b69187) |
12+
| `Counter` example | [0x830aC8703F9735BF728517fB8946DbDcC222b9f9](https://sepolia.etherscan.io/address/0x830aC8703F9735BF728517fB8946DbDcC222b9f9) |
13+
14+
## Interactions
15+
16+
To interact with Boundless on any network see:
17+
18+
- The [requestor broadcasting guide](../requestor-manual/broadcasting.md#public-networks)
19+
- The [prover running Bento guide](../prover-manual/bento/running_bento.md)

docs/src/prover-manual/broker/sepolia.md

Lines changed: 0 additions & 61 deletions
This file was deleted.

docs/src/requestor-manual/broadcasting.md

Lines changed: 72 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,80 @@
1-
# Broadcasting Proof Requests
1+
# Broadcast a Proof Request
22

33
Programmatic interaction with the market is accomplished through `boundless-market` crate, using the `ProofMarketService` struct.
44
An example is provided in the `examples/counter` directory.
55

6-
You can also interact with the market via a CLI, built with the `boundless_market::contracts` library.
6+
You can also interact with the market via a market client CLI.
7+
It builds upon the `boundless_market::contracts` library.
78

8-
## CLI Usage
9+
## Local Devnet
10+
11+
To setup a local devnet follow the [local development][local-development] instructions.
12+
13+
You can override settings found in `.env` and more to use local devnet settings with by exporting or prefixing commands:
14+
15+
```bash
16+
# Use dev mode in this terminal session
17+
export RISC0_DEV_MODE=1
18+
# Use dev mode for this command only
19+
RISC0_DEV_MODE=1 <ANY BOUNDLESS CLI COMMAND>
20+
```
21+
22+
Notably, Developer Mode will:
23+
24+
- Use a storage provider that interacts with temporary files.
25+
- Use `anvil` default dev wallets to deploy and interact with contracts.
26+
27+
See the [CLI usage](#cli-usage) section or `examples/counter`'s `ProofMarketService` for further instructions.
28+
29+
## Public Networks
30+
31+
The Boundless Market is officially deployed only on [the Sepolia Testnet][id-deployments-sepolia-testnet] so far, with more networks to be announced.
32+
Before you can interact with any network, you will need to configure an EVM RPC, Funds to pay for gas, and Image Storage Provider.
33+
34+
#### Configure an EVM RPC Provider
35+
36+
You need an RPC provider to interact with any EVM network. [Alchemy](https://www.alchemy.com/) supports various EVM networks, so creating a free account there is recommended, but many other options exist. Set the following environment variables according to your chosen RPC:
37+
38+
```bash
39+
export RPC_URL="<SEPOLIA-URL>"
40+
```
41+
42+
Or just modify the .env file and finally run `source .env`.
943

10-
> **NOTE**: all the following commands can be run with the environment variable `RISC0_DEV_MODE` set;
11-
> this should be done only while testing within a [local devnet][page-local-development] as the
12-
> default storage provider will use temporary files.
44+
#### Configure a Storage Provider
45+
46+
Boundless requires that ELF Image of the program requested, and optionally the input, to be proven be accessible to provers.
47+
48+
<!-- TODO: link to rustdocs and document how one might create a storage provider (perhaps via a DA?) -->
49+
50+
The best supported options are listed in the `boundless-market::BuiltinStorageProvider` enum.
51+
IPFS storage is presently the best supported, specifically through [Pinata](https://www.pinata.cloud/) which offers a free tier sufficient for most Boundless use cases.
52+
To use Pinata, [fetch the JWT credentials](https://docs.pinata.cloud/account-management/api-keys) and set the `PINATA_JWT` environment variable.
53+
54+
### Sepolia Testnet
55+
56+
To interact with [Sepolia's Boundless contracts][id-deployments-sepolia-testnet] you will need:
57+
58+
- A Sepolia Ethereum account with at least 0.5 Sepolia ETH for gas.
59+
- The tooling presently requires the use of raw private key in scripting, although there are [better ways to do this](https://book.getfoundry.sh/tutorials/best-practices#private-key-management) that one could implement.
60+
<!-- TODO: need better ways to get funds for boundless users! faucets are a HUGE pain, considering the round trip gas costs! -->
61+
- Faucets exist to obtain 0.1 ETH at a time, but almost all require an account
62+
63+
Make sure to export the env variable:
64+
65+
```bash
66+
export REQUESTOR_PRIVATE_KEY="<YOUR-WALLET-PRIVATE_KEY>"
67+
```
68+
69+
Or just modify the .env file and then run `source .env`
70+
71+
See the [CLI usage](#cli-usage) section for further instructions.
72+
73+
## CLI Usage
1374

14-
The boundless `cli` allows to:
75+
The `cli` allows to:
1576

16-
1. Submit proving request via a YAML file, an example can be found `request.yaml`.
77+
1. Submit proving request via a YAML file, an example can be found in `request.yaml`.
1778

1879
```console
1980
RUST_LOG=info,boundless_market=debug cargo run --bin cli -- submit-request request.yaml
@@ -101,7 +162,7 @@ The boundless `cli` allows to:
101162
and the Pinata one will be ignored.
102163

103164
```console
104-
PINATA_JWT="YOUR_PINATA_JWT" RUST_LOG=info,boundless_market=debug cargo run --bin cli -- submit-offer offer.yaml --wait --input "hello" --encode-input --journal-prefix ""
165+
PINATA_JWT="YOUR_PINATA_JWT" RUST_LOG=info cargo run --bin cli -- submit-offer --input "Hello world!" --inline-input --encode-input --journal-prefix "" offer.yaml
105166
```
106167

107168
6. Slash a request and get back funds
@@ -112,4 +173,5 @@ The boundless `cli` allows to:
112173
RUST_LOG=info,boundless_market=debug cargo run --bin cli -- slash 3554585979324098154284013313896898623039163403618679259143
113174
```
114175

115-
[page-local-development]: ../market/local-development.md
176+
[id-deployments-sepolia-testnet]: ../market/deployments.md#sepolia-testnet
177+
[local-development]: ../market/local-development.md

examples/counter/apps/src/main.rs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ struct Args {
4242
#[clap(short, long, env)]
4343
rpc_url: Url,
4444
/// Private key used to interact with the Counter contract.
45-
#[clap(short, long, env)]
46-
wallet_private_key: PrivateKeySigner,
45+
#[clap(long, env)]
46+
requestor_private_key: PrivateKeySigner,
4747
/// Address of the Counter contract.
4848
#[clap(short, long, env)]
4949
counter_address: Address,
@@ -66,7 +66,7 @@ async fn main() -> Result<()> {
6666

6767
// NOTE: Using a separate `run` function to facilitate testing below.
6868
run(
69-
args.wallet_private_key,
69+
args.requestor_private_key,
7070
args.rpc_url,
7171
args.proof_market_address,
7272
args.set_verifier_address,
@@ -78,16 +78,20 @@ async fn main() -> Result<()> {
7878
}
7979

8080
async fn run(
81-
wallet_private_key: PrivateKeySigner,
81+
requestor_private_key: PrivateKeySigner,
8282
rpc_url: Url,
8383
proof_market_address: Address,
8484
set_verifier_address: Address,
8585
counter_address: Address,
8686
) -> Result<()> {
8787
// Create a Boundless client from the provided parameters.
88-
let boundless_client =
89-
Client::from_parts(wallet_private_key, rpc_url, proof_market_address, set_verifier_address)
90-
.await?;
88+
let boundless_client = Client::from_parts(
89+
requestor_private_key,
90+
rpc_url,
91+
proof_market_address,
92+
set_verifier_address,
93+
)
94+
.await?;
9195

9296
// Upload the ECHO ELF to the storage provider so that it can be fetched by the market.
9397
let image_url = boundless_client.upload_image(ECHO_ELF).await?;
@@ -98,7 +102,7 @@ async fn run(
98102
let timestamp = format! {"{:?}", SystemTime::now()};
99103

100104
// Encode the input and upload it to the storage provider.
101-
let input = encode_input(&timestamp.as_bytes())?;
105+
let input = encode_input(timestamp.as_bytes())?;
102106
let input_url = boundless_client.upload_input(&input).await?;
103107
tracing::info!("Uploaded input to {}", input_url);
104108

examples/counter/contracts/scripts/Deploy.s.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {Counter} from "../src/Counter.sol";
1111
contract Deploy is Script {
1212
function run() external payable {
1313
// load ENV variables first
14-
uint256 key = vm.envUint("WALLET_PRIVATE_KEY");
14+
uint256 key = vm.envUint("REQUESTOR_PRIVATE_KEY");
1515
address verifierAddress = vm.envAddress("SET_VERIFIER_ADDRESS");
1616
vm.startBroadcast(key);
1717

0 commit comments

Comments
 (0)