F483 / btctxstore

I simple library to store/retrieve information in bitcoin transactions using OP_RETURN
MIT License
10 stars 15 forks source link

Signing encoding error. #17

Open F483 opened 8 years ago

F483 commented 8 years ago

matthewr 7:04 AM @f483 on line 283 of control.py in btctxstore: the first parameter to struct needs to be a byte string otherwise it doesn't run on windows. I don't have commit access so I can't change this but might want to look into it.

I don't think its that simple, the error must be before that as all input should be sanitized and normalized before it gets that far. I will check if the unittest cover all possible inputs and add them if not. Then fix anything that breaks.

@robertsdotpm do you have a stack trace or the input that caused the problem.

littleskunk commented 8 years ago

Not sure if it is the stacktrace you are looking for:

Centos 7 Python 2.7.5 and 2.7.10 btctxstore 4.6.1

brandon [00:12]

dataserv-client --debug register 
2016-02-28 18:12:20,365 INFO dataserv_client.messaging 47: Query: http://status.driveshare.org/api/address
2016-02-28 18:12:20,549 ERROR dataserv_client.cli 251: Failed to serialize signature!
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/dataserv_client/cli.py", line 244, in main
    return getattr(client, command_name)(**arguments)
  File "/usr/lib/python2.7/site-packages/dataserv_client/api.py", line 102, in register
    self.messenger.register(payout_address)
  File "/usr/lib/python2.7/site-packages/dataserv_client/messaging.py", line 103, in register
    self.auth_address(), payout_addr
  File "/usr/lib/python2.7/site-packages/dataserv_client/messaging.py", line 43, in _url_query
    self.btctxstore, self._get_server_address(), self.wif
  File "/usr/lib/python2.7/site-packages/storjcore/auth.py", line 40, in create_headers
    signature = btctxstore.sign_unicode(sender_wif, msg)
  File "/usr/lib/python2.7/site-packages/btctxstore/api.py", line 180, in sign_unicode
    return self.sign_data(wif, hexdata)
  File "/usr/lib/python2.7/site-packages/btctxstore/api.py", line 163, in sign_data
    sigdata = control.sign_data(self.testnet, data, key)
  File "/usr/lib/python2.7/site-packages/btctxstore/control.py", line 299, in sign_data
    raise Exception("Failed to serialize signature!")
Exception: Failed to serialize signature!
Traceback (most recent call last):
  File "/usr/bin/dataserv-client", line 10, in <module>
    cli.main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/dataserv_client/cli.py", line 252, in main
    raise e
Exception: Failed to serialize signature!
littleskunk commented 8 years ago

Stacktrace changed. Reason unknown. Same stacktrace like https://github.com/F483/btctxstore/issues/11

I don't understand whats going on with this centos 7 pc. Never installed it but already hate it...

dataserv-client --store_path=/opt/storj/ --max_size=15942918602750 farm 
2016-02-28 19:30:27,954 INFO dataserv_client.messaging 47: Query: http://status.driveshare.org/api/address
2016-02-28 19:30:28,259 ERROR dataserv_client.cli 251: Struct() argument 1 must be string, not unicode
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/dataserv_client/cli.py", line 244, in main
    return getattr(client, command_name)(**arguments)
  File "/usr/lib/python2.7/site-packages/dataserv_client/api.py", line 316, in farm
    self.register()
  File "/usr/lib/python2.7/site-packages/dataserv_client/api.py", line 102, in register
    self.messenger.register(payout_address)
  File "/usr/lib/python2.7/site-packages/dataserv_client/messaging.py", line 103, in register
    self.auth_address(), payout_addr
  File "/usr/lib/python2.7/site-packages/dataserv_client/messaging.py", line 43, in _url_query
    self.btctxstore, self._get_server_address(), self.wif
  File "/usr/lib/python2.7/site-packages/storjcore/auth.py", line 40, in create_headers
    signature = btctxstore.sign_unicode(sender_wif, msg)
  File "/usr/lib/python2.7/site-packages/btctxstore/api.py", line 191, in sign_unicode
    return self.sign_data(wif, hexdata)
  File "/usr/lib/python2.7/site-packages/btctxstore/api.py", line 174, in sign_data
    sigdata = control.sign_data(self.testnet, data, key)
  File "/usr/lib/python2.7/site-packages/btctxstore/control.py", line 300, in sign_data
    sig = _add_recovery_params(i, compressed, sigdata)
  File "/usr/lib/python2.7/site-packages/btctxstore/control.py", line 283, in _add_recovery_params
    return struct.pack(">B", params) + sigdata
TypeError: Struct() argument 1 must be string, not unicode
Traceback (most recent call last):
  File "/usr/bin/dataserv-client", line 10, in <module>
    cli.main(sys.argv[1:])
  File "/usr/lib/python2.7/site-packages/dataserv_client/cli.py", line 252, in main
    raise e
TypeError: Struct() argument 1 must be string, not unicode
littleskunk commented 8 years ago

Now everything is working...

pip install --upgrade dataserv-client 
Requirement already up-to-date: partialhash>=1.1.0 in /usr/lib/python2.7/site-packages (from dataserv-client)
Requirement already up-to-date: storjcore>=0.0.6 in /usr/lib/python2.7/site-packages (from dataserv-client)
Requirement already up-to-date: future>=0.15.0 in /usr/lib/python2.7/site-packages (from dataserv-client)
Requirement already up-to-date: RandomIO>=0.2.1 in /usr/lib/python2.7/site-packages (from dataserv-client)
Requirement already up-to-date: storjnode>=0.0.18 in /usr/lib/python2.7/site-packages (from dataserv-client)
Collecting psutil>=3.2.2 (from dataserv-client)
  Using cached psutil-4.0.0.tar.gz
Collecting pycoin>=0.52 (from btctxstore>=4.6.0->dataserv-client)
  Using cached pycoin-0.62.tar.gz
Collecting six>=1.10.0 (from btctxstore>=4.6.0->dataserv-client)
  Using cached six-1.10.0-py2.py3-none-any.whl
Requirement already up-to-date: ecdsa>=0.13 in /usr/lib/python2.7/site-packages (from btctxstore>=4.6.0->dataserv-client)
Requirement already up-to-date: pycrypto>=2.6.1 in /usr/lib64/python2.7/site-packages (from storjcore>=0.0.6->dataserv-client)
Requirement already up-to-date: crochet>=1.4.0 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: netifaces>=0.10.4 in /usr/lib64/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: twisted>=15.4.0 in /usr/lib64/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: pyp2p>=0.4.5 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: ipaddress>=1.0.14 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: kademlia>=0.5 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: requests>=2.8.1 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: ntplib>=0.3.3 in /usr/lib/python2.7/site-packages (from storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: zope.interface>=3.6.0 in /usr/lib64/python2.7/site-packages (from twisted>=15.4.0->storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: pyroute2>=0.3.15 in /usr/lib/python2.7/site-packages (from pyp2p>=0.4.5->storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: rpcudp>=1.0 in /usr/lib/python2.7/site-packages (from kademlia>=0.5->storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: setuptools in /usr/lib/python2.7/site-packages (from zope.interface>=3.6.0->twisted>=15.4.0->storjnode>=0.0.18->dataserv-client)
Requirement already up-to-date: u-msgpack-python>=1.5 in /usr/lib/python2.7/site-packages (from rpcudp>=1.0->kademlia>=0.5->storjnode>=0.0.18->dataserv-client)
Installing collected packages: pycoin, six, btctxstore, psutil
  Found existing installation: pycoin 0.52
    Uninstalling pycoin-0.52:
      Successfully uninstalled pycoin-0.52
  Running setup.py install for pycoin
  Found existing installation: six 1.9.0
    Uninstalling six-1.9.0:
      Successfully uninstalled six-1.9.0
  Found existing installation: btctxstore 4.6.0
    Uninstalling btctxstore-4.6.0:
      Successfully uninstalled btctxstore-4.6.0
  Running setup.py install for btctxstore
  Found existing installation: psutil 1.2.1
    DEPRECATION: Uninstalling a distutils installed project (psutil) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling psutil-1.2.1:
      Successfully uninstalled psutil-1.2.1
  Running setup.py install for psutil
Successfully installed btctxstore-4.6.1 psutil-4.0.0 pycoin-0.62 six-1.10.0