Code Monkey home page Code Monkey logo

wagyu's Introduction

Table of Contents

1. Overview

Wagyu is a feature-rich command-line utility to generate a cryptocurrency wallet.

Wagyu enables developers to build their own cryptocurrency application using the following modules.

Library Standard Wallet HD Wallet Mnemonic Network
wagyu-bitcoin
Crates.io

  • P2PKH
  • P2SH-P2WPKH
  • Bech32

  • BIP-32
  • BIP-44
  • BIP-49
  • Custom

  • BIP-39

  • Mainnet
  • Testnet
wagyu-ethereum
Crates.io

  • Standard

  • Ethereum
  • Ledger
  • Trezor
  • Keepkey
  • Custom

  • BIP-39

  • All
wagyu-monero
Crates.io

  • Standard
  • Integrated
  • Subaddress

  • N/A

  • Electrum

  • Mainnet
  • Testnet
  • Stagenet
wagyu-zcash
Crates.io

  • P2PKH
  • Sprout
  • Sapling

  • ZIP-32

  • N/A

  • Mainnet
  • Testnet

Wagyu can support new cryptocurrencies by implementing the model as outlined in this module.

Library Standard Wallet HD Wallet Mnemonic Network
wagyu_model
Crates.io




2. Build Guide

2.1 Install Rust

We recommend installing Rust using rustup. You can install rustup as follows:

  • macOS or Linux:

    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Windows (64-bit):

    Download the Windows 64-bit executable and follow the on-screen instructions.

  • Windows (32-bit):

    Download the Windows 32-bit executable and follow the on-screen instructions.

2.2a Build from Homebrew (for macOS)

For macOS users, we recommend installing wagyu via Homebrew as follows:

brew install wagyu

2.2b Build from Crates.io

We recommend installing wagyu this way. In your terminal, run:

cargo install wagyu

Now to use wagyu, in your terminal, run:

wagyu

2.2c Build from Source Code

Alternatively, you can install wagyu by building from the source code as follows:

# Download the source code
git clone https://github.com/AleoHQ/wagyu
cd wagyu

# Build in release mode
$ cargo build --release

This will generate an executable under the ./target/release directory. To use wagyu, run the following command:

./target/release/wagyu

3. Usage Guide

3.1 Generate a cryptocurrency wallet

To generate a cryptocurrency wallet, run:

wagyu [CRYPTOCURRENCY] [FLAGS] [OPTIONS]

3.1.1 Bitcoin

To generate a Bitcoin wallet, run:

wagyu bitcoin [FLAGS] [OPTIONS]

The command can be run with the following optional parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>        Generates a specified number of wallets
    -f, --format <format>      Generates a wallet with a specified format [possible values: bech32, legacy, segwit]
    -n, --network <network>    Generates a wallet for a specified network [possible values: mainnet, testnet]

3.1.2 Ethereum

To generate an Ethereum wallet, run:

wagyu ethereum [FLAGS] [OPTIONS]

The command can be run with the following optional parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>    Generates a specified number of wallets

3.1.3 Monero

To generate a Monero wallet, run:

wagyu monero [FLAGS] [OPTIONS]

The command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>                             Generates a specified number of wallets
    -i, --integrated <PaymentID>                    Generates a wallet with a specified payment ID
    -l, --language <language>                       Generates a wallet with a specified language [possible values: chinese_simplified, dutch, english, esperanto, french, german, italian, japanese, lojban, portuguese, russian, spanish]
    -n, --network <network>                         Generates a wallet for a specified network [possible values: mainnet, stagenet, testnet]
    -s, --subaddress <Major Index> <Minor Index>    Generates a wallet with a specified major and minor index

3.1.4 Zcash

To generate a Zcash wallet, run:

wagyu zcash [FLAGS] [OPTIONS]

The command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>                Generates a specified number of wallets
        --diversifier <diversifier>    Generates a wallet with a specified Sapling address diversifier
    -f, --format <format>              Generates a wallet with a specified format [possible values: sapling, sprout, transparent]
    -n, --network <network>            Generates a wallet for a specified network [possible values: mainnet, testnet]

3.2 Generate an HD cryptocurrency wallet

To generate an HD cryptocurrency wallet, run:

wagyu [CRYPTOCURRENCY] hd [FLAGS] [OPTIONS]

3.2.1 Bitcoin

To generate a Bitcoin HD wallet, run:

