Closed skaht closed 8 years ago
The error is coming from one command, but there are 10 commands chained in the repro, as well as a config file. It would be helpful if you could reduce the repro to a single command and determine whether it requires the config file or whether that is independent.
My error...
When using a default bx-mainnet.cfg file, per your recommendation, the hd-to-ec sub-command required an additional bx-dashnet.cfg file argument to function properly.
When bx is configured for the mainnet the following behavior is correct for Dash.
% echo 'drkpS4gwHYvBt8DfUAbDGWZ7JCKxvZ5w9HFdm6GgNCmofRqUrE7MHfZC4Am7h1iseBdEXHVMtXmhoHSxWCwurGCs7gZkzdGBBJM4mDuARDozoWq' | bx hd-to-ec -c bx-dashnet.cfg | bx ec-to-wif -v 204
XH2Yndjv6Ks3XEHGaSMDhUMTAMZTTWv5nEN958Y7VMyQXBCJVQmM
Cool. I'm still a little confused as to what the error message is based on. This is a boost:program_options
message, so not entirely under our control. My concern is that the message refers to a non-existent parameter definition (ERROR_VERSION
). Anything you could do to help isolate that would be appreciated.
Notice the results when I'm using a default bx-mainnet.cfg file (set by the BX_CONFIG environmental variable), and Dash HD extended private key. The hd-to-ec fails without a bx-dashnet.cfg file being explicitly passed.
% echo 'drkpS4gwHYvBt8DfUAbDGWZ7JCKxvZ5w9HFdm6GgNCmofRqUrE7MHfZC4Am7h1iseBdEXHVMtXmhoHSxWCwurGCs7gZkzdGBBJM4mDuARDozoWq' | bx hd-to-ec
ERROR_VERSION
What about with no config file and without the env var set, or if you don't pipe the parameter but set it directly on the command line? Also, use the settings
command to ensure the config file is being read as expected.
% echo $BX_CONFIG
/Users/XXX/Projects/bitcoin-explorer/bx-mainnet.cfg
Immediately followed by:
% bx settings
settings
{
network
{
channel_handshake_seconds 30
connect_retries 0
connect_timeout_seconds 5
debug_file debug.log
error_file error.log
hosts_file hosts.cache
identifier 3652501241
seeds seed.bitnodes.io:8333,seed.bitcoinstats.com:8333,seed.bitcoin.sipa.be:8333,dnsseed.bluematt.me:8333,seed.bitcoin.jonasschnelli.ch:8333,dnsseed.bitcoin.dashjr.org:8333
}
server
{
cert_file ""
connect_retries 0
connect_timeout_seconds 5
server_cert_key ""
url tcp://obelisk.airbitz.co:9091
}
wallet
{
hd_public_version 76067358
hd_secret_version 76066276
pay_to_public_key_hash_version 0
pay_to_script_hash_version 5
transaction_version 1
wif_version 128
}
}
Immediately followed by:
% echo 'drkpS4gwHYvBt8DfUAbDGWZ7JCKxvZ5w9HFdm6GgNCmofRqUrE7MHfZC4Am7h1iseBdEXHVMtXmhoHSxWCwurGCs7gZkzdGBBJM4mDuARDozoWq' | bx hd-to-ec
ERROR_VERSION
Immediately followed by:
% unsetenv BX_CONFIG
% echo $BX_CONFIG
BX_CONFIG: Undefined variable.
Immediately followed by:
% bx settings
settings
{
network
{
channel_handshake_seconds 30
connect_retries 0
connect_timeout_seconds 5
debug_file debug.log
error_file error.log
hosts_file hosts.cache
identifier 3652501241
seeds seed.bitnodes.io:8333,seed.bitcoinstats.com:8333,seed.bitcoin.sipa.be:8333,dnsseed.bluematt.me:8333,seed.bitcoin.jonasschnelli.ch:8333,dnsseed.bitcoin.dashjr.org:8333
}
server
{
cert_file ""
connect_retries 0
connect_timeout_seconds 5
server_cert_key ""
url tcp://obelisk.airbitz.co:9091
}
wallet
{
hd_public_version 76067358
hd_secret_version 76066276
pay_to_public_key_hash_version 0
pay_to_script_hash_version 5
transaction_version 1
wif_version 128
}
}
Immediately followed by:
% echo 'drkpS4gwHYvBt8DfUAbDGWZ7JCKxvZ5w9HFdm6GgNCmofRqUrE7MHfZC4Am7h1iseBdEXHVMtXmhoHSxWCwurGCs7gZkzdGBBJM4mDuARDozoWq' | bx hd-to-ec
ERROR_VERSION
Immediately followed by:
% echo 'drkpS4gwHYvBt8DfUAbDGWZ7JCKxvZ5w9HFdm6GgNCmofRqUrE7MHfZC4Am7h1iseBdEXHVMtXmhoHSxWCwurGCs7gZkzdGBBJM4mDuARDozoWq' | bx hd-to-ec -c bx-dashnet.cfg | bx ec-to-wif -v 204
XH2Yndjv6Ks3XEHGaSMDhUMTAMZTTWv5nEN958Y7VMyQXBCJVQmM
Immediately followed by:
% bx settings -c bx-dashnet.cfg
settings
{
network
{
channel_handshake_seconds 30
connect_retries 0
connect_timeout_seconds 5
debug_file debug.log
error_file error.log
hosts_file hosts.cache
identifier 3652501241
seeds testnet-seed.alexykot.me:9999,testnet-seed.bitcoin.petertodd.org:9999,testnet-seed.bluematt.me:9999,testnet-seed.bitcoin.schildbach.de:9999
}
server
{
cert_file ""
connect_retries 0
connect_timeout_seconds 5
server_cert_key ""
url tcp://obelisk-testnet.airbitz.co:9091
}
wallet
{
hd_public_version 50221816
hd_secret_version 50221772
pay_to_public_key_hash_version 76
pay_to_script_hash_version 16
transaction_version 1
wif_version 204
}
}
Watch this hat trick:
% echo 'very complex gibberish' | bx base16-encode | bx sha256 | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 5 | bx hd-private -d -i 0 | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-ec | bx ec-to-wif -v 204
XH2Yndjv6Ks3XEHGaSMDhUMTAMZTTWv5nEN958Y7VMyQXBCJVQmM
The result above produces the correct results without introducing the -v 50221772
to the hd-new in the middle above and appears to work with any default altcoin config file. The wallet settings below are for DOGE.
bx settings
settings
{
network
{
channel_handshake_seconds 30
connect_retries 0
connect_timeout_seconds 5
debug_file debug.log
error_file error.log
hosts_file hosts.cache
identifier 3652501241
seeds testnet-seed.alexykot.me:9999,testnet-seed.bitcoin.petertodd.org:9999,testnet-seed.bluematt.me:9999,testnet-seed.bitcoin.schildbach.de:9999
}
server
{
cert_file ""
connect_retries 0
connect_timeout_seconds 5
server_cert_key ""
url tcp://obelisk-testnet.airbitz.co:9091
}
wallet
{
hd_public_version 49990397
hd_secret_version 49988504
pay_to_public_key_hash_version 30
pay_to_script_hash_version 22
transaction_version 1
wif_version 158
}
}
Note the results below are the correct BIP 44 results for Dash when using a default bx-doge.cfg wallet parameters.
% echo 'very complex gibberish' | bx base16-encode | bx sha256 | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 5 | bx hd-private -d -i 0 | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-ec | bx ec-to-wif -v 204
XH2Yndjv6Ks3XEHGaSMDhUMTAMZTTWv5nEN958Y7VMyQXBCJVQmM <- Dash WIF Key
While the following is correct for default BIP 44 results for DOGE using a default bx-doge.cfg wallet parameters.
% echo 'very complex gibberish' | bx base16-encode | bx sha256 | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 3 | bx hd-private -d -i 0 | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-ec | bx ec-to-wif
QVi4p8ZFQnA2MWCURCEpdDR67CNtyxgWVEs8ki1LR9DhTwCxFu9k <- DOGE WIF Key
% echo 'very complex gibberish' | bx base16-encode | bx sha256 | bx hd-new | bx hd-private -d -i 44 | bx hd-private -d -i 3 | bx hd-private -d -i 0 | bx hd-private -i 0 | bx hd-private -i 0 | bx hd-to-ec | bx ec-to-public | bx ec-to-address
DSRMRapZ7GNwPTxEN7k3YoCnDJBzvhS2mg <- DOGE Address
So do you get ERROR_VERSION
if you don't echo the parameter?
I'm toggling the environmental variable BX_CONFIG to point at either bx-mainnet.cfg or bx-dashnet.cfg
bx-mainnet.cfg file contains:
bx-dashnet.cfg file contains:
When BX_CONFIG points to bx-mainnet.cfg:
1) Behaves as expected:
2) Behaves as expected, using "-v 76066276":
3) Behaves as expected, subset of step number 2:
4) Unexpected behavior:
5) Should be useful for trouble shooting, subset of step 4:
When BX_CONFIG points to bx-dashnet.cfg:
6) Behaves as expected, contrast results to step #5:
7) Behaves as expected:
8) Behaves as expected, added "-v 50221772" to hd-new:
9) Unexpected behavior:
10) Seems to behave as expected without hd-to-ec, contrast results to step 3: