3 个版本
0.6.3 | 2020年3月31日 |
---|---|
0.6.1 | 2019年9月17日 |
0.6.0 | 2019年8月13日 |
#2727 in 魔法豆
每月21次 下载
2MB
37K SLoC
目录
1. 简介
Wagyu 是一款功能丰富的命令行工具,用于生成加密货币钱包。
Wagyu 允许开发者使用以下模块构建自己的加密货币应用程序。
库 | 标准钱包 | HD 钱包 | 助记词 | 网络 |
---|---|---|---|---|
wagyu-bitcoin |
|
|
|
|
wagyu-ethereum |
|
|
|
|
wagyu-monero |
|
|
|
|
wagyu-zcash |
|
|
|
|
Wagyu 可以通过实现本模块中概述的模型来支持新的加密货币。
库 | 标准钱包 | HD 钱包 | 助记词 | 网络 |
---|---|---|---|---|
wagyu_model |
2. 构建指南
2.1 安装 Rust
我们建议使用 rustup 安装 Rust。您可以按照以下步骤安装 rustup
-
macOS 或 Linux
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
-
Windows (64位)
下载 Windows 64位可执行文件 并按照屏幕上的说明操作。
-
Windows (32位)
下载 Windows 32位可执行文件 并按照屏幕上的说明操作。
2.2a 使用 Homebrew 构建 (适用于 macOS)
对于macOS用户,我们建议通过Homebrew安装wagyu
,具体方法如下:
brew install wagyu
2.2b 从 Crates.io 构建
我们建议这样安装wagyu
。在你的终端中运行:
cargo install wagyu
现在要使用wagyu
,在你的终端中运行:
wagyu
2.2c 从源代码构建
或者,你可以按照以下方法从源代码构建wagyu
进行安装:
# Download the source code
git clone https://github.com/AleoHQ/wagyu
cd wagyu
# Build in release mode
$ cargo build --release
这将在./target/release
目录下生成一个可执行文件。要使用wagyu,请运行以下命令:
./target/release/wagyu
3. 使用指南
3.1 生成加密货币钱包
要生成加密货币钱包,运行:
wagyu [CRYPTOCURRENCY] [FLAGS] [OPTIONS]
3.1.1 比特币
要生成比特币钱包,运行:
wagyu bitcoin [FLAGS] [OPTIONS]
命令可以运行以下可选参数:
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 以太坊
要生成以太坊钱包,运行:
wagyu ethereum [FLAGS] [OPTIONS]
命令可以运行以下可选参数:
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 门罗币
要生成门罗币钱包,运行:
wagyu monero [FLAGS] [OPTIONS]
命令可以运行以下参数:
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钱包,运行:
wagyu zcash [FLAGS] [OPTIONS]
命令可以运行以下参数:
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 生成 HD 加密货币钱包
要生成HD加密货币钱包,运行:
wagyu [CRYPTOCURRENCY] hd [FLAGS] [OPTIONS]
3.2.1 比特币
要生成比特币HD钱包,运行:
wagyu bitcoin hd [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 以太坊
要生成以太坊HD钱包,运行:
wagyu ethereum hd [FLAGS] [OPTIONS]
命令可以运行以下参数:
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>"]
-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 挖币
要生成挖币HD钱包,运行:
wagyu zcash hd [FLAGS] [OPTIONS]
命令可以运行以下参数:
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 导入加密货币钱包
要导入加密货币钱包,运行:
wagyu [CRYPTOCURRENCY] import [FLAGS] [OPTIONS]
3.3.1 比特币
要导入比特币钱包,运行:
wagyu bitcoin import [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 以太坊
要导入以太坊钱包,运行:
wagyu ethereum import [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 门罗币
要导入门罗币钱包,运行:
wagyu monero import [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 挖币
要导入挖币钱包,运行:
wagyu zcash import [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 导入 HD 加密货币钱包
要导入HD加密货币钱包,运行:
wagyu [CRYPTOCURRENCY] import-hd [FLAGS] [OPTIONS]
3.4.1 比特币
要导入比特币HD钱包,运行:
wagyu bitcoin hd [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 以太坊
要导入以太坊HD钱包,运行:
wagyu ethereum hd [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 for a specified index
-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 挖币
要导入挖币HD钱包,运行:
wagyu zcash hd [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 生成加密货币交易
要导入HD加密货币钱包,运行:
wagyu [CRYPTOCURRENCY] transaction [FLAGS] [OPTIONS]
3.5.1 比特币
要生成比特币交易,运行:
wagyu bitcoin transaction [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 以太坊
要生成以太坊交易,运行:
wagyu ethereum transaction [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 挖币
要生成挖币交易,运行:
wagyu zcash transaction [FLAGS] [OPTIONS]
此命令可以运行以下参数:
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 交易备注
wagyu
CLI在离线状态下操作,不包含链状态,因此无法立即构建门罗币交易或Zcash Sapling消费(Zcash Sapling输出是支持的)。
4. 许可证
此作品根据以下任一许可证授权,由您自行选择。
- Apache License Version 2.0(LICENSE-APACHE或http://www.apache.org/licenses/LICENSE-2.0)
- MIT许可证(LICENSE-MIT或http://opensource.org/licenses/MIT)
除非您明确说明,否则根据Apache-2.0许可证定义,您有意提交的任何贡献,将按照上述方式双授权,不附加任何额外条款或条件。
依赖关系
~81MB
~401K SLoC