wagyu bitcoin hd [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>              Generates a specified number of wallets
    -d, --derivation <"path">        Generates an HD wallet for a specified derivation path (in quotes) [possible values: bip32, bip44, bip49, "<custom path>"]
    -l, --language <language>        Generates an HD wallet with a specified language [possible values: chinese_simplified, chinese_traditional, english, french, italian, japanese, korean, spanish]
    -n, --network <network>          Generates an HD wallet for a specified network [possible values: mainnet, testnet]
    -p, --password <password>        Generates an HD wallet with a specified password
    -w, --word-count <word count>    Generates an HD wallet with a specified word count [possible values: 12, 15, 18, 21, 24]

3.2.2 Ethereum

To generate an Ethereum HD wallet, run:

wagyu ethereum hd [FLAGS] [OPTIONS]

The command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>              Generates a specified number of wallets
    -d, --derivation <"path">        Generates an HD wallet for a specified derivation path (in quotes) [possible values: ethereum, keepkey, ledger-legacy, ledger-live, trezor, "<custom path>"]
    -i, --index <index>              Generates an HD wallet with a specified index
    -k, --indices <num_indices>      Generates an HD wallet with a specified number of indices
    -l, --language <language>        Generates an HD wallet with a specified language [possible values: chinese_simplified, chinese_traditional, english, french, italian, japanese, korean, spanish]
    -p, --password <password>        Generates an HD wallet with a specified password
    -w, --word-count <word count>    Generates an HD wallet with a specified word count [possible values: 12, 15, 18, 21, 24]

3.2.3 Zcash

To generate a Zcash HD wallet, run:

wagyu zcash hd [FLAGS] [OPTIONS]

The command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -c, --count <count>                Generates a specified number of wallets
    -d, --derivation <"path">          Generates an HD wallet for a specified derivation path (in quotes) [possible values: zip32, "<custom path>"]
        --diversifier <diversifier>    Imports a wallet with a specified Sapling address diversifier
    -n, --network <network>            Generates an HD wallet for a specified network [possible values: mainnet, testnet]

3.3 Import a cryptocurrency wallet

To import a cryptocurrency wallet, run:

wagyu [CRYPTOCURRENCY] import [FLAGS] [OPTIONS]

3.3.1 Bitcoin

To import a Bitcoin wallet, run:

wagyu bitcoin import [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --address <address>        Imports a partial wallet for a specified address
    -f, --format <format>          Imports a wallet with a specified format [possible values: bech32, legacy, segwit]
    -n, --network <network>        Imports a wallet for a specified network [possible values: mainnet, testnet]
        --private <private key>    Imports a wallet for a specified private key
        --public <public key>      Imports a partial wallet for a specified public key

3.3.2 Ethereum

To import an Etheruem wallet, run:

wagyu ethereum import [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --address <address>        Imports a partial wallet for a specified address
        --private <private key>    Imports a wallet for a specified private key
        --public <public key>      Imports a partial wallet for a specified public key

3.3.3 Monero

To import a Monero wallet, run:

wagyu monero import [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --address <address>                         Imports a partial wallet for a specified address
    -i, --integrated <PaymentID>                    Imports a wallet with a specified payment ID
    -l, --language <language>                       Imports a wallet with a specified mnemonic language (requires private spend key) [possible values: chinese_simplified, dutch, english, esperanto, french, german, italian, japanese, lojban, portuguese, russian, spanish]
    -m, --mnemonic <"mnemonic">                     Imports a wallet for a specified mnemonic (in quotes)
    -n, --network <network>                         Imports a wallet for a specified network [possible values: mainnet, stagenet, testnet]
        --private-spend <private spend key>         Imports a wallet for a specified private spend key
        --private-view <private view key>           Imports a partial wallet for a specified private view key
        --public-spend <public spend key>           Imports a partial wallet for a specified public spend key
        --public-view <public view key>             Imports a partial wallet for a specified public view key
    -s, --subaddress <Major Index> <Minor Index>    Imports a wallet with a specified major and minor index

3.3.4 Zcash

To import a Zcash wallet, run:

wagyu zcash import [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --address <address>            Imports a partial wallet for a specified address
        --diversifier <diversifier>    Imports a wallet with a specified Sapling address diversifier
        --private <private key>        Imports a wallet for a specified private key
        --public <public key>          Imports a partial wallet for a specified public key

3.4 Import an HD cryptocurrency wallet

To import an HD cryptocurrency wallet, run:

wagyu [CRYPTOCURRENCY] import-hd [FLAGS] [OPTIONS]

3.4.1 Bitcoin

To import a Bitcoin HD wallet, run:

wagyu bitcoin import-hd [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -a, --account <account>                      Imports an HD wallet for a specified account number for bip44 and bip49 derivations
    -c, --chain <chain>                          Imports an HD wallet for a specified (external/internal) chain for bip44 and bip49 derivations [possible values: 0, 1]
    -d, --derivation <"path">                    Imports an HD wallet for a specified derivation path (in quotes) [possible values: bip32, bip44, bip49, "<custom path>"]
        --extended-private <extended private>    Imports a partial HD wallet for a specified extended private key
        --extended-public <extended public>      Imports a partial HD wallet for a specified extended public key
    -i, --index <index>                          Imports an HD wallet for a specified index
    -m, --mnemonic <"mnemonic">                  Imports an HD wallet for a specified mnemonic (in quotes)
    -n, --network <network>                      Imports an HD wallet for a specified network [possible values: mainnet, testnet]
    -p, --password <password>                    Imports an HD wallet with a specified password

3.4.2 Ethereum

To import an Ethereum HD wallet, run:

wagyu ethereum import-hd [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -d, --derivation <"path">                    Imports an HD wallet for a specified derivation path (in quotes) [possible values: ethereum, keepkey, ledger-legacy, ledger-live, trezor, "<custom path>"]
        --extended-private <extended private>    Imports a partial HD wallet for a specified extended private key
        --extended-public <extended public>      Imports a partial HD wallet for a specified extended public key
    -i, --index <index>                          Imports an HD wallet with a specified index
    -k, --indices <num_indices>                  Imports an HD wallet with a specified number of indices
    -m, --mnemonic <"mnemonic">                  Imports an HD wallet for a specified mnemonic (in quotes)
    -p, --password <password>                    Imports an HD wallet with a specified password

3.4.3 Zcash

To import a Zcash HD wallet, run:

wagyu zcash import-hd [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
    -a, --account <account>                      Imports an HD wallet for a specified account number for bip44 and bip49 derivations
    -d, --derivation <"path">                    Imports an HD wallet for a specified derivation path (in quotes) [possible values: zip32, "<custom path>"]
        --diversifier <diversifier>              Imports an HD wallet with a specified Sapling address diversifier
        --extended-private <extended private>    Imports a partial HD wallet for a specified extended private key
        --extended-public <extended public>      Imports a partial HD wallet for a specified extended public key
    -i, --index <index>                          Imports an HD wallet for a specified index

3.5 Generate a cryptocurrency transaction

To import an HD cryptocurrency wallet, run:

wagyu [CRYPTOCURRENCY] transaction [FLAGS] [OPTIONS]

3.5.1 Bitcoin

To generate a Bitcoin transaction, run:

wagyu bitcoin transaction [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --createrawtransaction <inputs> <outputs>          Generates a raw Bitcoin transaction
                                                               Inputs format: '[{"txid":"txid", "vout":index},...]'
                                                               Outputs format: '{"address":amount,...}'                                           
        --lock-time <lock time>                            Specify a Bitcoin transaction lock time
        --signrawtransaction <transaction hex> <inputs>    Sign a raw Bitcoin transaction
                                                               Inputs format: '[{"txid":"txid", "vout":index, "amount":amount, "address":"address", "privatekey":"private_key"},...]'
                                                               (Optional: manually specify scriptPubKey and redeemScript)
        --version <version>                                Specify a Bitcoin transaction version

3.5.2 Ethereum

To generate an Ethereum transaction, run:

wagyu ethereum transaction [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --createrawtransaction <'{"to":"address", "value":"value", "gas":"gas", "gasPrice":"gas_price", "nonce":nonce, "network":"network"}'>    Generates a raw Ethereum transaction
        --network <network>                                                                                                                      Specify an Ethereum transaction network
        --signrawtransaction <transaction hex> <private key>                                                                                     Sign a raw Ethereum transaction

3.5.3 Zcash

To generate a Zcash transaction, run:

wagyu zcash transaction [FLAGS] [OPTIONS]

This command can be run with the following parameters:

FLAGS:
    -h, --help    Prints help information
    -j, --json    Prints the generated wallet(s) in JSON format

OPTIONS:
        --createrawtransaction <inputs> <outputs>          Generates a raw Zcash transaction
                                                               Inputs format: '[{"txid":"txid", "vout":index},...]'
                                                               Outputs format: '{"address":amount,...}'
        --expiry-height <expiry height>                    Specify a Zcash transaction expiry height
        --lock-time <lock time>                            Specify a Zcash transaction lock time
        --signrawtransaction <transaction hex> <inputs>    Sign a raw Zcash transaction
                                                               Inputs format: '[{"txid":"txid", "vout":index, "amount":amount, "address":"address", "privatekey":"private_key"},...]'
                                                               (Optional: manually specify scriptPubKey and redeemScript)
        --version <version>                                Specify a Zcash transaction version [possible values: sapling]

3.5.4 Transaction Remarks

wagyu CLI operates offline without chain state, and thus cannot immediately craft Monero transactions or Zcash Sapling spends (Zcash Sapling outputs are supported).

4. License

This work is licensed under either of the following licenses, at your discretion.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

wagyu's People

Contributors

amousa11 avatar andrewsb avatar chiefmatestarbuck avatar collinc97 avatar dependabot-preview[bot] avatar hdevalence avatar howardwu avatar isvforall avatar jakinyele avatar raychu86 avatar weikengchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wagyu's Issues

Hierarchical CLI

Summary

Rearchitect the CLI to provide coin specific flags, which can be accessible via the --help command.

Use wagyu and zcash-cli to get different signature results.

zcash-cli

./zcash-cli -conf=/blockchain/pkg/zcash/zcash.conf  createrawtransaction '[{"txid": "643020d7a70b7660b3b77550be9a4a8a54f8d088b5e3d5a887ade41848117829", "vout": 1}]' '{"tmF3uG6NKJXTvLFkXETx7NVxKwKWSBvPf21": "0.095"}'

0400008085202f89012978114818e4ad87a8d5e3b588d0f8548a4a9abe5075b7b360760ba7d72030640100000000ffffffff0160f59000000000001976a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac000000002c6811000000000000000000000000

./zcash-cli -conf=/blockchain/pkg/zcash/zcash.conf signrawtransaction 0400008085202f89012978114818e4ad87a8d5e3b588d0f8548a4a9abe5075b7b360760ba7d72030640100000000ffffffff0160f59000000000001976a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac000000002c6811000000000000000000000000
{
  "hex": "0400008085202f89012978114818e4ad87a8d5e3b588d0f8548a4a9abe5075b7b360760ba7d7203064010000006b483045022100f6b037872ad833c951869e63291364d2fed4e1de8dcc8157cfefebc86bfa34c202207a7fd5c72243eff854538f9aea3ed063f78ce3876048330a9f68353a3272cb07012102d46a5c8b2aa894c9efc9f7eb92efd1c150ecad55f892d5de61675d44968dcc8cffffffff0160f59000000000001976a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac000000002c6811000000000000000000000000",
  "complete": true
}

privkey

./zcash-cli -conf=/blockchain/pkg/zcash/zcash.conf  dumpprivkey tmCaNubpa6dFm5TJraf5u8dTbG6C4HpZp9R
cRy5WaeUyHx81JHpgJY7UdWaih43Demn9P2RGEoBNF8wfKvwuUg

rust

wagyu zcash transaction --signrawtransaction 0400008085202f89012978114818e4ad87a8d5e3b588d0f8548a4a9abe5075b7b360760ba7d72030640100000000ffffffff0160f59000000000001976a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac000000002c6811000000000000000000000000 '[{"txid": "643020d7a70b7660b3b77550be9a4a8a54f8d088b5e3d5a887ade41848117829", "vout": 1, "amount": 10000000, "address": "tmCaNubpa6dFm5TJraf5u8dTbG6C4HpZp9R", "privatekey": "cRy5WaeUyHx81JHpgJY7UdWaih43Demn9P2RGEoBNF8wfKvwuUgM"}]'

      Transaction Id       c0468a8fe42b019e159a2b970b05641372d1a84d2794de5115d6526da2e7903b
      Transaction Hex      0400008085202f89012978114818e4ad87a8d5e3b588d0f8548a4a9abe5075b7b360760ba7d7203064010000006b48304502210083d57dea4184ea79f8dde322e3ad0873cda078c5a21cb48427802a31c2f57aa602200d2ef3cf9c52d9ff292bad081f80d65e39cf4be90963166a86fbd39c70fb9a1d012102d46a5c8b2aa894c9efc9f7eb92efd1c150ecad55f892d5de61675d44968dcc8cffffffff0160f59000000000001976a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac000000002c6811000000000000000000000000

correct tx (already broadcast).

{
  "txid": "153903a49c861b7be6ae60a0b5588fccfed6b77e4eba8ba9667f3a5fdaa24827",
  "overwintered": true,
  "version": 4,
  "versiongroupid": "892f2085",
  "locktime": 0,
  "expiryheight": 1140780,
  "vin": [
    {
      "txid": "643020d7a70b7660b3b77550be9a4a8a54f8d088b5e3d5a887ade41848117829",
      "vout": 1,
      "scriptSig": {
        "asm": "3045022100f6b037872ad833c951869e63291364d2fed4e1de8dcc8157cfefebc86bfa34c202207a7fd5c72243eff854538f9aea3ed063f78ce3876048330a9f68353a3272cb07[ALL] 02d46a5c8b2aa894c9efc9f7eb92efd1c150ecad55f892d5de61675d44968dcc8c",
        "hex": "483045022100f6b037872ad833c951869e63291364d2fed4e1de8dcc8157cfefebc86bfa34c202207a7fd5c72243eff854538f9aea3ed063f78ce3876048330a9f68353a3272cb07012102d46a5c8b2aa894c9efc9f7eb92efd1c150ecad55f892d5de61675d44968dcc8c"
      },
      "sequence": 4294967295
    }
  ],
  "vout": [
    {
      "value": 0.09500000,
      "valueZat": 9500000,
      "valueSat": 9500000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 3a8b2f8d711643f5bff63945ef44c2973bab10ce OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9143a8b2f8d711643f5bff63945ef44c2973bab10ce88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "tmF3uG6NKJXTvLFkXETx7NVxKwKWSBvPf21"
        ]
      }
    }
  ],
  "vjoinsplit": [
  ],
  "valueBalance": 0.00000000,
  "valueBalanceZat": 0,
  "vShieldedSpend": [
  ],
  "vShieldedOutput": [
  ]
}

utxo

{
  "hex": "0400008085202f890126596ef647ad492797a9d99b48dd5c03d811ccde5e11054e2e8eb604ad077aa2010000009200483045022100fb2f6998f0403ff36b25c645e45fd4a0f1ad6e0e5bca97bc9f60d1e2cb2e46890220727b4e437ae4e95c4f1b42a31e230a8036a29a32e15f81c2a29dd97bb6e733080147512103c62099f3d6e10dc66506ce8e38bfd6b0edfaca3a15f580523a4665744ac197c521025f71d0afcdc77de9a595dd7c6546fdbe127588fdb4d1773d89056cde1101ead852aefeffffff0264495d05000000001976a914553dc540a3193e65cb7cd30d0614eb8c1b1c22ad88ac80969800000000001976a9141f665d94693ea7712530ee8460116cbf879858f488acf76711002a6811000000000000000000000000",
  "txid": "643020d7a70b7660b3b77550be9a4a8a54f8d088b5e3d5a887ade41848117829",
  "overwintered": true,
  "version": 4,
  "versiongroupid": "892f2085",
  "locktime": 1140727,
  "expiryheight": 1140778,
  "vin": [
    {
      "txid": "a27a07ad04b68e2e4e05115edecc11d8035cdd489bd9a9972749ad47f66e5926",
      "vout": 1,
      "scriptSig": {
        "asm": "0 3045022100fb2f6998f0403ff36b25c645e45fd4a0f1ad6e0e5bca97bc9f60d1e2cb2e46890220727b4e437ae4e95c4f1b42a31e230a8036a29a32e15f81c2a29dd97bb6e73308[ALL] 512103c62099f3d6e10dc66506ce8e38bfd6b0edfaca3a15f580523a4665744ac197c521025f71d0afcdc77de9a595dd7c6546fdbe127588fdb4d1773d89056cde1101ead852ae",
        "hex": "00483045022100fb2f6998f0403ff36b25c645e45fd4a0f1ad6e0e5bca97bc9f60d1e2cb2e46890220727b4e437ae4e95c4f1b42a31e230a8036a29a32e15f81c2a29dd97bb6e733080147512103c62099f3d6e10dc66506ce8e38bfd6b0edfaca3a15f580523a4665744ac197c521025f71d0afcdc77de9a595dd7c6546fdbe127588fdb4d1773d89056cde1101ead852ae"
      },
      "sequence": 4294967294
    }
  ],
  "vout": [
    {
      "value": 0.89999716,
      "valueZat": 89999716,
      "valueSat": 89999716,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 553dc540a3193e65cb7cd30d0614eb8c1b1c22ad OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914553dc540a3193e65cb7cd30d0614eb8c1b1c22ad88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "tmHV4mNJBbQsc8TraAfZhVpddch1GRtVWCw"
        ]
      }
    },
    {
      "value": 0.10000000,
      "valueZat": 10000000,
      "valueSat": 10000000,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 1f665d94693ea7712530ee8460116cbf879858f4 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a9141f665d94693ea7712530ee8460116cbf879858f488ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "tmCaNubpa6dFm5TJraf5u8dTbG6C4HpZp9R"
        ]
      }
    }
  ],
  "vjoinsplit": [
  ],
  "valueBalance": 0.00000000,
  "valueBalanceZat": 0,
  "vShieldedSpend": [
  ],
  "vShieldedOutput": [
  ],
  "blockhash": "0041a13f0150f09a93033d0e64f1617c8fe9cfe23c79e79d81521a39aeb8b602",
  "height": 1140739,
  "confirmations": 901,
  "time": 1603799809,
  "blocktime": 1603799809
}

Roadmap Question

First off, this is a fantastic project! Thank you for building it.

How deep down the wallet features past wallet generation and importing do you plan on going? I imagine wagyu would be a useful component in an offline signing solution for instance.

#![no_std] support

Tracking thread to determine how to incorporate #![no_std] (if at all) into wagyu.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Codecov reports are incorrect

Summary

Tarpaulin test coverage generates correct results at ~86-88% code coverage.
Codecov reports only the coverage from src/{coin}/network and src/{coin}/wordlist.

Steps to reproduce

  1. Commit and push to a branch, and wait for Travis CI to complete on stable branch
  2. See Tarpaulin coverage results at the bottom of the CI output
  3. See Codecov report from the upload link found in the bottom of the CI output

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Support Testnet Extended Keys

The following HD version bytes are unimplemented:

Coin Public Key Private Key Address Encoding BIP 32 Path
Bitcoin Testnet 0x043587cf - tpub 0x04358394 - tprv P2PKH or P2SH m/44'/1'
Bitcoin Testnet 0x044a5262 - upub 0x044a4e28 - uprv P2WPKH in P2SH m/49'/1'

This results in the following errors:

  1. Inability to generate any testnet extended public or private keys using new() or from_str methods
  2. Attempting to derive either of the above BIP 32 Path's will result in an incorrect Mainnet key generation.

Support Bitcoin derivation paths

Summary

  • m/0'/0' (bitcoin core)
  • m/0'/0 (Multibit)
  • m/44'/0'/0' (blockchain.info)
  • m/44'/0'/0'/0 (Electrum, Mycelium)
  • m/49'/0'/0'/0 (p2wpkh-in-p2sh)
  • m/84'/0'/0'/0 (p2wpkh bech32)

Wasm support

Tracking thread on efforts to provide wasm support for wagu.

Phase out ByteOrder uint conversions

Uint types (e.g. u32) have native to_le_bytes and to_be_bytes functions. This is preferred over the ByteOrder method of uint to byte conversion.

Expand cryptocurrencys?

Hello,
i have only one short questions, do you know a site where i can get informations about other cryptocurrencys and the variables that i must replace when i want to expand your prg?
thx

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Generate multiple addresses for the same wallet

Hello! Thanks for the awesome library!

I have an ethereum mnemonic and am trying to generate 10 addresses using BIP44. What's the best way to do this?

If I run wagyu ethereum hd --count 10 it generates 10 separate wallets, which is not what I want.

There sure are a lot of different ways of handling the path, but BIP44 defines the path as m / purpose' / coin_type' / account' / change / address_index. import-hd only has a flag for --index. I would like to set the account (and maybe change), too.

This probably belongs on a separate issue, but while trying to figure this out, I think --index is not working like I expect it to.

$ wagyu ethereum import-hd -m "virus harbor pact end relief change limit magnet screen term desert fit" -d "ethereum" --index 9

      Path                 m/44'/60'/0'/9
      Mnemonic             virus harbor pact end relief change limit magnet screen term desert fit
      Extended Private Key xprvA221HiWQYs4iPcXEEUxdTJqHncsaSMNotBhCtnC7CfJKscyA1MfxApf91xsNhFrMBfMFBbzkPjSAvbqCWiaXUAMPzzMS2jAy9pJ4npaLmmR
      Extended Public Key  xpub6F1MhE3JPEd1c6bhLWVdpSn2Lei4qp6fFQcohAbikzqJkRJJYtzCicycsGt7BURuCw4aHXqNir5fjmTbM4FiWwk4TWXvF74NspU4XnSHTes
      Private Key          451171f4c637bfb35d44d859886d363b64114d84afc3423c6606fed0a7ec3536
      Public Key           cdcf2b1c5bae5b57e1cc2f01c1b62f9c4cc75970d050d855052c7bfd3762582716a0e785182d18eee5c35678495a047b07d34566633f57e728d2246c9741f1e1
      Address              0x6b9472ebbfe4F7EF4eFe57013A5dC35303A6B452

I expected "Path" to be m/44'/60'/0'/0/9 like Ganache uses:

$ wagyu ethereum import-hd -m "virus harbor pact end relief change limit magnet screen term desert fit" -d "m/44'/60'/0'/0/9"

      Path                 m/44'/60'/0'/0/9
      Mnemonic             virus harbor pact end relief change limit magnet screen term desert fit
      Extended Private Key xprvA3yJkjbs6TKGjx6zr8fkWvDEkmEFfXqUziiQEFPTMMnai5qxbEvH4HBatpadpVN4B1j41rvyd1FvQkfuxvKq3H8rUGPJTAV9nsWboS6mY6e
      Extended Public Key  xpub6GxfAF8kvpsZxSBTxACkt49yJo4k4zZLMwe12do4uhKZatB78nEXc5W4k6zYwkYpgShfeRCJ714oz2TFjbGK6xZD8xDh3YgHzqWXwzeRfaG
      Private Key          5fdee1800c5263dc7e0cbcb52ba3a884837fe1bc077976fcc035b514157e9304
      Public Key           15dc3fd47a15120dff636be498cb88d5d13c8d4da3aa9962134076e83d9af60c3ed1508b7a77c16c4d33154ad2cee608398527bdc1d79253b1fee7856400747d
      Address              0x2A53D0f3310A5832d5A030b4b2f3E9C910C2AF7b

For now, I can build the path manually, but it would be nice if wagyu could do this for me.

Allow showing bech32 keys for imported wallet

I'd like to be able to do something like wagyu bitcoin import-hd -m "..." -d "m/84'/0'/0'/0/0" -f bech32 such that it prints out the address in bech32 format instead of P2PKH. Currently there doesn't appear to be any way to do this without code modification.

I'm happy to write a PR for this, but is this something you'd be interested in?

Wagyu build fails

Hi @howardwu,

When trying to run cargo install wagyu I'm hit with the following:

    Updating crates.io index
  Downloaded wagyu v0.6.3
  Downloaded 1 crate (48.9 KB) in 0.48s
  Installing wagyu v0.6.3
error: failed to compile `wagyu v0.6.3`, intermediate artifacts can be found at `/run/user/1000/cargo-installoftX6F`

Caused by:
  failed to select a version for the requirement `aes = "^0.2"`
  candidate versions found which didn't match: 0.8.2, 0.8.1, 0.8.0, ...
  location searched: crates.io index
  required by package `wagyu-zcash v0.6.3`
      ... which satisfies dependency `wagyu-zcash = "^0.6.3"` of package `wagyu v0.6.3`

Not sure if I'm doing something wrong or the app needs some update.

Electrum derivation path

I tried to derive some receiving address similar to Electrum derivation path (e.g. m/0/<n>) using following snippet, but the generated addresses is different with addresses that generated by Electrum.

type N = Mainnet;
let ext_key = BitcoinExtendedPublicKey::<N>::from_str("xpub....").unwrap();
let path = BitcoinDerivationPath::<N>::from_str("m/0/0").unwrap();
let child_key = ext_key.derive(&path).unwrap();
let addr = child_key.to_address(&child_key.format()).unwrap();
println!("Derived addr: {}", addr);

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Updating crates.io index
error: failed to select a version for the requirement `aes = "^0.2"`
candidate versions found which didn't match: 0.7.4, 0.7.3, 0.7.2, ...
location searched: crates.io index
required by package `fpe v0.1.0`
    ... which is depended on by `wagyu-zcash v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/zcash)`

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Compilation produces errors and fails

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/bitcoin/address.rs:28:13
   |
28 |             Type::P2PKH => Address::p2pkh(private_key),
   |             ^^^^^^^^^^^ help: consider using a reference: `&Type::P2PKH`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/bitcoin/address.rs:29:13
   |
29 |             Type::P2WPKH_P2SH => Address::p2wpkh_p2sh(private_key),
   |             ^^^^^^^^^^^^^^^^^ help: consider using a reference: `&Type::P2WPKH_P2SH`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/bitcoin/address.rs:75:13
   |
75 |             Network::Testnet => TESTNET_ADDRESS_BYTE,
   |             ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Testnet`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/bitcoin/privatekey.rs:90:13
   |
90 |             Network::Testnet => TESTNET_BYTE,
   |             ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Testnet`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/monero/network.rs:18:9
   |
18 |         Network::Testnet => Some(&[0x35]),
   |         ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Testnet`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/monero/network.rs:19:9
   |
19 |         Network::Mainnet => Some(&[0x12]),
   |         ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Mainnet`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/monero/network.rs:20:9
   |
20 |         Network::Error => Some(&[0x00]), // fix
   |         ^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Error`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/zcash/address.rs:24:13
   |
24 |             true => private_key.to_public_key().serialize().to_vec(),
   |             ^^^^ help: consider using a reference: `&true`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/zcash/address.rs:25:13
   |
25 |             false => private_key
   |             ^^^^^ help: consider using a reference: `&false`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/zcash/address.rs:36:13
   |
36 |             Network::Testnet => TESTNET_ADDRESS_BYTES,
   |             ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Testnet`

error[E0658]: non-reference pattern used to match a reference (see issue #42640)
  --> src/zcash/privatekey.rs:90:13
   |
90 |             Network::Testnet => TESTNET_BYTE,
   |             ^^^^^^^^^^^^^^^^ help: consider using a reference: `&Network::Testnet`

Bitcoin CLI bip49 derivation error

Bip49 keys are not generated properly:
Prefix is xprv and xpub instead of yprv and ypub.
Address format is p2pkh instead of p2sh_p2wpkh.

library doc

Hey, Where is the doc for using this as a library? All examples are about command line.

encryption

hello!
was lazy to read your code (sorry), do you encrypt your data in the wallet?
btw this project is amazing. I love cli programs and this one is really cool

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `bitvec = "^0.15"`
  candidate versions found which didn't match: 0.17.4
  location searched: crates.io index
required by package `parity-scale-codec v1.2.0`
    ... which is depended on by `impl-codec v0.4.2`
    ... which is depended on by `primitive-types v0.7.0`
    ... which is depended on by `ethereum-types v0.9.0`
    ... which is depended on by `wagyu-ethereum v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/ethereum)`
    ... which is depended on by `wagyu v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Commit Cargo.lock

I can't package this for NixOS without a Cargo.lock. Can you please commit it? Thanks.

Dependabot can't resolve your Rust dependency files

Dependabot can't resolve your Rust dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

    Updating crates.io index
error: failed to select a version for the requirement `bitvec = "^0.15"`
  candidate versions found which didn't match: 0.17.4
  location searched: crates.io index
required by package `parity-scale-codec v1.2.0`
    ... which is depended on by `impl-codec v0.4.2`
    ... which is depended on by `primitive-types v0.7.0`
    ... which is depended on by `ethereum-types v0.9.0`
    ... which is depended on by `wagyu-ethereum v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir/ethereum)`
    ... which is depended on by `wagyu v0.6.3 (/home/dependabot/dependabot-updater/dependabot_tmp_dir

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

`ethereum import-hd` fails with valid mnemonic

$ ./target/release/wagyu ethereum import-hd --mnemonic "candy maple cake sugar pudding cream honey rich smooth crumble sweet treat" --derivation "m/44'/60'/0'/0/0/"
Error: MnemonicError(WordlistError(InvalidWord("candy")))

Not sure why this is not working, this is clearly a valid mnemonic.

I got the following issue when using wagyu with yew.rs

Caused by:
0: error getting cargo metadata
1: cargo metadata exited with an error: Updating crates.io index
error: failed to select a version for the requirement aes = "^0.2"
candidate versions found which didn't match: 0.8.2, 0.8.1, 0.8.0, ...
location searched: crates.io index
required by package wagyu-zcash v0.6.3
... which satisfies dependency wagyu-zcash = "^0.6.3" of package wagyu v0.6.3
... which satisfies dependency wagyu = "^0.6.3" of package frontend v0.1.0 (/home/developer/Desktop/Folkseconomy/prototype-12/folkseconomy/frontend)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.