bigchaindb: Error: bdb.transactions.send_commit(fulfilled_creation_tx)
What Should Go in a Bug Report
- What computer are you on (hardware)? AWS x64
- What operating system are you using? Canonical, Ubuntu, 18.04 LTS
- What version of BigchainDB software were you using? 2.0.0b3
I have followed the directions & successfully able to setup the network & see the api end-points exposed.
But when i am posting transaction from python on local host machine then i am getting error, see the details below.
Code snippet - bdb.transactions.send_commit is throwing error.
from bigchaindb_driver import BigchainDB bdb_root_url = '0.0.0.0:9984' # Use YOUR BigchainDB Root URL here bdb = BigchainDB(bdb_root_url) bicycle = { 'data': { 'bicycle': { 'serial_number': 'abcd1234', 'manufacturer': 'bkfab', }, }, } metadata = {'planet': 'earth'} from bigchaindb_driver.crypto import generate_keypair alice, bob = generate_keypair(), generate_keypair() prepared_creation_tx = bdb.transactions.prepare( operation='CREATE', signers=alice.public_key, asset=bicycle, metadata=metadata,) prepared_creation_tx fulfilled_creation_tx = bdb.transactions.fulfill( prepared_creation_tx, private_keys=alice.private_key) fulfilled_creation_tx sent_creation_tx = bdb.transactions.send_commit(fulfilled_creation_tx)
Error stack trace looks like this, `Traceback (most recent call last): File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 384, in _make_request six.raise_from(e, None) File “<string>”, line 2, in raise_from File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 380, in _make_request httplib_response = conn.getresponse() File “/usr/lib/python3.6/http/client.py”, line 1331, in getresponse response.begin() File “/usr/lib/python3.6/http/client.py”, line 297, in begin version, status, reason = self._read_status() File “/usr/lib/python3.6/http/client.py”, line 258, in _read_status line = str(self.fp.readline(_MAXLINE + 1), “iso-8859-1”) File “/usr/lib/python3.6/socket.py”, line 586, in readinto return self._sock.recv_into(b) socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “/home/ubuntu/.local/lib/python3.6/site-packages/requests/adapters.py”, line 445, in send timeout=timeout File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 638, in urlopen _stacktrace=sys.exc_info()[2]) File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/util/retry.py”, line 367, in increment raise six.reraise(type(error), error, _stacktrace) File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/packages/six.py”, line 686, in reraise raise value File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 600, in urlopen chunked=chunked) File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 386, in _make_request self._raise_timeout(err=e, url=url, timeout_value=read_timeout) File “/home/ubuntu/.local/lib/python3.6/site-packages/urllib3/connectionpool.py”, line 306, in _raise_timeout raise ReadTimeoutError(self, url, “Read timed out. (read timeout=%s)” % timeout_value) urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host=‘0.0.0.0’, port=9984): Read timed out. (read timeout=20)
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File “<stdin>”, line 1, in <module> File “/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/driver.py”, line 411, in send_commit headers=headers) File “/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/transport.py”, line 82, in forward_request backoff_cap=backoff_cap, File “/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/connection.py”, line 91, in request **kwargs, File “/home/ubuntu/.local/lib/python3.6/site-packages/bigchaindb_driver/connection.py”, line 120, in _request response = self.session.request(**kwargs) File “/home/ubuntu/.local/lib/python3.6/site-packages/requests/sessions.py”, line 512, in request resp = self.send(prep, **send_kwargs) File “/home/ubuntu/.local/lib/python3.6/site-packages/requests/sessions.py”, line 622, in send r = adapter.send(request, **kwargs) File “/home/ubuntu/.local/lib/python3.6/site-packages/requests/adapters.py”, line 526, in send raise ReadTimeout(e, request=request) requests.exceptions.ReadTimeout: HTTPConnectionPool(host=‘0.0.0.0’, port=9984): Read timed out. (read timeout=20)`
Any resolution to this? or am i doing something wrong???
About this issue
- Original URL
- State: open
- Created 6 years ago
- Comments: 39 (6 by maintainers)
@imvvk11 A common error is trying to transfer the same output a second time. That won’t work.
When you first create an asset, there will be an output on the CREATE transaction. You would identify that output by its transaction id (== asset id) and its output index (0 for the first one).
[CREATE tx] --(output 0)
To transfer that output, you refer to the CREATE transaction id (== asset id) and the output index (0). That happens in a new TRANSFER transaction, which has its own, new transaction id.
[CREATE tx] --(output 0)-- [TRANSFER tx] --(output 0)
To spend/transfer the output on that TRANSFER transaction, you must find the transaction id of that TRANSFER transaction. It will not be the same as the asset id or the transaction id of the CREATE transaction.
Every new TRANSFER transaction can contain new data in the “metadata” part of the transaction.
@imvvk11 Transferring to yourself is the same as transferring to others: you just put your own public key as the recipient (new owner).
@imvvk11 BigchainDB transactions don’t normally contain a timestamp (i.e. by default) because timestamps are notoriously tricky things. It’s very difficult to trust them.
That said, if you are creating transactions, then you can stuff a timestamp into them, either into the asset.data (of a CREATE transaction) or the metadata of any transaction. See for example https://github.com/bigchaindb/BEPs/tree/master/13#transaction-components-metadata