Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ots verify fails if different rpcuser / rpcpassword for mainnet vs regtest in bitcoin.conf #108

Open
kristapsk opened this issue Dec 23, 2019 · 2 comments

Comments

@kristapsk
Copy link

My ~/.bitcoin/bitcoin.conf is something like this:

listen=1
server=1

[main]
bind=127.0.0.1
rpcuser=someuser1
rpcpassword=somepass1

[regtest]
bind=127.0.0.1
rpcuser=someuser2
rpcpassword=somepass2

With this setup ots stamp works without any issues, but when later doing ots verify, there's an error:

$ ots --no-cache verify Screenshot_20191222-191656.jpg.ots 
Assuming target filename is 'Screenshot_20191222-191656.jpg'
Got 1 attestation(s) from https://bob.btc.calendar.opentimestamps.org
Got 1 attestation(s) from https://btc.calendar.catallaxy.com
Got 1 attestation(s) from https://alice.btc.calendar.opentimestamps.org
Got 1 attestation(s) from https://finney.calendar.eternitywall.com
Traceback (most recent call last):
  File "/usr/bin/ots", line 11, in <module>
    load_entry_point('opentimestamps-client==0.7.0', 'console_scripts', 'ots')()
  File "/home/user/.local/lib64/python3.6/site-packages/otsclient/ots.py", line 34, in main
    args.cmd_func(args)
  File "/home/user/.local/lib64/python3.6/site-packages/otsclient/cmds.py", line 490, in verify_command
    if not verify_timestamp(detached_timestamp.timestamp, args):
  File "/home/user/.local/lib64/python3.6/site-packages/otsclient/cmds.py", line 412, in verify_timestamp
    block_count = proxy.getblockcount()
  File "/home/user/.local/lib64/python3.6/site-packages/bitcoin/rpc.py", line 460, in getblockcount
    return self._call('getblockcount')
  File "/home/user/.local/lib64/python3.6/site-packages/bitcoin/rpc.py", line 229, in _call
    response = self._get_response()
  File "/home/user/.local/lib64/python3.6/site-packages/bitcoin/rpc.py", line 260, in _get_response
    parse_float=decimal.Decimal)
  File "/usr/lib64/python3.6/json/__init__.py", line 367, in loads
    return cls(**kw).decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Workaround is to comment out regtest part of bitcoin.conf.

@RCasatta
Copy link
Member

I think we don't support the bitcoin conf with sections.

stamp is not using the local node at all, that's why it's working.

@petertodd
Copy link
Member

Yup, almost all the ots logic doesn't actually know about mainnet vs testnet/regtest, with the one exception of the RPC and initial python-bitcoinlib setup. Notably, just running ots verify against a non-mainnet timestamp will fail as the timestamp format itself doesn't distinguish between mainnet and testnet/regtest.

The underlying issue here is that python-bitcoinlib's RPC stuff doesn't support sections; just opened an issue: petertodd/python-bitcoinlib#218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants