Bitcoin Forum
June 14, 2024, 07:39:48 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Fatal error: Uncaught exception 'Exception'  (Read 1382 times)
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 17, 2014, 11:41:42 PM
 #1

 ???Hola, tengo el siguiente error:

Code:
Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php:146 Stack trace: #0 /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->__call('getbalance', Array) #1 /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->getbalance() #2 /customers/8/0/9/*****.es/httpd.www/ruleta/test/test_bitcoin_rpc.php(22): BitcoinSystem->getBalance() #3 {main} thrown in /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php on line 146

Estoy cansado de googlear y no encontrar ninguna solución, a ver si alguien de por aquí pudiera ayudarme.

El cliente Bitcoin lo abro así: E:\Bitcoin\bitcoin-qt.exe -datadir=E:\Bitcoin\Data -server -daemon

El Bitcoin.conf:

Code:
 # bitcoin.conf configuration file. Lines beginning with # are comments.
 
 # Network-related settings:
 
 # Run on the test network instead of the real bitcoin network.
 #testnet=0
 
 # Connect via a socks4 proxy
 #proxy=127.0.0.1:9050
 
 # Use as many addnode= settings as you like to connect to specific peers
 #addnode=69.164.218.197
 #addnode=10.0.0.2:8333
 
 # ... or use as many connect= settings as you like to connect ONLY
 # to specific peers:
 #connect=69.164.218.197
 #connect=10.0.0.1:8333
 
 # Do not use Internet Relay Chat (irc.lfnet.org #bitcoin channel) to
 # find other peers.
 #noirc=0
 
 # Maximum number of inbound+outbound connections.
 #maxconnections=
 
 
 # JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
 
 # server=1 tells Bitcoin-QT to accept JSON-RPC commands.
 server=1
 daemon=1

 # You must set rpcuser and rpcpassword to secure the JSON-RPC api
 rpcuser=JJBreaker
 rpcpassword=mypass
 
 # How many seconds bitcoin will wait for a complete RPC HTTP request.
 # after the HTTP connection is established.
 #rpctimeout=30
 
 # By default, only RPC connections from localhost are allowed.  Specify
 # as many rpcallowip= settings as you like to allow connections from
 # other hosts (and you may use * as a wildcard character):
 rpcallowip=*
 rpcallowip=127.0.0.1
 rpcallowip=localhost
 rpcallowip=46.30.212.64
 
 # Listen for RPC connections on this TCP port:
 rpcport=8332
 
 # You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
 # running on another host using this option:
 #rpcconnect=127.0.0.1
 
 # Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate
 # with Bitcoin -server or bitcoind
 #rpcssl=1
 
 # OpenSSL settings used when rpcssl=1
 #rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
 #rpcsslcertificatechainfile=server.cert
 #rpcsslprivatekeyfile=server.pem
 
 
 # Miscellaneous options
 
 # Set gen=1 to attempt to generate bitcoins
 #gen=0
 
 # Use SSE instructions to try to generate bitcoins faster.
 #4way=1
 
 # Pre-generate this many public/private key pairs, so wallet backups will be valid for
 # both prior transactions and several dozen future transactions.
 #keypool=100
 
 # Pay an optional transaction fee every time you send bitcoins.  Transactions with fees
 # are more likely than free transactions to be included in generated blocks, so may
 # be validated sooner.
 paytxfee=0.00
 
 # Allow direct connections for the 'pay via IP address' feature.
 allowreceivebyip=1
  
 # User interface options
 
 # Start Bitcoin minimized
 min=0
 
 # Minimize to the system tray
 minimizetotray=0

Tengo el puerto 8332 abierto en el router y el firewall deshabilitado.

Gracias.
HostXBTC
Member
**
Offline Offline

Activity: 70
Merit: 10

Ehms, hola que tal :D


View Profile
March 18, 2014, 12:22:26 AM
 #2

???Hola, tengo el siguiente error:

