Bladeren bron

(broken) zktool

x 3 jaren geleden
bovenliggende
commit
1bcf620d01
4 gewijzigde bestanden met toevoegingen van 95 en 0 verwijderingen
  1. 9 0
      Cargo.lock
  2. 1 0
      Cargo.toml
  3. 15 0
      bin/zktool/Cargo.toml
  4. 70 0
      bin/zktool/src/main.rs

+ 9 - 0
Cargo.lock

@@ -5282,3 +5282,12 @@ dependencies = [
  "clap 4.0.32",
  "clap 4.0.32",
  "darkfi",
  "darkfi",
 ]
 ]
+
+[[package]]
+name = "zktool"
+version = "0.1.0"
+dependencies = [
+ "clap 4.0.32",
+ "darkfi",
+ "darkfi-sdk",
+]

+ 1 - 0
Cargo.toml

@@ -37,6 +37,7 @@ members = [
     "bin/darkwiki/darkwiki-cli",
     "bin/darkwiki/darkwiki-cli",
     "bin/vanityaddr",
     "bin/vanityaddr",
     "bin/lilith",
     "bin/lilith",
+    "bin/zktool",
 
 
     "src/sdk",
     "src/sdk",
     "src/serial",
     "src/serial",

+ 15 - 0
bin/zktool/Cargo.toml

@@ -0,0 +1,15 @@
+[package]
+name = "zktool"
+version = "0.1.0"
+homepage = "https://dark.fi"
+description = "ZK multitool program"
+authors = ["Dyne.org foundation <foundation@dyne.org>"]
+repository = "https://github.com/darkrenaissance/darkfi"
+license = "AGPL-3.0-only"
+edition = "2021"
+
+[dependencies]
+clap = {version = "4.0.32", features = ["derive"]}
+darkfi = {path = "../../", features = ["zkas"]}
+darkfi-sdk = {path = "../../src/sdk"}
+

+ 70 - 0
bin/zktool/src/main.rs

@@ -0,0 +1,70 @@
+/* This file is part of DarkFi (https://dark.fi)
+ *
+ * Copyright (C) 2020-2023 Dyne.org foundation
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+use clap::{IntoApp, Parser, Subcommand};
+
+#[derive(Subcommand)]
+pub enum CliSubCommands {
+    /// Create a random Base value
+    Random {},
+    /// Convert int to Base
+    FromInt {
+        value: u64,
+    },
+    Add {
+        value_a: String,
+        value_b: String,
+    },
+    Sub {
+        value_a: String,
+        value_b: String,
+    },
+    Mul {
+        value_a: String,
+        value_b: String,
+    },
+    MakeProof {
+        bincode: String,
+        witness: String,
+        publics: String,
+    },
+    VerifyProof {
+        bincode: String,
+        publics: String,
+    },
+}
+
+#[derive(Parser)]
+#[clap(name = "zktool")]
+#[clap(arg_required_else_help(true))]
+pub struct CliDao {
+    /// Increase verbosity
+    #[clap(short, parse(from_occurrences))]
+    pub verbose: u8,
+    #[clap(subcommand)]
+    pub command: Option<CliSubCommands>,
+}
+
+fn main() {
+    let args = CliDao::parse();
+    match args.command {
+        Some(CliSubCommands::Random {}) => {
+            println!("random!");
+        }
+    }
+}