bigchaindb / bigchaindb-driver

Official Python driver for BigchainDB
https://www.bigchaindb.com
Apache License 2.0
105 stars 104 forks source link

Error on broadcastTxCommit: EOF #494

Closed nuels closed 5 years ago

nuels commented 5 years ago

Description

I create simple transaction with the code from https://www.bigchaindb.com/developers/getstarted/ here the source code

from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair

bdb = BigchainDB('http://node4.nuels.me')
alice = generate_keypair()
tx = bdb.transactions.prepare(
    operation='CREATE',
    signers=alice.public_key,
    asset={'data': {'message': ''}})
signed_tx = bdb.transactions.fulfill(
    tx,
    private_keys=alice.private_key)
bdb.transactions.send_commit(signed_tx)

What I Did

When i run, i get this error

root@blockchain-node4:~# python3 test.py
Traceback (most recent call last):
  File "test.py", line 13, in <module>
    bdb.transactions.send_commit(signed_tx)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/driver.py", line 375, in send_commit
    headers=headers)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/transport.py", line 82, in forward_request
    backoff_cap=backoff_cap,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 91, in request
    **kwargs,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 128, in _request
    raise exc_cls(response.status_code, text, json, kwargs['url'])
bigchaindb_driver.exceptions.TransportError: (500, '{"message":"Internal error - Error on broadcastTxCommit: EOF","status":500}\n', {'message': 'Internal error - Error on broadcastTxCommit: EOF', 'status': 500}, 'http://node4.nuels.me:9984/api/v1/transactions/')
root@blockchain-node4:~#
root@blockchain-node4:~# python3 test.py
Traceback (most recent call last):
  File "test.py", line 13, in <module>
    bdb.transactions.send_commit(signed_tx)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/driver.py", line 375, in send_commit
    headers=headers)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/transport.py", line 82, in forward_request
    backoff_cap=backoff_cap,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 91, in request
    **kwargs,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 128, in _request
    raise exc_cls(response.status_code, text, json, kwargs['url'])
bigchaindb_driver.exceptions.TransportError: (500, '{"message":"Internal error - Error on broadcastTxCommit: EOF","status":500}\n', {'message': 'Internal error - Error on broadcastTxCommit: EOF', 'status': 500}, 'http://node4.nuels.me:9984/api/v1/transactions/')
root@blockchain-node4:~#

My tendermint get some error like this

E[11-29|05:34:30.651] Stopping abci.socketClient for error: EOF module=abci-client connection=consensus I[11-29|05:34:30.654] Stopping socketClient module=abci-client connection=consensus impl=socketClient E[11-29|05:34:30.658] Stopping abci.socketClient for error: EOF module=abci-client connection=mempool I[11-29|05:34:30.658] Stopping socketClient module=abci-client connection=mempool impl=socketClient E[11-29|05:34:30.659] Stopping abci.socketClient for error: EOF module=abci-client connection=query I[11-29|05:34:30.659] Stopping socketClient module=abci-client connection=query impl=socketClient I[11-29|05:34:59.491] Ensure peers module=p2p numOutPeers=0 numInPeers=3 numDialing=0 numToDial=10 I[11-29|05:34:59.491] We need more addresses. Sending pexRequest to random peer module=p2p peer="Peer{MConn{209.97.171.97:41512} 42df4984d7c2a8836073baa10f656faaf5e20b01 in}" I[11-29|05:35:29.485] Saving AddrBook to file module=p2p book=/root/.tendermint/config/addrbook.json size=3 I[11-29|05:35:29.490] Ensure peers module=p2p numOutPeers=0 numInPeers=3 numDialing=0 numToDial=10 I[11-29|05:35:29.491] We need more addresses. Sending pexRequest to random peer module=p2p peer="Peer{MConn{209.97.171.97:41512} 42df4984d7c2a8836073baa10f656faaf5e20b01 in}"

when im trying manual to make transaction with tendermint and get this error screenshot_9

ttmc commented 5 years ago

