Compare commits

..

2 Commits

Author SHA1 Message Date
Collin Jackson
c2d6866b90 Updates 2024-10-03 15:06:32 -07:00
Collin Jackson
05c6ad4bc8 docs: Update README 2024-10-03 14:59:12 -07:00
12 changed files with 178 additions and 415 deletions

View File

@ -1,64 +0,0 @@
name: ci
on:
push:
branches:
- main
pull_request:
branches:
- "**"
jobs:
build:
name: Lint CLI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: |
clients/cli
proto
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
uses: arduino/setup-protoc@v3
- name: Set up Rust cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ./clients/cli
- name: Format
working-directory: clients/cli
run: |
rustfmt src/**/*.rs --check --edition 2021
- name: Build
working-directory: clients/cli
run: |
cargo build --profile=ci-build
- name: Run cargo clippy
working-directory: clients/cli
run: |
cargo clippy --profile=ci-build --no-deps --all-targets --workspace -- -D warnings
- name: Test
working-directory: clients/cli
run: |
cargo test --profile=ci-build --tests
- name: Ensure checked in generated files are up to date
run: |
if [ -n "$(git status --porcelain)" ]; then \
echo "There are uncommitted changes in working tree after building."; \
git status; \
git --no-pager diff; \
exit 1; \
else \
echo "Git working tree is clean"; \
fi;

View File

