1
0
mirror of https://github.com/bitcoinbook/bitcoinbook synced 2025-01-11 16:20:57 +00:00

Made changes to appdx-sx.asciidoc

This commit is contained in:
drusselloctal@gmail.com 2014-10-31 08:47:06 -07:00
parent ae46bf1ad8
commit 5c02ed6914

View File

@ -1,202 +1,207 @@
[[appdx_sx]] [[appdx_sx]]
[appendix] [appendix]
== Appendix: Available commands with sx tools == Available Commands with sx Tools
---- ----
The sx commands are: The sx commands are:
DEPRECATED DEPRECATED
ELECTRUM STYLE DETERMINISTIC KEYS AND ADDRESSES ELECTRUM STYLE DETERMINISTIC KEYS AND ADDRESSES
genaddr Generate a Bitcoin address deterministically from a wallet genaddr Generate a Bitcoin address deterministically from a wallet
seed or master public key. seed or master public key.
genpriv Generate a private key deterministically from a seed. genpriv Generate a private key deterministically from a seed.
genpub Generate a public key deterministically from a wallet genpub Generate a public key deterministically from a wallet
seed or master public key. seed or master public key.
mpk Extract a master public key from a deterministic wallet seed. mpk Extract a master public key from a deterministic wallet seed.
newseed Create a new deterministic wallet seed. newseed Create a new deterministic wallet seed.
EXPERIMENTAL EXPERIMENTAL
APPS APPS
wallet Experimental command line wallet. wallet Experimental command line wallet.
OFFLINE BLOCKCHAIN OFFLINE BLOCKCHAIN
HEADERS HEADERS
showblkhead Show the details of a block header. showblkhead Show the details of a block header.
OFFLINE KEYS AND ADDRESSES OFFLINE KEYS AND ADDRESSES
BASIC BASIC
addr See Bitcoin address of a public or private key. addr See Bitcoin address of a public or private key.
embed-addr Generate an address used for embedding record of data into the blockchain embed-addr Generate an address used for embedding record of data into the
get-pubkey Get the pubkey of an address if available blockchain
newkey Create a new private key. get-pubkey Get the pubkey of an address if available
pubkey See the public part of a private key. newkey Create a new private key.
validaddr Validate an address. pubkey See the public part of a private key.
BRAIN STORAGE validaddr Validate an address.
brainwallet Make 256 bit bitcoin private key from an arbitrary passphrase. BRAIN STORAGE
mnemonic Make 12 word mnemonic out of 128 bit electrum or bip32 seed. brainwallet Make 256 bit bitcoin private key from an arbitrary passphrase.
HD / BIP32 mnemonic Make 12 word mnemonic out of 128 bit electrum or bip32 seed.
hd-priv Create an private HD key from another HD private key. HD / BIP32
hd-pub Create an HD public key from another HD private or public key. hd-priv Create an private HD key from another HD private key.
hd-seed Create a random new HD key. hd-pub Create an HD public key from another HD private or public key.
hd-to-address Convert an HD public or private key to a Bitcoin address. hd-seed Create a random new HD key.
hd-to-wif Convert an HD private key to a WIF private key. hd-to-address Convert an HD public or private key to a Bitcoin address.
MULTISIG ADDRESSES hd-to-wif Convert an HD private key to a WIF private key.
scripthash Create BIP 16 script hash address from raw script hex. MULTISIG ADDRESSES
STEALTH scripthash Create BIP 16 script hash address from raw script hex.
stealth-addr See a stealth address from given input. STEALTH
stealth-initiate Initiate a new stealth payment. stealth-addr See a stealth address from given input.
stealth-newkey Generate new stealth keys and an address. stealth-initiate Initiate a new stealth payment.
stealth-show-addr Show details for a stealth address. stealth-newkey Generate new stealth keys and an address.
stealth-uncover Uncover a stealth address. stealth-show-addr Show details for a stealth address.
stealth-uncover-secret Uncover a stealth secret. stealth-uncover Uncover a stealth address.
stealth-uncover-secret Uncover a stealth secret.
OFFLINE TRANSACTIONS
SCRIPTING OFFLINE TRANSACTIONS
mktx Create an unsigned tx. SCRIPTING
rawscript Create the raw hex representation from a script. mktx Create an unsigned tx.
set-input Set a transaction input. rawscript Create the raw hex representation from a script.
showscript Show the details of a raw script. set-input Set a transaction input.
showtx Show the details of a transaction. showscript Show the details of a raw script.
sign-input Sign a transaction input. showtx Show the details of a transaction.
unwrap Validates checksum and recovers version byte and original data from hexstring. sign-input Sign a transaction input.
validsig Validate a transaction input's signature. unwrap Validates checksum and recovers version byte and original data
wrap Adds version byte and checksum to hexstring. from hexstring.
validsig Validate a transaction input's signature.
ONLINE (BITCOIN P2P) wrap Adds version byte and checksum to hexstring.
BLOCKCHAIN UPDATES
sendtx-node Send transaction to a single node. ONLINE (BITCOIN P2P)
sendtx-p2p Send tx to bitcoin network. BLOCKCHAIN UPDATES
sendtx-node Send transaction to a single node.
ONLINE (BLOCKCHAIN.INFO) sendtx-p2p Send tx to bitcoin network.
BLOCKCHAIN QUERIES (blockchain.info)
bci-fetch-last-height Fetch the last block height using blockchain.info. ONLINE (BLOCKCHAIN.INFO)
bci-history Get list of output points, values, and their spends BLOCKCHAIN QUERIES (blockchain.info)
from blockchain.info bci-fetch-last-height Fetch the last block height using blockchain.info.
BLOCKCHAIN UPDATES bci-history Get list of output points, values, and their spends
sendtx-bci Send tx to blockchain.info/pushtx. from blockchain.info
BLOCKCHAIN UPDATES
ONLINE (BLOCKEXPLORER.COM) sendtx-bci Send tx to blockchain.info/pushtx.
BLOCKCHAIN QUERIES (blockexplorer.com)
blke-fetch-transaction Fetches a transaction from blockexplorer.com ONLINE (BLOCKEXPLORER.COM)
BLOCKCHAIN QUERIES (blockexplorer.com)
ONLINE (OBELISK) blke-fetch-transaction Fetches a transaction from blockexplorer.com
BLOCKCHAIN QUERIES
balance Show balance of a Bitcoin address in satoshis. ONLINE (OBELISK)
fetch-block-header Fetch raw block header. BLOCKCHAIN QUERIES
fetch-last-height Fetch the last block height. balance Show balance of a Bitcoin address in satoshis.
fetch-stealth Fetch a stealth information using a network connection to fetch-block-header Fetch raw block header.
make requests against the obelisk load balancer backend. fetch-last-height Fetch the last block height.
fetch-transaction Fetch a raw transaction using a network connection to fetch-stealth Fetch a stealth information using a network connection
make requests against the obelisk load balancer backend. to make requests against the obelisk load balancer backend.
fetch-transaction-index fetch-transaction Fetch a raw transaction using a network connection to
Fetch block height and index in block of transaction. make requests against the obelisk load balancer backend.
get-utxo Get enough unspent transaction outputs from a given set of fetch-transaction-index
addresses to pay a given number of satoshis Fetch block height and index in block of transaction.
history Get list of output points, values, and their spends for an get-utxo Get enough unspent transaction outputs from a given set
address. grep can filter for just unspent outputs which can of addresses to pay a given number of satoshis.
be fed into mktx. history Get list of output points, values, and their spends for
validtx Validate a transaction. an address. grep can filter for just unspent outputs which can
BLOCKCHAIN UPDATES be fed into mktx.
sendtx-obelisk Send tx to obelisk server. validtx Validate a transaction.
BLOCKCHAIN WATCHING BLOCKCHAIN UPDATES
monitor Monitor an address. sendtx-obelisk Send tx to obelisk server.
watchtx Watch transactions from the network searching for a certain hash. BLOCKCHAIN WATCHING
OBELISK ADMIN monitor Monitor an address.
initchain Initialize a new blockchain. watchtx Watch transactions from the network searching for a certain
hash.
UTILITY OBELISK ADMIN
EC MATH initchain Initialize a new blockchain.
ec-add-modp Calculate the result of INTEGER + INTEGER.
ec-multiply Multiply an integer and a point together. UTILITY
ec-tweak-add Calculate the result of POINT + INTEGER * G. EC MATH
FORMAT (BASE 58) ec-add-modp Calculate the result of INTEGER + INTEGER.
base58-decode Convert from base58 to hex ec-multiply Multiply an integer and a point together.
base58-encode Convert from hex to base58 ec-tweak-add Calculate the result of POINT + INTEGER * G.
FORMAT (BASE58CHECK) FORMAT (BASE 58)
base58check-decode Convert from base58check to hex base58-decode Convert from base58 to hex.
base58check-encode Convert from hex to base58check base58-encode Convert from hex to base58.
decode-addr Decode a address from base58check form to internal RIPEMD representation FORMAT (BASE58CHECK)
encode-addr Encode an address from internal RIPEMD representation to base58check form base58check-decode Convert from base58check to hex.
FORMAT (WIF) base58check-encode Convert from hex to base58check.
secret-to-wif Convert a secret exponent value to Wallet Import Format decode-addr Decode a address from base58check form to internal RIPEMD
wif-to-secret Convert a Wallet Import Format to secret exponent value. representation.
HASHES encode-addr Encode an address from internal RIPEMD representation to
ripemd-hash RIPEMD hash data from STDIN. base58check form.
sha256 Perform SHA256 hash of data. FORMAT (WIF)
MISC secret-to-wif Convert a secret exponent value to Wallet Import Format
qrcode Generate Bitcoin QR codes offline. wif-to-secret Convert a Wallet Import Format to secret exponent value.
SATOSHI MATH HASHES
btc Convert Satoshis into Bitcoins. ripemd-hash RIPEMD hash data from STDIN.
satoshi Convert Bitcoins into Satoshis. sha256 Perform SHA256 hash of data.
MISC
See 'sx help COMMAND' for more information on a specific command. qrcode Generate Bitcoin QR codes offline.
SATOSHI MATH
---- btc Convert Satoshis into Bitcoins.
satoshi Convert Bitcoins into Satoshis.
Below, we look at some examples of using sx tools to experiment with keys and addresses.
See 'sx help COMMAND' for more information on a specific command.
Generate a new private key with the operating system's random number generator by using the +newkey+ command. We save the standard output into the file +private_key+:
----
----
$ sx newkey > private_key Below, we look at some examples of using sx tools to experiment with keys and addresses.
$ cat private_key
5Jgx3UAaXw8AcCQCi1j7uaTaqpz2fqNR9K3r4apxdYn6rTzR1PL Generate a new private key with the operating system's random number generator by using the +newkey+ command. We save the standard output into the file +private_key+:
----
----
Now, generate the public key from that private key using the +pubkey+ command. Pass the +private_key+ file into the standard input and save the standard output of the command into a new file +public_key+: $ sx newkey > private_key
$ cat private_key
---- 5Jgx3UAaXw8AcCQCi1j7uaTaqpz2fqNR9K3r4apxdYn6rTzR1PL
$ sx pubkey < private_key > public_key ----
$ cat public_key
02fca46a6006a62dfdd2dbb2149359d0d97a04f430f12a7626dd409256c12be500 Now, generate the public key from that private key using the +pubkey+ command. Pass the +private_key+ file into the standard input and save the standard output of the command into a new file +public_key+:
----
----
We can re-format the public_key as an address using the +addr+ command. We pass the +public_key+ into standard input: $ sx pubkey < private_key > public_key
$ cat public_key
---- 02fca46a6006a62dfdd2dbb2149359d0d97a04f430f12a7626dd409256c12be500
$ sx addr < public_key ----
17re1S4Q8ZHyCP8Kw7xQad1Lr6XUzWUnkG
---- We can re-format the public_key as an address using the +addr+ command. We pass the +public_key+ into standard input:
The keys generated above are so called type-0 non-deterministic keys. That means that each one is generated from a random number generator. The sx tools also support type-2 deterministic keys, where a "master" key is created and then extended to produce a chain or tree of subkeys. ----
$ sx addr < public_key
First, we generate a "seed" that will be used as the basis to derive a chain of keys, compatible with the Electrum wallet and other similar implementations. We use the +newseed+ command to produce a seed value: 17re1S4Q8ZHyCP8Kw7xQad1Lr6XUzWUnkG
----
----
$ sx newseed > seed The keys generated above are so called type-0 non-deterministic keys. That means that each one is generated from a random number generator. The sx tools also support type-2 deterministic keys, where a "master" key is created and then extended to produce a chain or tree of subkeys.
$ cat seed
eb68ee9f3df6bd4441a9feadec179ff1 First, we generate a "seed" that will be used as the basis to derive a chain of keys, compatible with the Electrum wallet and other similar implementations. We use the +newseed+ command to produce a seed value:
----
----
The seed value can also be exported as a word mnemonic that is human readable and easier to store and type than a hexadecimal string $ sx newseed > seed
using the +mnemonic+ command: $ cat seed
eb68ee9f3df6bd4441a9feadec179ff1
---- ----
$ sx mnemonic < seed > words
$ cat words The seed value can also be exported as a word mnemonic that is human readable and easier to store and type than a hexadecimal string
adore repeat vision worst especially veil inch woman cast recall dwell appreciate using the +mnemonic+ command:
----
----
The mnemonic words can be used to reproduce the seed using the +mnemonic+ command again: $ sx mnemonic < seed > words
$ cat words
---- adore repeat vision worst especially veil inch woman cast recall dwell appreciate
$ sx mnemonic < words ----
eb68ee9f3df6bd4441a9feadec179ff1
---- The mnemonic words can be used to reproduce the seed using the +mnemonic+ command again:
With the seed, we can now generate a sequence of private and public keys, a key chain. We use the +genpriv+ command to generate a sequence of private keys from a seed and the +addr+ command to generate the corresponding public key. ----
$ sx mnemonic < words
[source,bash] eb68ee9f3df6bd4441a9feadec179ff1
---- ----
$ sx genpriv 0 < seed
5JzY2cPZGViPGgXZ4Syb9Y4eUGjJpVt6sR8noxrpEcqgyj7LK7i With the seed, we can now generate a sequence of private and public keys, a key chain. We use the +genpriv+ command to generate a sequence of private keys from a seed and the +addr+ command to generate the corresponding public key.
$ sx genpriv 0 < seed | sx addr
1esVQV2vR9JZPhFeRaeWkAhzmWq7Fi7t7 [source,bash]
----
$ sx genpriv 1 < seed $ sx genpriv 0 < seed
5JdtL7ckAn3iFBFyVG1Bs3A5TqziFTaB9f8NeyNo8crnE2Sw5Mz 5JzY2cPZGViPGgXZ4Syb9Y4eUGjJpVt6sR8noxrpEcqgyj7LK7i
$ sx genpriv 1 < seed | sx addr $ sx genpriv 0 < seed | sx addr
1G1oTeXitk76c2fvQWny4pryTdH1RTqSPW 1esVQV2vR9JZPhFeRaeWkAhzmWq7Fi7t7
----
$ sx genpriv 1 < seed
5JdtL7ckAn3iFBFyVG1Bs3A5TqziFTaB9f8NeyNo8crnE2Sw5Mz
$ sx genpriv 1 < seed | sx addr
1G1oTeXitk76c2fvQWny4pryTdH1RTqSPW
----
With deterministic keys we can generate and re-generate thousands of keys, all derived from a single seed in a deterministic chain. This technique is used in many wallet applications to generate keys that can be backed up and restored with a simple multi-word mnemonic. This is easier than having to back up the wallet with all its randomly generated keys every time a new key is created. With deterministic keys we can generate and re-generate thousands of keys, all derived from a single seed in a deterministic chain. This technique is used in many wallet applications to generate keys that can be backed up and restored with a simple multi-word mnemonic. This is easier than having to back up the wallet with all its randomly generated keys every time a new key is created.