I just noticed that the Python code on the "Get Started" page had an error. It should use send_commit() instead of send(). But I think you figured that out on your own. (I did a PR to fix the website nevertheless. See https://github.com/bigchaindb/site/pull/278 )

I tried the code against your server (at http://node4.nuels.me ) and got the same result.

Then I tried the exact same code against the BigchainDB Testnet (at https://test.bigchaindb.com ) and it worked!

Maybe you've deployed your BigchainDB node (or network) wrong somehow? GET requests work just fine, e.g. see:

http://node4.nuels.me:9984/

but send_commit() does a POST request...

How did you deploy your BigchainDB node (or network)?

nuels commented 5 years ago

I developed my bigchaindb step by step from this http://docs.bigchaindb.com/projects/server/en/latest/simple-deployment-template/network-setup.html i've tried step by step and repeat it many times for finding the error, but still got that's error this is the step i followed:

After all done, i running my tendermint with command tendermint node and i got this error abci.socketClient failed to connect to tcp://127.0.0.1:26658, then i try to run my node using this command tendermint node --proxy_app=kvstore, and the node has connected each other, And then i run the bigchaindb "bigchaindb start", and im using python driver for test the bigchaindb, and i got thats error like i post before"

is that there are wrong step?

ttmc commented 5 years ago

Maybe try just a single-node BigchainDB "network" to start with. And use Monit to start both BigchainDB and Tendermint.

When you run multiple nodes, you should probably put them in different virtual machines, to avoid issues with networking.

ttmc commented 5 years ago

P.S. Definitely don't do tendermint node --proxy_app=kvstore. You want to run BigchainDB with Tendermint, not kvstore.

nuels commented 5 years ago

im just trying to run single-node, and still got this error with the tendermint

Traceback (most recent call last):
  File "test.py", line 13, in <module>
    bdb.transactions.send_commit(signed_tx)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/driver.py", line 375, in send_commit
    headers=headers)
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/transport.py", line 82, in forward_request
    backoff_cap=backoff_cap,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 91, in request
    **kwargs,
  File "/usr/local/lib/python3.6/dist-packages/bigchaindb_driver/connection.py", line 128, in _request
    raise exc_cls(response.status_code, text, json, kwargs['url'])
bigchaindb_driver.exceptions.TransportError: (500, '{"message":"Internal error - Error on broadcastTxCommit: EOF","status":500}\n', {'message': 'Internal error - Error on broadcastTxCommit: EOF', 'status': 500}, 'http://node1.nuels.me:9984/api/v1/transactions/')
ttmc commented 5 years ago

Can you look in the BigchainDB, Tendermint (and maybe NGINX) logs?

http://docs.bigchaindb.com/projects/server/en/latest/appendices/log-rotation.html

nuels commented 5 years ago

Im not using https, so i dont setup nginx and there is problem to start bigchaindb&tendermint using monit, so i run manually, first i run

bigchaindb start

and then

tendermint node

here

bighchaindb-errors.log

root@blockchain-node1:~# cat bigchaindb-errors.log
[2018-11-29 22:42:13] [ERROR] (bigchaindb.web.views.base) HTTP API error: 500 - POST:/api/v1/transactions/ - Internal error - Error on broadcastTxCommit: EOF (bigchaindb_webapi - pid: 24696)
[2018-11-29 22:43:32] [ERROR] (bigchaindb.web.views.base) HTTP API error: 500 - POST:/api/v1/transactions/ - Internal error - Error on broadcastTxCommit: EOF (bigchaindb_webapi - pid: 24697)
[2018-11-29 22:54:28] [ERROR] (bigchaindb.web.views.base) HTTP API error: 500 - POST:/api/v1/transactions/ - Internal error - Error on broadcastTxCommit: EOF (bigchaindb_webapi - pid: 1252)
[2018-11-30 07:09:39] [ERROR] (bigchaindb.web.views.base) HTTP API error: 500 - POST:/api/v1/transactions/ - Internal error - Error on broadcastTxCommit: EOF (bigchaindb_webapi - pid: 1330)
nuels commented 5 years ago

Problem SOLVED. Just need to activated private networking & used private IP on digital ocean!! thanksss