¿Cómo sincronizar pyethapp (cliente python ethereum) con la red principal?

Acabo de instalar pyethapp . Sin embargo, no puedo sincronizar la cadena de bloques. Esto es lo que obtengo cuando ejecuto el cliente:

0 ✓ user@host ~ $ pyethapp run

Failed to import scrypt. This is not a fatal error but does
mean that you cannot create or decrypt privkey jsons that use
scrypt

INFO:app  using data in path=/home/user/.config/pyethapp
INFO:config loading config path=/home/user/.config/pyethapp
INFO:app  omitting reporting of 8893 accounts in genesis 
? ''
: {}
accounts: {keystore_dir: keystore, must_include_coinbase: true}
block:
  ACCOUNT_INITIAL_NONCE: 0
  BLKLIM_FACTOR_DEN: 2
  BLKLIM_FACTOR_NOM: 3
  BLOCK_DIFF_FACTOR: 2048
  BLOCK_REWARD: 5000000000000000000
  DIFF_ADJUSTMENT_CUTOFF: 13
  EXPDIFF_FREE_PERIODS: 2
  EXPDIFF_PERIOD: 100000
  GASLIMIT_ADJMAX_FACTOR: 1024
  GASLIMIT_EMA_FACTOR: 1024
  GENESIS_COINBASE: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
  GENESIS_DIFFICULTY: 131072
  GENESIS_EXTRA_DATA: ''
  GENESIS_GAS_LIMIT: 3141592
  GENESIS_INITIAL_ALLOC: {}
  GENESIS_MIXHASH: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
    \0"
  GENESIS_NONCE: "\0\0\0\0\0\0\0*"
  GENESIS_PREVHASH: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
    \0"
  GENESIS_TIMESTAMP: 0
  HOMESTEAD_DIFF_ADJUSTMENT_CUTOFF: 10
  HOMESTEAD_FORK_BLKNUM: 1150000
  MAX_EXTRADATA_LENGTH: 32
  MAX_UNCLES: 2
  MAX_UNCLE_DEPTH: 6
  MIN_DIFF: 131072
  MIN_GAS_LIMIT: 5000
  NEPHEW_REWARD: 156250000000000000
  POW_EPOCH_LENGTH: 30000
  UNCLE_DEPTH_PENALTY_FACTOR: 8
client_version_string: pyethapp/v1.2.1/linux2/py2.7.11
data_dir: !!python/unicode '/home/user/.config/pyethapp'
db: {implementation: LevelDB}
deactivated_services: [pow]
discovery:
  bootstrap_nodes: ['enode://487611428e6c99a11a9795a6abe7b529e81315ca6aad66e2a2fc76e3adf263faba0d35466c2f8f68d561dbefa8878d4df5f1f2ddb1fbeab7f42ffb8cd328bd4a@5.1.83.226:30303',
    'enode://a979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c@52.16.188.185:30303',
    'enode://de471bccee3d042261d52e9bff31458daecc406142b401d4cd848f677479f73104b9fdeb090af9583d3391b7f10cb2ba9e26865dd5fca4fcdc0fb1e3b723c786@54.94.239.50:30303',
    'enode://2676755dd8477ad3beea32b4e5a144fa10444b70dfa3e05effb0fdfa75683ebd4f75709e1f8126cb5317c5a35cae823d503744e790a3a038ae5dd60f51ee9101@144.76.62.101:30303']
  listen_host: 0.0.0.0
  listen_port: 30303
eth:
  block:
    ACCOUNT_INITIAL_NONCE: 0
    BLKLIM_FACTOR_DEN: 2
    BLKLIM_FACTOR_NOM: 3
    BLOCK_DIFF_FACTOR: 2048
    BLOCK_REWARD: 5000000000000000000
    DIFF_ADJUSTMENT_CUTOFF: 13
    EXPDIFF_FREE_PERIODS: 2
    EXPDIFF_PERIOD: 100000
    GASLIMIT_ADJMAX_FACTOR: 1024
    GASLIMIT_EMA_FACTOR: 1024
    GENESIS_COINBASE: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
    GENESIS_DIFFICULTY: 17179869184
    GENESIS_EXTRA_DATA: !!binary |
      Ebvo2040e06Mk3wcg3Dkte0zrbPbacvbejjh5Qsbgvo=
    GENESIS_GAS_LIMIT: 5000
    GENESIS_MIXHASH: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
      \0\0"
    GENESIS_NONCE: "\0\0\0\0\0\0\0B"
    GENESIS_PREVHASH: "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
      \0\0"
    GENESIS_TIMESTAMP: 0
    HOMESTEAD_DIFF_ADJUSTMENT_CUTOFF: 10
    HOMESTEAD_FORK_BLKNUM: 1150000
    MAX_EXTRADATA_LENGTH: 32
    MAX_UNCLES: 2
    MAX_UNCLE_DEPTH: 6
    MIN_DIFF: 131072
    MIN_GAS_LIMIT: 5000
    NEPHEW_REWARD: 156250000000000000
    POW_EPOCH_LENGTH: 30000
    UNCLE_DEPTH_PENALTY_FACTOR: 8
  genesis: /home/user/opt/pyethapp/pyethapp/genesisdata/genesis_frontier.json
  genesis_hash: d4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3
  network_id: 1
  pruning: -1