Code:
Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php:146 Stack trace: #0 /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->__call('getbalance', Array) #1 /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->getbalance() #2 /customers/8/0/9/*****.es/httpd.www/ruleta/test/test_bitcoin_rpc.php(22): BitcoinSystem->getBalance() #3 {main} thrown in /customers/8/0/9/*****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php on line 146

Estoy cansado de googlear y no encontrar ninguna solución, a ver si alguien de por aquí pudiera ayudarme.

El cliente Bitcoin lo abro así: E:\Bitcoin\bitcoin-qt.exe -datadir=E:\Bitcoin\Data -server -daemon

El Bitcoin.conf:

Code:
 # bitcoin.conf configuration file. Lines beginning with # are comments.
 
 # Network-related settings:
 
 # Run on the test network instead of the real bitcoin network.
 #testnet=0
 
 # Connect via a socks4 proxy
 #proxy=127.0.0.1:9050
 
 # Use as many addnode= settings as you like to connect to specific peers
 #addnode=69.164.218.197
 #addnode=10.0.0.2:8333
 
 # ... or use as many connect= settings as you like to connect ONLY
 # to specific peers:
 #connect=69.164.218.197
 #connect=10.0.0.1:8333
 
 # Do not use Internet Relay Chat (irc.lfnet.org #bitcoin channel) to
 # find other peers.
 #noirc=0
 
 # Maximum number of inbound+outbound connections.
 #maxconnections=
 
 
 # JSON-RPC options (for controlling a running Bitcoin/bitcoind process)
 
 # server=1 tells Bitcoin-QT to accept JSON-RPC commands.
 server=1
 daemon=1

 # You must set rpcuser and rpcpassword to secure the JSON-RPC api
 rpcuser=JJBreaker
 rpcpassword=mypass
 
 # How many seconds bitcoin will wait for a complete RPC HTTP request.
 # after the HTTP connection is established.
 #rpctimeout=30
 
 # By default, only RPC connections from localhost are allowed.  Specify
 # as many rpcallowip= settings as you like to allow connections from
 # other hosts (and you may use * as a wildcard character):
 rpcallowip=*
 rpcallowip=127.0.0.1
 rpcallowip=localhost
 rpcallowip=46.30.212.64
 
 # Listen for RPC connections on this TCP port:
 rpcport=8332
 
 # You can use Bitcoin or bitcoind to send commands to Bitcoin/bitcoind
 # running on another host using this option:
 #rpcconnect=127.0.0.1
 
 # Use Secure Sockets Layer (also known as TLS or HTTPS) to communicate
 # with Bitcoin -server or bitcoind
 #rpcssl=1
 
 # OpenSSL settings used when rpcssl=1
 #rpcsslciphers=TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH
 #rpcsslcertificatechainfile=server.cert
 #rpcsslprivatekeyfile=server.pem
 
 
 # Miscellaneous options
 
 # Set gen=1 to attempt to generate bitcoins
 #gen=0
 
 # Use SSE instructions to try to generate bitcoins faster.
 #4way=1
 
 # Pre-generate this many public/private key pairs, so wallet backups will be valid for
 # both prior transactions and several dozen future transactions.
 #keypool=100
 
 # Pay an optional transaction fee every time you send bitcoins.  Transactions with fees
 # are more likely than free transactions to be included in generated blocks, so may
 # be validated sooner.
 paytxfee=0.00
 
 # Allow direct connections for the 'pay via IP address' feature.
 allowreceivebyip=1
  
 # User interface options
 
 # Start Bitcoin minimized
 min=0
 
 # Minimize to the system tray
 minimizetotray=0

Tengo el puerto 8332 abierto en el router y el firewall deshabilitado.

Gracias.

Si fuera tu censuraría ciertos parámetros de bitcoinconf como los datos de conexión remota rpc y la IP del servidor...

Tienes el bitcoin-qt sincronizado?Te arranca el daemon? Prueba a ejecutar desde consola algun parametro como getbalance o listtransactions a ver que te responde.

Por el error que te da el php apostaría que no conecta bien al qt

PD BORRA ESTO  rpcallowip=* NO SEAS ANIMAL xD