@ -1,96 +0,0 @@
# Contributing to the Nexus network
The Nexus network is contributor-friendly.
We welcome all contributions, no matter your experience with Rust or cryptography.
This document will help you get started. But first, **thank you for your interest in contributing!** We immensely appreciate quality contributions. This guide is intended to help you navigate the process.
The [Discord][discord] is always available for any concerns you may have that are not covered in this guide, or for any other questions or discussions you want to raise with the Nexus team or broader Nexus community.
### Code of Conduct
The Nexus network project adheres to the [Rust Code of Conduct][rust-coc]. This code of conduct describes the _minimum_ behavior
expected from all contributors.
Instances of violations of the Code of Conduct can be reported by contacting the Nexus team.
### Ways to contribute
There are three main ways to contribute:
1. **By reporting an issue:** If you believe that you have uncovered a bug in the Nexus zkVM, report it by creating a new issue in the [Github][gh] issue tracker. See below for an extended discussion on how to make a bug report most helpful.
2. **By adding information:** Even if collaborators are already aware of your issue, you can always provide additional context, such as further evidence in the form of reproduction steps, screenshots, code snippets, or logging outputs.
3. **By resolving an issue:** Typically this is done in the form of either demonstrating that the issue reported is not a problem after all in a polite, thoughtfully explained, and evidence supported manner, or by opening a pull request that fixes the underlying problem and participating in its review and refinement.
**Anybody can participate in any stage of contribution**. We urge you to participate in all discussions around bugs, feature requests, existing code, and PRs.
## Reporting Issues
#### Asking for help
If you have reviewed this document and existing documentation and still have questions or are still having problems, but don't quite know enough to create a bug report, then
you can get help by **starting a discussion**.
You can do so on the [Discord][discord].
#### Submitting a bug report
If you believe that you have uncovered a bug, please describe it to the best of your ability, and provide whatever context and evidence you have. Don't worry if you cannot provide every detail, just give us what you can. Contributors will ask follow-up questions if something is unclear.
As a starting point, in a bug report we will pretty much always want:
- the platform you are on, ideally both the operating system (Windows, macOS, or Linux) and the machine architecture (_e.g.,_ if you're using an M-series Mac) if you know them;
- console logs from the CLI or web application showing errors and status messages;
- concrete and comprehensive steps to reproduce the bug.
Code snippets should be as minimal as possible. It is always better if you can reproduce the bug with a small snippet that focuses on your Nexus zkVM usage rather than on the surrounding code in your project. This will help collaborators verify, reproduce, and zero in on a fix.
See [this guide][mcve] on how to create a minimal, complete, and verifiable example.
#### Submitting a feature request
Please include as detailed of an explanation as possible of the feature you would like, and add any additional context you think may be necessary or just helpful.
If you have examples of other tools that have the feature you are requesting, please include references/links to them as well.
## Resolving Issues
Pull requests are the way concrete changes are made to the code, documentation, and dependencies of the Nexus network.
Before making a large change, it is usually a good idea to first open an issue describing the change to solicit feedback and guidance.
This will increase the likelihood of the PR getting merged. Striking up a discussion the [Discord][discord] to let the community know
what you'll be working on can also be helpful for getting early feedback before diving in.
If you are working on a larger feature, we encourage you to open up a draft pull request and also check in with the [Discord][discord], to make sure that other
contributors are not duplicating work.
#### Discussion
You will probably get feedback or requests for changes to your pull request.
This is a regular and important part of the submission process, so don't be discouraged! Some reviewers may sign off on the pull
request right away, others may have more detailed comments or feedback. This is a necessary part of the process in order
to evaluate whether the changes are correct and necessary.
Remember to **always be aware of the person behind the code**. _How_ you communicate during reviews (of your code or others!) can have a significant impact on the success
of the pull request. We never want the cost of a change that makes the Nexus network better to be a valued contributor not
wanting to have anything to do with the project ever again. The goal is not just having good code. It's having a positive community that continues to turn good code into better code.
#### Abandoned or stale pull requests
If a pull request appears to be abandoned or stalled, it is polite to first check with the contributor to see if they
intend to continue the work before checking if they would mind if you took it over (especially if it just has minor revisions
remaining). When doing so, it is courteous to give the original contributor credit for the work they started, either by
preserving their name and e-mail address in the commit log, or by using the `Author: ` or `Co-authored-by: ` metadata
tag in the commits.
<sub><sup>_Adapted from the [Reth contributing guide][reth-contributing]_.</sub></sup>
[rust-coc]: https://github.com/rust-lang/rust/blob/master/CODE_OF_CONDUCT.md
[gh]: https://github.com/nexus-xyz/network-api
[discord]: https://discord.com/invite/nexus-xyz
[mcve]: https://stackoverflow.com/help/mcve
[reth-contributing]: https://github.com/paradigmxyz/reth/blob/main/CONTRIBUTING.md

View File

@ -1567,7 +1567,7 @@ dependencies = [
[[package]]
name = "nexus-network"
version = "0.3.4"
version = "0.1.0"
dependencies = [
"ark-bn254",
"ark-crypto-primitives",

View File

@ -1,6 +1,6 @@
[package]
name = "nexus-network"
version = "0.3.4"
version = "0.1.0"
edition = "2021"
[[bin]]
@ -10,23 +10,6 @@ path = "src/prover.rs"
[build-dependencies]
prost-build = "0.13"
[profile.dev]
opt-level = 1
[profile.release]
lto = "fat"
strip = true
codegen-units = 1
[profile.ci-build]
inherits = "dev"
opt-level = 0
debug = 0
strip = "none"
lto = false
codegen-units = 256
incremental = true
[dependencies]
async-stream = "0.3"
clap = { version = "4.5", features = ["derive"] }
@ -100,3 +83,8 @@ ark-vesta = { git = "https://github.com/arkworks-rs/curves/", rev = "8c0256a" }
ark-bls12-381 = { git = "https://github.com/arkworks-rs/curves/", rev = "3fded1f" }
zstd-sys = { git = "https://github.com/gyscos/zstd-rs" }
[profile.release]
strip = true
lto = true
codegen-units = 1

View File

@ -1,59 +1,23 @@
# Network CLI
# network-cli
The command line interface (CLI) lets you run a prover node and contribute proofs to the Nexus network.
It is the highest-performance option for proving.
## Prerequisites
If you don't have these dependencies already, install them first.
### Linux
```
sudo apt update
sudo apt upgrade
sudo apt install build-essential pkg-config libssl-dev git-all
```
### macOS
If you have [installed Homebrew](https://brew.sh/) to manage packages on OS X,
run this command to install Git.
```
brew install git
```
### Windows
[Install WSL](https://learn.microsoft.com/en-us/windows/wsl/install),
then see Linux instructions above.
Command line interface (CLI) for accessing the Nexus Network. Highest-performance option for proving.
## Quick start
```
curl https://cli.nexus.xyz/ | sh
curl https://network-cli.nexus.xyz/install.sh | sh
```
If you do not already have Rust, you will be prompted to install it.
## Terms of Use
Use of the CLI is subject to the [Terms of Use](https://nexus.xyz/terms-of-use).
Use of the CLI is subject to the [Terms of Use](https://nexus.xyz/terms_of_use).
The first time you run it, it prompts you to accept the terms. To accept the terms
noninteractively (for example, in a continuous integration environment),
add `NONINTERACTIVE=1` before `sh`.
add `NONINTERACTIVE=1` at the start of the command.
## Known issues
* Only the latest version of the CLI is currently supported.
* Prebuilt binaries are not yet available.
* Linking email to prover id is currently available on the web version only.
* Counting cycles proved is not yet available in the CLI.
* Only proving is supported. Submitting programs to the network is in private beta.
To request an API key, contact us at growth@nexus.xyz.
## Resources
* [Network FAQ](https://nexus.xyz/network#network-faqs)
* [Discord server](https://discord.gg/nexus-xyz)
Currently only proving is supported. Submitting programs to the network is in private beta.
To request an API key, [contact us](https://forms.gle/183D9bcDHUdbxCV5A).

View File

@ -1,4 +1,4 @@
use crate::config::{analytics_id, analytics_api_key};
use crate::config::analytics_token;
use chrono::Datelike;
use chrono::Timelike;
use reqwest::header::{ACCEPT, CONTENT_TYPE};
@ -16,27 +16,14 @@ pub fn track(
) {
println!("{}", description);
let firebase_app_id = analytics_id(ws_addr_string);
let firebase_api_key = analytics_api_key(ws_addr_string);
if firebase_app_id.is_empty() {
let token = analytics_token(ws_addr_string);
if token.is_empty() {
return;
}
let local_now = chrono::offset::Local::now();
// For tracking events, we use the Firebase Measurement Protocol
// Firebase is mostly designed for mobile and web apps, but for our use case of a CLI,
// we can use the Measurement Protocol to track events by POST to a URL.
// The only thing that may be unexpected is that the URL we use includes a firebase key
// Firebase format for properties for Measurement protocol:
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference?client_type=firebase#payload
// https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference?client_type=firebase#payload_query_parameters
let mut properties = json!({
"token": token,
"time": SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis(),
// app_instance_id is the standard key Firebase uses this key to track the same user across sessions
// It is a bit redundant, but I wanted to keep the recommended format Firebase uses to minimize surprises
// I still left the distinct_id key as well for backwards compatibility
"app_instance_id": event_properties["prover_id"],
"distinct_id": event_properties["prover_id"],
"prover_type": "volunteer",
"client_type": "cli",
@ -49,27 +36,15 @@ pub fn track(
for (k, v) in event_properties.as_object().unwrap() {
properties[k] = v.clone();
}
// Firebase format for events
let body = json!({
"app_instance_id": event_properties["prover_id"],
"events": [{
"name": event_name,
"params": properties
}],
"event": event_name,
"properties": properties
});
tokio::spawn(async move {
let client = reqwest::Client::new();
let _ = client
// URL is the Google Analytics endpoint for Firebase: https://stackoverflow.com/questions/50355752/firebase-analytics-from-remote-rest-api
.post(format!(
"https://www.google-analytics.com/mp/collect?firebase_app_id={}&api_secret={}",
firebase_app_id,
firebase_api_key
))
.body(format!("[{}]", body))
.post("https://api.mixpanel.com/track?ip=1")
.body(format!("[{}]", body.to_string()))
.header(ACCEPT, "text/plain")
.header(CONTENT_TYPE, "application/json")
.send()

View File

@ -1,78 +1,11 @@
// Debug version of analytics_id
#[cfg(debug_assertions)]
pub fn analytics_id(_ws_addr_string: &str) -> String {
// Use one of the tokens in the release version if debugging analytics
"".into()
}
// Debug version of analytics_api_key
#[cfg(debug_assertions)]
pub fn analytics_api_key(_ws_addr_string: &str) -> String {
// Use one of the tokens in the release version if debugging analytics
"".into()
}
// The following enum is used to determine the environment from the web socket string
#[derive(Debug)]
#[cfg(not(debug_assertions))]
enum Environment {
Dev,
Staging,
Beta,
Unknown,
}
// The web socket addresses for the different environments
#[cfg(not(debug_assertions))]
mod web_socket_urls {
pub const DEV: &str = "wss://dev.orchestrator.nexus.xyz:443/";
pub const STAGING: &str = "wss://staging.orchestrator.nexus.xyz:443/";
pub const BETA: &str = "wss://beta.orchestrator.nexus.xyz:443/";
}
// the firebase APP IDS by environment
#[cfg(not(debug_assertions))]
mod firebase {
pub const DEV_APP_ID: &str = "1:954530464230:web:f0a14de14ef7bcdaa99627";
pub const STAGING_APP_ID: &str = "1:222794630996:web:1758d64a85eba687eaaac1";
pub const BETA_APP_ID: &str = "1:279395003658:web:04ee2c524474d683d75ef3";
// Analytics keys for the different environments
// These are keys that allow the measurement protocol to write to the analytics database
// They are not sensitive. Worst case, if a malicious actor obtains the secret, they could potentially send false or misleading data to your GA4 property
pub const DEV_API_SECRET: &str = "8ySxiKrtT8a76zClqqO8IQ";
pub const STAGING_API_SECRET: &str = "OI7H53soRMSDWfJf1ittHQ";
pub const BETA_API_SECRET: &str = "gxxzKAQLSl-uYI0eKbIi_Q";
}
// Release versions (existing code)
#[cfg(not(debug_assertions))]
pub fn analytics_id(ws_addr_string: &str) -> String {
// Determine the environment from the web socket string (ws_addr_string)
let env = match ws_addr_string {
web_socket_urls::DEV => Environment::Dev,
web_socket_urls::STAGING => Environment::Staging,
web_socket_urls::BETA => Environment::Beta,
_ => Environment::Unknown,
pub fn analytics_token(ws_addr_string: &str) -> String {
if ws_addr_string.starts_with("wss://dev.orchestrator.nexus.xyz:443/") {
return "504d4d443854f2cd10e2e385aca81aa4".into();
} else if ws_addr_string.starts_with("wss://staging.orchestrator.nexus.xyz:443/") {
return "30bcb58893992aabc5aec014e7b903d2".into();
} else if ws_addr_string.starts_with("wss://beta.orchestrator.nexus.xyz:443/") {
return "3c16d3853f4258414c9c9109bbbdef0e".into();
} else {
return "".into();
};
// Return the appropriate Firebase App ID based on the environment
match env {
Environment::Dev => firebase::DEV_APP_ID.to_string(),
Environment::Staging => firebase::STAGING_APP_ID.to_string(),
Environment::Beta => firebase::BETA_APP_ID.to_string(),
Environment::Unknown => String::new(),
}
}
#[cfg(not(debug_assertions))]
pub fn analytics_api_key(ws_addr_string: &str) -> String {
match ws_addr_string {
web_socket_urls::DEV => firebase::DEV_API_SECRET.to_string(),
web_socket_urls::STAGING => firebase::STAGING_API_SECRET.to_string(),
web_socket_urls::BETA => firebase::BETA_API_SECRET.to_string(),
_ => String::new(),
}
}

View File

@ -32,8 +32,9 @@ use nexus_core::{
init_circuit_trace, key::CanonicalSerialize, pp::gen_vm_pp, prove_seq_step, types::*,
},
};
use rand::RngCore;
use std::env;
use zstd::stream::Encoder;
use rand::{ RngCore };
#[derive(Parser, Debug)]
struct Args {
@ -73,6 +74,19 @@ async fn main() {
// If the prover_id file is found, use the contents, otherwise generate a new random id
// and store it.
let _ = match env::var("NONINTERACTIVE") {
Ok(_) => (),
Err(_) => {
println!(
"Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n)"
);
let mut input = String::new();
let _ = std::io::stdin().read_line(&mut input);
if input.chars().nth(0).unwrap() == 'n' || input.chars().nth(0).unwrap() == 'N' {
return ();
}
}
};
let mut prover_id = format!(
"{}-{}-{}",
random_word::gen(Lang::En),
@ -118,35 +132,16 @@ async fn main() {
contents: Some(prover_request::Contents::Registration(
ProverRequestRegistration {
prover_type: ProverType::Volunteer.into(),
prover_id: prover_id.clone(),
prover_id: prover_id.clone().into(),
estimated_proof_cycles_hertz: None,
},
)),
};
let mut retries = 0;
let max_retries = 5;
while let Err(e) = client
client
.send(Message::Binary(registration.encode_to_vec()))
.await
{
eprintln!(
"Failed to send message: {:?}, attempt {}/{}",
e,
retries + 1,
max_retries
);
retries += 1;
if retries >= max_retries {
eprintln!("Max retries reached, exiting...");
break;
}
// Add a delay before retrying
tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await;
}
.unwrap();
track(
"register".into(),
@ -154,6 +149,9 @@ async fn main() {
&ws_addr_string,
json!({"ws_addr_string": ws_addr_string, "prover_id": prover_id}),
);
println!(
"Network stats are available at https://beta.nexus.xyz/."
);
loop {
let program_message = match client.next().await.unwrap().unwrap() {
Message::Binary(b) => b,
@ -184,7 +182,7 @@ async fn main() {
);
let mut vm: NexusVM<MerkleTrie> =
parse_elf(elf_bytes.as_ref()).expect("error loading and parsing RISC-V instruction");
parse_elf(&elf_bytes.as_ref()).expect("error loading and parsing RISC-V instruction");
vm.syscalls.set_input(&input);
// TODO(collinjackson): Get outputs
@ -226,8 +224,8 @@ async fn main() {
track(
"progress".into(),
format!(
"Program trace is {} steps. Proving {} steps starting at {}...",
total_steps, steps_to_prove, start
"Program trace is {} steps. Proving from {} to {}...",
total_steps, start, end
),
&ws_addr_string,
json!({
@ -248,21 +246,19 @@ async fn main() {
completed_fraction = steps_proven as f32 / steps_to_prove as f32;
let progress = ProverRequest {
contents: Some(prover_request::Contents::Progress(Progress {
completed_fraction,
completed_fraction: completed_fraction,
steps_in_trace: total_steps as i32,
steps_to_prove: steps_to_prove as i32,
steps_proven,
steps_proven: steps_proven as i32,
})),
};
let progress_duration = SystemTime::now().duration_since(progress_time).unwrap();
let cycles_proven = steps_proven * 4;
let proof_cycles_hertz = k as f64 * 1000.0 / progress_duration.as_millis() as f64;
let proof_cycles_hertz = k * 1000 / progress_duration.as_millis();
let proof_cycles_per_minute = k * 60 * 1000 / progress_duration.as_millis();
track(
"progress".into(),
format!(
"Proved step {} at {:.2} proof cycles/sec.",
step, proof_cycles_hertz
),
format!("Proved step {} at {} Hz.", step, proof_cycles_hertz),
&ws_addr_string,
json!({
"completed_fraction": completed_fraction,
@ -273,31 +269,15 @@ async fn main() {
"k": k,
"progress_duration_millis": progress_duration.as_millis(),
"proof_cycles_hertz": proof_cycles_hertz,
"proof_cycles_per_minute": proof_cycles_per_minute,
"prover_id": prover_id,
}),
);
progress_time = SystemTime::now();
let mut retries = 0;
let max_retries = 5;
while let Err(e) = client.send(Message::Binary(progress.encode_to_vec())).await {
eprintln!(
"Failed to send message: {:?}, attempt {}/{}",
e,
retries + 1,
max_retries
);
retries += 1;
if retries >= max_retries {
eprintln!("Max retries reached, exiting...");
break;
}
// Add a delay before retrying
tokio::time::sleep(tokio::time::Duration::from_secs(u64::pow(2, retries))).await;
}
client
.send(Message::Binary(progress.encode_to_vec()))
.await
.unwrap();
if step == end - 1 {
let mut buf = Vec::new();
let mut writer = Box::new(&mut buf);
@ -312,24 +292,22 @@ async fn main() {
proof: Some(proof::Proof::NovaBytes(buf)),
})),
};
let duration = SystemTime::now().duration_since(start_time).unwrap();
let proof_cycles_hertz =
cycles_proven as f64 * 1000.0 / duration.as_millis() as f64;
client
.send(Message::Binary(response.encode_to_vec()))
.await
.unwrap();
let duration = SystemTime::now().duration_since(start_time).unwrap();
let proof_cycles_hertz = cycles_proven * 1000 / duration.as_millis();
let proof_cycles_per_minute = cycles_proven * 60 * 1000 / duration.as_millis();
track(
"proof".into(),
format!(
"Proof sent! Overall speed was {:.2} proof cycles/sec.",
proof_cycles_hertz
),
format!("Proof sent! You proved at {} Hz.", proof_cycles_hertz),
&ws_addr_string,
json!({
"proof_duration_sec": duration.as_secs(),
"proof_duration_millis": duration.as_millis(),
"proof_cycles_hertz": proof_cycles_hertz,
"proof_cycles_per_minute": proof_cycles_per_minute,
"prover_id": prover_id,
}),
);

8
proto/generate_protobufs.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/sh
mkdir -p clients/flutter/lib/src/generated
protoc --experimental_allow_proto3_optional --dart_out=grpc:clients/flutter/lib/src/generated -Iproto proto/orchestrator.proto
dart format clients/flutter/lib/src/generated
(cd clients/dummy_client && cargo build || echo clients/dummy_client not found, possibly due to a sparse checkout.)
(cd clients/cli && cargo build || echo clients/cli not found, possibly due to a sparse checkout.)
(cd orchestrator && cargo build || echo orchestrator/ not found, possibly due a sparse checkout.)

View File

@ -1,7 +1,7 @@
// Copyright (c) 2024 Nexus. All rights reserved.
//
// If you use this protocol to communicate with Nexus's servers,
// you must agree to the Terms of Service: https://nexus.xyz/terms-of-use
// you must agree to the Terms of Service: https://nexus.xyz/tos
syntax = "proto3";

89
public/index.html Normal file
View File

@ -0,0 +1,89 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Welcome to Firebase Hosting</title>
<!-- update the version number as needed -->
<script defer src="/__/firebase/10.12.5/firebase-app-compat.js"></script>
<!-- include only the Firebase features as you need -->
<script defer src="/__/firebase/10.12.5/firebase-auth-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-database-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-firestore-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-functions-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-messaging-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-storage-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-analytics-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-remote-config-compat.js"></script>
<script defer src="/__/firebase/10.12.5/firebase-performance-compat.js"></script>
<!--
initialize the SDK after all desired features are loaded, set useEmulator to false
to avoid connecting the SDK to running emulators.
-->
<script defer src="/__/firebase/init.js?useEmulator=true"></script>
<style media="screen">
body { background: #ECEFF1; color: rgba(0,0,0,0.87); font-family: Roboto, Helvetica, Arial, sans-serif; margin: 0; padding: 0; }
#message { background: white; max-width: 360px; margin: 100px auto 16px; padding: 32px 24px; border-radius: 3px; }
#message h2 { color: #ffa100; font-weight: bold; font-size: 16px; margin: 0 0 8px; }
#message h1 { font-size: 22px; font-weight: 300; color: rgba(0,0,0,0.6); margin: 0 0 16px;}
#message p { line-height: 140%; margin: 16px 0 24px; font-size: 14px; }
#message a { display: block; text-align: center; background: #039be5; text-transform: uppercase; text-decoration: none; color: white; padding: 16px; border-radius: 4px; }
#message, #message a { box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); }
#load { color: rgba(0,0,0,0.4); text-align: center; font-size: 13px; }
@media (max-width: 600px) {
body, #message { margin-top: 0; background: white; box-shadow: none; }
body { border-top: 16px solid #ffa100; }
}
</style>
</head>
<body>
<div id="message">
<h2>Welcome</h2>
<h1>Firebase Hosting Setup Complete</h1>
<p>You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary!</p>
<a target="_blank" href="https://firebase.google.com/docs/hosting/">Open Hosting Documentation</a>
</div>
<p id="load">Firebase SDK Loading&hellip;</p>
<script>
document.addEventListener('DOMContentLoaded', function() {
const loadEl = document.querySelector('#load');
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
// // The Firebase SDK is initialized and available here!
//
// firebase.auth().onAuthStateChanged(user => { });
// firebase.database().ref('/path/to/ref').on('value', snapshot => { });
// firebase.firestore().doc('/foo/bar').get().then(() => { });
// firebase.functions().httpsCallable('yourFunction')().then(() => { });
// firebase.messaging().requestPermission().then(() => { });
// firebase.storage().ref('/path/to/ref').getDownloadURL().then(() => { });
// firebase.analytics(); // call to activate
// firebase.analytics().logEvent('tutorial_completed');
// firebase.performance(); // call to activate
//
// // 🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥🔥
try {
let app = firebase.app();
let features = [
'auth',
'database',
'firestore',
'functions',
'messaging',
'storage',
'analytics',
'remoteConfig',
'performance',
].filter(feature => typeof app[feature] === 'function');
loadEl.textContent = `Firebase SDK loaded with ${features.join(', ')}`;
} catch (e) {
console.error(e);
loadEl.textContent = 'Error loading the Firebase SDK, check the console.';
}
});
</script>
</body>
</html>

View File

@ -2,30 +2,18 @@
rustc --version || curl https://sh.rustup.rs -sSf | sh
NEXUS_HOME=$HOME/.nexus
while [ -z "$NONINTERACTIVE" ]; do
read -p "Do you agree to the Nexus Beta Terms of Use (https://nexus.xyz/terms-of-use)? (Y/n) " yn </dev/tty
case $yn in
[Nn]* ) exit;;
[Yy]* ) break;;
"" ) break;;
* ) echo "Please answer yes or no.";;
esac
done
git --version 2>&1 >/dev/null
GIT_IS_AVAILABLE=$?
if [ $GIT_IS_AVAILABLE != 0 ]; then
echo Unable to find git. Please install it and try again.
exit 1;
fi
if [ -d "$NEXUS_HOME/network-api" ]; then
echo "$NEXUS_HOME/network-api exists. Updating.";
(cd $NEXUS_HOME/network-api && git pull)
CLI_ZIP=/tmp/nexus-network-api.zip
curl -L --verbose "https://docs.google.com/uc?export=download&id=1kcbEeKpVEyvIqL-_cgR5sYdZe_fOEPs6" > $CLI_ZIP
if [ -d "$NEXUS_HOME" ]; then
echo "$NEXUS_HOME exists. Updating.";
(cd $NEXUS_HOME && rm -rf network-api && unzip $CLI_ZIP)
# TODO: Once GitHub repo is public, do this instead
# (cd $NEXUS_HOME && git pull)
else
# TODO: Once GitHub repo is public, do this instead
# git clone git@github.com:nexus-xyz/network-cli $NEXUS_HOME
mkdir -p $NEXUS_HOME
(cd $NEXUS_HOME && git clone https://github.com/nexus-xyz/network-api)
(cd $NEXUS_HOME && unzip $CLI_ZIP)
fi
(cd $NEXUS_HOME/network-api/clients/cli && cargo run --release --bin prover -- beta.orchestrator.nexus.xyz)