ipc: {ipcpath: /tmp/pyethapp.ipc}
jsonrpc: {corsdomain: '', listen_host: 127.0.0.1, listen_port: 4000}
log_disconnects: false
node: {privkey_hex: 48************************************************************27}
p2p:
  bootstrap_nodes: []
  listen_host: 0.0.0.0
  listen_port: 30303
  max_peers: 10
  min_peers: 5
post_app_start_callback: null
pow: {activated: false, coinbase_hex: null, cpu_pct: 100, mine_empty_blocks: true}

WARNING:accounts  keystore directory does not exist directory=/home/user/.config/pyethapp/keystore
WARNING:accounts  no accounts found 
INFO:app  registering service service=accounts
INFO:db No contrib directory found, so not loading any user services 
INFO:db opening LevelDB path=/home/user/.config/pyethapp/leveldb max_open_files=128 block_cache_size=8388608 write_buffer_size=4194304
INFO:app  registering service service=db
INFO:p2p.discovery  NodeDiscovery init 
INFO:p2p.discovery  starting discovery proto this_enode=enode://afd01fba0c5731191484175421a58f415171ac2e1ded4653ddfd23ff87020490cdb31306e286ba09514a83fc516481f721512a61b85a83f77416d280e63f5308@0.0.0.0:30303
INFO:app  registering service service=discovery
INFO:p2p.peermgr  PeerManager init 
INFO:app  registering service service=peermanager
INFO:eth.chainservice initializing chain 
INFO:eth.chainservice chain at number=0
INFO:app  registering service service=chain
INFO:app  registering service service=jsonrpc
INFO:app  registering service service=ipc
INFO:app  registering service service=console
INFO:app  starting 
INFO:p2p.peermgr  starting peermanager 
INFO:p2p.peermgr  starting listener addr=('0.0.0.0', 30303)
INFO:p2p.discovery  starting discovery 
INFO:p2p.discovery  starting listener host=0.0.0.0 port=30303
INFO:jsonrpc  starting IPCRPCServer ipcpath=/tmp/pyethapp.ipc
INFO:jsonrpc  starting JSONRPCServer port=4000
INFO:p2p.peermgr  waiting for bootstrap 
INFO:p2p.peer received hello client_version=pyethapp/v1.1.1/linux2/py2.7.10 version=55 capabilities=(('eth', 61), ('p2p', 4))
INFO:eth.sync.task  spawning new synctask 
INFO:p2p.peer received hello client_version=Geth/v1.3.5-34b622a2/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Geth/v1.4.1-rc-4b9de756/windows/go1.6.2 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Geth/v1.3.5-3be156fb/linux/go1.4.2 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid genesis hash remote_id=<ETHProtocol <Peer('120.27.121.190', 41303) Geth/v1.3.5-3be156fb>> genesis=5157cbd8975669bdb52c8ba7073bf08fd868946a9f70db197e74097b4342050e
WARNING:protocol  protocol exception, stopping error=wrong genesis block
INFO:p2p.peer received hello client_version=Geth/v1.4.0-unstable/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=104971 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Ged/v1.3.6-66937ae4/linux/go1.6.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=88 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Geth/eth-peer-lon02-2/v1.3.5-34b622a2/linux/go1.6 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61), ('shh', 2))
WARNING:eth.chainservice  invalid network id remote_network_id=996787477 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Gshift/Explorer/v2.5.0-1d1c88f2/linux/go1.6.1 version=4 capabilities=(('shift', 63), ('shift', 62), ('shift', 61))
INFO:p2p.peer received hello client_version=Geth/v1.3.6/windows/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Gshift/v2.5.0-259fd3a2/linux/go1.5.1 version=4 capabilities=(('shift', 63), ('shift', 62), ('shift', 61))
INFO:p2p.peer received hello client_version=Geth/v1.3.5/windows/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:p2p.discovery.kademlia  recv ping from self?! 
WARNING:p2p.discovery.kademlia  recv ping from self?! 
INFO:p2p.peer received hello client_version=Geth/v1.4.1-rc-4b9de756/windows/go1.6.2 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Geth/eth-peer-dal09-6/v1.3.5-34b622a2/linux/go1.6 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61), ('shh', 2))
WARNING:eth.chainservice  invalid network id remote_network_id=996787477 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gevent-1.1.0-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/peer.py", line 230, in _run_decoded_packets
    self._handle_packet(self.mux.packet_queue.get())  # get_packet blocks
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/peer.py", line 202, in _handle_packet
    cmd_id], protocol=protocol.name, orig_cmd_id=packet.cmd_id)
KeyError: 6
<Greenlet at 0x7f61de03f870: <bound method Peer._run_decoded_packets of <Peer('120.25.154.157', 19999) >>> failed with KeyError