Si quieres ayuda más directa, agrégame a Skype (it's free): info_148754

Servicio de escrow, http://www.bitescrowing.com/  fee del 1%
Shawshank
Legendary
*
Offline Offline

Activity: 1623
Merit: 1608



View Profile
March 18, 2014, 07:16:13 AM
 #3

La excepción que muestras se produce en tu cliente PHP, no en Bitcoin-qt. Solo con solo esa información no se pueden sacar muchas conclusiones.

Es posible que estés enviando una petición incorrecta a Bitcoin-Qt. ¿Qué mensaje JSON estás enviando? ¿Has comprobado qué aparece en el fichero debug.log de Bitcoin-Qt?

También, -daemon no es un argumento válido. Lo mejor sería quitarlo. No aparece como opción válida en la ejecución del comando "Bitcoin-Qt -?" en la versión 0.8.6.

Lightning Address: shawshank@getalby.com
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 18, 2014, 08:28:12 AM
 #4

Hola HostXBTC y Shawshank,

HostXBTC ya te agregue, los datos hay expuestos son solo temporales, cuando funcionen los comandos enviados desde la web lo modificare dándole solo acceso a la web.

El daemon no se que es, se que hay un executable en la carpeta Bitcoin\daemon\bitcoind.exe pero nunca lo abri, pero se que el cliente bitcoin se inicia en modo server por que en process hacker: https://i.imgur.com/LM697jl.png y en http://www.yougetsignal.com/tools/open-ports/ me sale abrierto el puerto 8332.

Shawshank, ya he quitado -daemon, el mensaje JSON es: https://github.com/m0Ray/bitcoin_account en el debug.log no me aparece nada que haga referencia a esto.

Gracias por las respuestas.
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 18, 2014, 08:47:09 AM
 #5

usando el jsonRPCClient.class.php que hay en https://github.com/m0Ray/bitcoin_account me aparece este error:

Code:
Warning: fopen(http://...@****:8332): failed to open stream: Connection timed out in /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php on line 157 Fatal error: Uncaught exception 'Exception' with message 'Unable to connect to http://user:pass@****:8332: .php' in /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php:166 Stack trace: #0 /customers/8/0/9/coinspain.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->__call('getbalance', Array) #1 /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->getbalance() #2 /customers/8/0/9/****.es/httpd.www/ruleta/test/test_bitcoin_rpc.php(22): BitcoinSystem->getBalance() #3 {main} thrown in /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php on line 166

y usando este que encontré por internet:

Code:
class jsonRPCClient {

    /**
     * Debug state
     *
     * @var boolean
     */
    private $debug;

    /**
     * The server URL
     *
     * @var string
     */
    private $url;
    /**
     * The request id
     *
     * @var integer
     */
    private $id;
    /**
     * If true, notifications are performed instead of requests
     *
     * @var boolean
     */
    private $notification = false;

    /**
     * Takes the connection parameters
     *
     * @param string $url
     * @param boolean $debug
     */
    public function __construct($url,$debug = false) {
        // server URL
        $this->url = $url;
        // proxy
        empty($proxy) ? $this->proxy = '' : $this->proxy = $proxy;
        // debug state
        empty($debug) ? $this->debug = false : $this->debug = true;
        // message id
        $this->id = 1;
    }

    /**
     * Sets the notification state of the object. In this state, notifications are performed, instead of requests.
     *
     * @param boolean $notification
     */
    public function setRPCNotification($notification) {
        empty($notification) ?
            $this->notification = false
            :
            $this->notification = true;
    }

    /**
     * Performs a jsonRCP request and gets the results as an array
     *
     * @param string $method
     * @param array $params
     * @return array
     */
    public function __call($method,$params) {

        // check
        if (!is_scalar($method)) {
            throw new Exception('Method name has no scalar value');
        }

        // check
        if (is_array($params)) {
            // no keys
            $params = array_values($params);
        } else {
            throw new Exception('Params must be given as array');
        }

        // sets notification or request task
        if ($this->notification) {
            $currentId = NULL;
        } else {
            $currentId = $this->id;
        }

        // prepares the request
        $request = array(
            'method' => $method,
            'params' => $params,
            'id' => $currentId
        );
        $request = json_encode($request);
        $this->debug && $this->debug.='***** Request *****'."\n".$request."\n".'***** End Of request *****'."\n\n";

        // performs the HTTP POST
        $ch = curl_init($this->url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-type: application/json'));
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $request);
        $response = json_decode(curl_exec($ch),true);
        curl_close($ch);
        // debug output
        if ($this->debug) {
            echo nl2br($debug = false);
        }

        // final checks and return
        if (!$this->notification) {
            // check
            if ($response['id'] != $currentId) {
                throw new Exception('Incorrect response id (request id: '.$currentId.', response id: '.$response['id'].')');
            }
            if (!is_null($response['error'])) {
                throw new Exception('Request error: '.$response['error']);
            }

            return $response['result'];

        } else {
            return true;
        }
    }
}

Me aparece este error:

Code:
Fatal error: Uncaught exception 'Exception' with message 'Incorrect response id (request id: 1, response id: )' in /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php:146 Stack trace: #0 /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->__call('getbalance', Array) #1 /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/BitcoinSystem.class.php(48): jsonRPCClient->getbalance() #2 /customers/8/0/9/****.es/httpd.www/ruleta/test/test_bitcoin_rpc.php(22): BitcoinSystem->getBalance() #3 {main} thrown in /customers/8/0/9/****.es/httpd.www/ruleta/test/includes/jsonRPCClient.class.php on line 146
Shawshank
Legendary
*
Offline Offline

Activity: 1623
Merit: 1608



View Profile
March 18, 2014, 09:40:06 AM
 #6

en http://www.yougetsignal.com/tools/open-ports/ me sale abrierto el puerto 8332.

Eso es importante, y sin embargo la excepción en tu cliente php indica que se produce un "Connection timed out".

Si estás ejecutando Bitcoin-Qt y el servidor Apache en el mismo ordenador (o incluso en la misma red pero en ordenadores diferentes), puedes tener problemas si estás intentando acceder desde Apache a Bitcoin-Qt a través de la dirección IP externa. Es decir, puedes tener problemas si sales del router y la petición vuelve a entrar en el mismo router. Para evitar ese problema, prueba con direcciones IP locales. Si Bitcoin-Qt y Apache se están ejecutando en el mismo ordenador, prueba con la dirección IP: 127.0.0.1 ¿Funciona así?

Otra forma de ver si tienes conectividad es ejecutar el siguiente comando, aunque en Windows hay que activar telnet explícitamente:

telnet <dir_IP> 8332

Cuéntanos cómo vas avanzando.


Lightning Address: shawshank@getalby.com
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 18, 2014, 01:13:58 PM
 #7

Hola de nuevo Shawshank, acabo de instalar cliente y server telnet en mi windows 8 y abri la consola:

https://i.imgur.com/wKbsAlp.png

En telnet <dir_IP> 8332, por que se substituye <dir_IP>?
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 18, 2014, 01:50:57 PM
 #8

No hay alguna alternativa al jsonRPCClient.class en php? como podría ser el javascript u otro?

Tambien estoy empezando a pensar que puede ser problema de alguna opción activada o viceversa del servidor web, ya que en mi pc en localhost funcionan todos los códigos que pruebo y conecta con mi cliente al 100%...
HostXBTC
Member
**
Offline Offline

Activity: 70
Merit: 10

Ehms, hola que tal :D


View Profile
March 18, 2014, 02:07:16 PM
 #9

Hola de nuevo Shawshank, acabo de instalar cliente y server telnet en mi windows 8 y abri la consola:



En telnet <dir_IP> 8332, por que se substituye <dir_IP>?
7

Por la ip donde está el bitcoin-qt (en caso de ser la misma máquina 127.0.0.1)

Saludos!

Servicio de escrow, http://www.bitescrowing.com/  fee del 1%
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 18, 2014, 02:19:42 PM
 #10

https://i.imgur.com/OMv64fb.png
 así queda por siempre :/
Shawshank
Legendary
*
Offline Offline

Activity: 1623
Merit: 1608



View Profile
March 18, 2014, 03:28:05 PM
 #11


 así queda por siempre :/

Eso era lo esperado. Sin embargo, si ejecutas telnet desde la máquina que te está dando la excepción, con el comando o <dir_ip_remota> 8332 , en lugar de quedar a la espera de comandos, como tienes ahora, debería aparecer un mensaje que diga: No se puede abrir la conexión al host. En ese caso, <dir_ip_remota> sería la dirección IP que añadiste a yougetsignal.com. Si es así, significaría lo que te comenté anteriormente, que no puedes acceder a tu propia máquina a través de la dirección remota, y por tanto, para hacer pruebas en local deberías utilizar la dirección 127.0.0.1 en el cliente PHP.

Quote from: JJBreaker4
No hay alguna alternativa al jsonRPCClient.class en php? como podría ser el javascript u otro?

Respecto a las librerías cliente, yo utilizo directamente json_encode y json_decode: http://es1.php.net/json_encode y http://es1.php.net/json_decode . En ese particular, no necesitas nada rebuscado.

Para recibir pagos con bitcoins, yo he utilizado en PHP el Receive Payments API de blockchain.info: https://blockchain.info/api/api_receive . También te puede interesar el JSON RPC API de blockchain.info: https://blockchain.info/api/json_rpc_api , de manera que no necesites mantener un nodo Bitcoin-Qt completo para trabajar.

En Javascript, puedes probar con Bitcore.io, que utiliza node.js. Lo ha publicado el equipo de Bitpay y parece que es bastante completo.

También te puede interesar echar un vistazo a BitcoinJ. Es la librería Java que utiliza el cliente Multibit, pero no sé si se adaptará a tus necesidades.

Lightning Address: shawshank@getalby.com
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 19, 2014, 01:39:02 AM
 #12

Shawshank Muchísimas gracias por toda la ayuda y todo el tiempo que me as dedicado en este foro y por team ^^ eres de lo mejorcito que hay por Internet Smiley da gusto encontrar aun gente así, dispuesta a ayudar sin esperar nada a cambio ^^

Un saludo.

Ya te invitare a unas cervecitas jeje ;=)
HostXBTC
Member
**
Offline Offline

Activity: 70
Merit: 10

Ehms, hola que tal :D


View Profile
March 19, 2014, 02:42:31 AM
 #13

Shawshank Muchísimas gracias por toda la ayuda y todo el tiempo que me as dedicado en este foro y por team ^^ eres de lo mejorcito que hay por Internet Smiley da gusto encontrar aun gente así, dispuesta a ayudar sin esperar nada a cambio ^^

Un saludo.

Ya te invitare a unas cervecitas jeje ;=)

O te equivocaste de nombre o mi ayuda por Teamviewer no te valió y sí la suya xD

Servicio de escrow, http://www.bitescrowing.com/  fee del 1%
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 19, 2014, 03:22:38 AM
 #14

Shawshank Muchísimas gracias por toda la ayuda y todo el tiempo que me as dedicado en este foro y por team ^^ eres de lo mejorcito que hay por Internet Smiley da gusto encontrar aun gente así, dispuesta a ayudar sin esperar nada a cambio ^^

Un saludo.

Ya te invitare a unas cervecitas jeje ;=)

O te equivocaste de nombre o mi ayuda por Teamviewer no te valió y sí la suya xD

Ups, me equivoque copiando el nombre xD pero bueno Gracias a ambos ^^,
JJBreaker4 (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 0


View Profile
March 20, 2014, 06:06:10 PM
 #15

Bueno, por fin esta todo solucionado, seguí el consejo de HostXBTC y me cambie del hosting gratis a uno pagado, muy barato por cierto (3€ y pico al mes) y ya funciona todo a la perfeccion.

Muchas gracias todos  Cheesy

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!