Browse Source

SDP is now working, so up-rev. README updated with two source code build methods and improved layout. Embedded rust updated to 1.48

master
jahway603 3 years ago
parent
commit
b8ee2896fd
  1. 1
      AUTHORS
  2. 60
      README.md
  3. 6
      build.sh
  4. 6
      cli/src/main.rs
  5. 2
      cli/src/version.rs
  6. 20
      lib/src/pdf.rs

1
AUTHORS

@ -1,3 +1,4 @@
# The Hush Developers
Duke Leto https://github.com/leto
Jah Way https://git.hush.is/jahway603 https://github.com/jahway603

60
README.md

@ -8,42 +8,60 @@ You can run it on an air-gapped computer to generate your shielded z-addresses,
![screenshot](SilentDragonPaper.png?raw=true)
# Download
SilentDragonPaper is available as pre-built binaries from our [release page](https://git.hush.is/hush/SilentDragonPaper/releases). Download the zip file for your platform, extract it and run the `./SilentDragonPaper` binary.
## Download
# Generating wallets
To generate a Hush paper wallet, simply run `./SilentDragonPaper`
### Binary installation
SilentDragonPaper is available as pre-built binaries from our [release page](https://git.hush.is/hush/SilentDragonPaper/releases). Download the zip file for your platform, extract it and run the `./SilentDragonPaper` binary.
You'll be asked to type some random characters that will add entropy to the random number generator. Run with `--help` to see all options
### Source code installation
If you decide to compile from source, then first use git to get the source code as follows:
```
git clone https://git.hush.is/hush/SilentDragonPaper
```
Then choose one of these two source compilation options to build the SilentDragonPaper CLI.
## Saving as PDFs
To generate a Hush paper wallet and save it as a PDF, run
#### Option 1: Compile using system installed rust
SilentDragonPaper is built with rust. To compile from source, you [install Rust](https://www.rust-lang.org/tools/install).
```
./SilentDragonPaper -z 3 --format pdf sdp.pdf
cd SilentDragonPaper/cli
cargo build --release
```
This will generate 3 shielded z-addresses and their corresponding private keys, and save them in a PDF file called `sdp.pdf`
#### Option 2: Compile using "embedded" rust
Here we do need a system installed rust to compile.
## Vanity Addresses
```
cd SilentDragonPaper/cli
./build.sh
```
You can generate a "vanity address" (that is, an address starting with a given prefix) by specifying a `--vanity` argument with the prefix you want.
#### Compiled binary location
The binary is available in the `target/release` folder.
Note that generating vanity addresses with a prefix longer than 4-5 characters is computationally expensive. You can run it on multiple CPUs on your computer by specifying the `--threads` option.
## Usage Instructions
# Compiling from Source
### Generating wallets
To generate a Hush paper wallet, simply run `./SilentDragonPaper` or `./target/release/SilentDragonPaper` or `./cli/target/release/SilentDragonPaper` depending on method you used to install.
SilentDragonPaper is built with rust. To compile from source, you [install Rust](https://www.rust-lang.org/tools/install).
You'll be asked to type some random characters that will add entropy to the random number generator. Run with `--help` to see all options
Checkout the SilentDragonPaper repository and build the CLI
### Saving as PDFs
To generate a Hush paper wallet and save it as a PDF, run:
```
git clone https://git.hush.is/hush/SilentDragonPaper
cd SilentDragonPaper/cli
cargo build --release
./SilentDragonPaper -z 3 --format pdf sdp.pdf
```
The binary is available in the `target/release` folder.
This will generate 3 shielded z-addresses and their corresponding private keys, and save them in a PDF file called `sdp.pdf`
### Vanity Addresses
You can generate a "vanity address" (that is, an address starting with a given prefix) by specifying a `--vanity` argument with the prefix you want.
Note that generating vanity addresses with a prefix longer than 4-5 characters is computationally expensive. You can run it on multiple CPUs on your computer by specifying the `--threads` option.
## Ensuring Security
@ -96,11 +114,11 @@ ARGS:
Released under the GNU Public License Version 3 or later.
Copyright (c) 2019-2020 The Hush Developers
Copyright (c) 2019-2021 The Hush Developers
Copyright (c) 2019 adityapk00
## License
GPLv3 or later.
See [LICENSE] file for details.
See [LICENSE](LICENSE) file for details.

6
build.sh

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright (c) 2016-2020 The Hush developers
# Copyright (c) 2016-2021 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
@ -8,7 +8,7 @@ set -eu -o pipefail
# TODO: find elite Rust coders to update our shit
# to work on modern versions of rustc, lulz
PREFIX=rust-1.37.0-x86_64-unknown-linux-gnu
PREFIX=rust-1.48.0-x86_64-unknown-linux-gnu
FILE=$PREFIX.tar.gz
if [ ! -f "$FILE" ]; then
@ -16,7 +16,7 @@ if [ ! -f "$FILE" ]; then
fi
#TODO: verify SHA256
# cb573229bfd32928177c3835fdeb62d52da64806b844bc1095c6225b0665a1cb rust-1.37.0-x86_64-unknown-linux-gnu.tar.gz
# 950420a35b2dd9091f1b93a9ccd5abc026ca7112e667f246b1deb79204e2038b rust-1.48.0-x86_64-unknown-linux-gnu.tar.gz
tar zxvpf $FILE
mkdir -p build

6
cli/src/main.rs

@ -1,11 +1,11 @@
extern crate clap;
extern crate silentdragonpaperlib;
extern crate silentdragonpaper;
mod version;
use clap::{Arg, App};
use silentdragonpaperlib::paper::*;
use silentdragonpaperlib::pdf;
use silentdragonpaper::paper::*;
use silentdragonpaper::pdf;
use std::io;
use std::io::prelude::*;

2
cli/src/version.rs

@ -1 +1 @@
pub fn version() -> &'static str { &"0.1.2" }
pub fn version() -> &'static str { &"0.1.3" }

20
lib/src/pdf.rs

@ -78,8 +78,8 @@ pub fn save_to_pdf(addresses: &str, filename: &str) -> Result<(), String> {
current_layer.set_outline_thickness(2.0);
// Set title
current_layer.use_text("Speak and Transact Freely", 32, Mm(19.0), Mm(277.0), &font_bold);
current_layer.use_text("Private Cryptocurrency and Messenger on Zero Knowledge Proof Encryption", 13, Mm(7.0), Mm(266.0), &font_bold);
current_layer.use_text("Speak and Transact Freely", 32f64, Mm(19.0), Mm(277.0), &font_bold);
current_layer.use_text("Private Cryptocurrency and Messenger on Zero Knowledge Proof Encryption", 13f64, Mm(7.0), Mm(266.0), &font_bold);
// Draw lines
current_layer.add_shape(line1);
@ -144,7 +144,7 @@ fn qrcode_scaled(data: &str, scalefactor: usize) -> (Vec<u8>, usize) {
* Add a footer at the bottom of the page
*/
fn add_footer_to_page(current_layer: &PdfLayerReference, font: &IndirectFontRef, footer: &str) {
current_layer.use_text(footer, 10, Mm(5.0), Mm(5.0), &font);
current_layer.use_text(footer, 10f64, Mm(5.0), Mm(5.0), &font);
}
@ -163,11 +163,11 @@ fn add_address_to_page(current_layer: &PdfLayerReference, font: &IndirectFontRef
fn add_address_at(current_layer: &PdfLayerReference, font: &IndirectFontRef, font_bold: &IndirectFontRef, title: &str, address: &str, qrcode: &Vec<u8>, finalsize: usize, ypos: f64) {
add_qrcode_image_to_page(current_layer, qrcode, finalsize, Mm(10.0), Mm(ypos));
current_layer.use_text(title, 14, Mm(55.0), Mm(ypos+22.5), &font_bold);
current_layer.use_text(title, 14f64, Mm(55.0), Mm(ypos+22.5), &font_bold);
let strs = split_to_max(&address, 39, 39); // No spaces, so user can copy the address
for i in 0..strs.len() {
current_layer.use_text(strs[i].clone(), 12, Mm(55.0), Mm(ypos+15.0-((i*5) as f64)), &font);
current_layer.use_text(strs[i].clone(), 12f64, Mm(55.0), Mm(ypos+15.0-((i*5) as f64)), &font);
}
}
@ -182,23 +182,23 @@ fn add_pk_to_page(current_layer: &PdfLayerReference, font: &IndirectFontRef, fon
add_qrcode_image_to_page(current_layer, &scaledimg, finalsize, Mm(145.0), Mm(ypos-17.5));
current_layer.use_text("Private Key", 14, Mm(10.0), Mm(ypos+37.5), &font_bold);
current_layer.use_text("Private Key", 14f64, Mm(10.0), Mm(ypos+37.5), &font_bold);
let strs = split_to_max(&pk, 45, 45); // No spaces, so user can copy the private key
for i in 0..strs.len() {
current_layer.use_text(strs[i].clone(), 12, Mm(10.0), Mm(ypos+32.5-((i*5) as f64)), &font);
current_layer.use_text(strs[i].clone(), 12f64, Mm(10.0), Mm(ypos+32.5-((i*5) as f64)), &font);
}
// Add the address a second time below the private key
let title = if is_taddr {"HUSH t-address"} else {"HUSH z-address"};
current_layer.use_text(title, 12, Mm(10.0), Mm(ypos-10.0), &font_bold);
current_layer.use_text(title, 12f64, Mm(10.0), Mm(ypos-10.0), &font_bold);
let strs = split_to_max(&address, 39, 39); // No spaces, so user can copy the address
for i in 0..strs.len() {
current_layer.use_text(strs[i].clone(), 12, Mm(10.0), Mm(ypos-15.0-((i*5) as f64)), &font);
current_layer.use_text(strs[i].clone(), 12f64, Mm(10.0), Mm(ypos-15.0-((i*5) as f64)), &font);
}
// And add the seed too.
if !seed.is_empty() {
current_layer.use_text(format!("HDSeed: {}, Path: {}", seed, path).as_str(), 8, Mm(10.0), Mm(ypos-35.0), &font);
current_layer.use_text(format!("HDSeed: {}, Path: {}", seed, path).as_str(), 8f64, Mm(10.0), Mm(ypos-35.0), &font);
}
}

Loading…
Cancel
Save