INFO:p2p.peer received hello client_version=Geth/v1.3.5/windows/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Ged/v1.3.6-66937ae4/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=88 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Gshift/Explorer/v2.5.0-1d1c88f2/linux/go1.6.1 version=4 capabilities=(('shift', 63), ('shift', 62), ('shift', 61))
INFO:p2p.peer received hello client_version=Geth/v1.3.6/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=2 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Geth/v1.3.5/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
INFO:p2p.peer received hello client_version=Geth/v1.3.6/linux/go1.5.1 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=2 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Geth/v1.3.5-4f8c7bfd/linux/go1.6.2 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))
WARNING:eth.chainservice  invalid network id remote_network_id=9895630 expected_network_id=1
WARNING:protocol  protocol exception, stopping error=wrong network_id
INFO:p2p.peer received hello client_version=Geth/v1.3.5-34b622a2/linux/go1.6 version=4 capabilities=(('eth', 63), ('eth', 62), ('eth', 61))

Y esto es lo que obtengo de la consola:

^C
Hit [ENTER], to launch console; [Ctrl+C] again to quit! [3s]




Entering Console
Tip:
  use `lastlog(n)` to see n lines of log-output. [default 10] 
  use `lasterr(n)` to see n lines of stderr.
  use `help(eth)` for help on accessing the live chain.


Python 2.7.11 (default, Mar 31 2016, 06:18:34) 
Type "copyright", "credits" or "license" for more information.

IPython 4.2.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: help(eth)


In [2]: eth.pending
Out[2]: <Block(#1 fec20c0d)>

In [3]: help(eth)


In [4]: eth.latest
Out[4]: <CachedBlock(#0 d4e56740)>

In [5]: lastlog(15)


In [6]: lasterr(15)


In [7]: 

¿Cómo sincronizar pyethapp (cliente python ethereum) con la red principal?


Actualización, pensé que podría tener que agregar un nodo de arranque. Como ya obtuve parity, geth y eth ejecutándose en localhost, los agregué como nodos de arranque con -b, sin embargo, recibo los siguientes errores:

Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/gevent-1.1.0-py2.7-linux-x86_64.egg/gevent/greenlet.py", line 534, in run
    result = self._run(*self.args, **self.kwargs)
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/peer.py", line 266, in _run_ingress_message
    self.mux.add_message(imsg)
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/muxsession.py", line 51, in _add_message_during_handshake
    rest = session.decode_authentication(msg)
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/rlpxcipher.py", line 224, in decode_authentication
    (size, sig, initiator_pubkey, nonce, version) = self.decode_auth_eip8(ciphertext)
  File "/usr/lib/python2.7/site-packages/devp2p-0.7.2-py2.7.egg/devp2p/rlpxcipher.py", line 261, in decode_auth_eip8
    assert len(ciphertext) >= size
AssertionError
<Peer('127.0.0.1', 37178) > failed with AssertionError

¿Es esto un error?

Obtuve un resultado similar al primer caso. Lo intenté de nuevo en testnet (borrando primero los datos de la red principal). De nuevo parecido. El último mensaje fue "INFO:p2p.peermgr esperando arranque". ¿Quizás testnet ya no se mantiene? ¿Hay nodos de arranque confiables para testnet y/o mainnet?
Vea mi respuesta a continuación.

Respuestas (3)

La respuesta es paciencia . pyethapp es más bien una implementación de prueba de concepto que un nodo listo para producción.

Tuve que esperar varias horas hasta que noté que el cliente comenzó a sincronizar la red principal. Se está sincronizando muy lentamente desde hace algunos días y solo tengo el primer millón de bloques en el disco. Sigue esperando el resto.

TL; DR pyethapp funciona, pero prepárate un poco de tiempo si quieres trabajar en la red principal.

¿Puedo dejar de sincronizar?
¿La red principal? ¿Con Pyethapp? Toma semanas.
Estoy alrededor de 2/3 de los bloques. Par de días.

En caso de que alguien encuentre esto ahora (dos años después de que se publicó la pregunta) como lo hice yo: después de intentar solucionar varios problemas al ejecutar pyethapp en la red principal, eché un vistazo más de cerca a esta página de la wiki. Implica que pyethapp no ​​funciona en la red principal en este momento o al menos no lo hizo en marzo de 2017.

También veo esta línea en su registro:

WARNING:accounts no accounts found

probablemente necesite generar una cuenta primero. Correr

pyethapp account new

No creo que esto pueda ser un problema para la sincronización, pero seguro que no tener una cuenta deshabilitará algunas funciones (como la minería)

Con respecto a la sincronización, supongo que el nodo quiere recopilar la mayor cantidad posible de pares antes de comenzar a sincronizar, para asegurarse de que está descargando una cadena de bloques de consenso.

También he probado con geth. Claramente, pyethapp tiene algún problema porque geth se sincronizó mucho más rápido y sin demora. Mientras tanto, pyethapp tuvo algunas excepciones frecuentes al intentar cargar este o aquel bloque. Puede ser que esté un poco desactualizado y no sea compatible con todas las versiones del protocolo p2p, por lo que es más difícil sincronizarlo con sus pares.