So I just started writing a rails app that will be an online wallet. I'm looking over the API code examples for connecting to the bitcoin network at https://en.bitcoin.it/wiki/API_reference_(JSON-RPC).

PHP was the easiest example, seen here

  require_once 'jsonRPCClient.php';

  $bitcoin = new jsonRPCClient('http://user:[email protected]:8332/');

  echo "<pre>\n";
  print_r($bitcoin->getinfo()); echo "\n";
  echo "Received: ".$bitcoin->getreceivedbylabel("Your Address")."\n";
  echo "</pre>";

So I'm presuming that it connects to the bitcoin network via a username and password. Couple of questions.

What username/password? I bought bitcoin on coinbase, then exported it to a paper wallet. What user/pass is associated with my bitcoin? I thought it was just public/private key?

Why port 8332?

Why Could it be any address?

  • Pick any username and password that you want. The values are used only for RPC connections. Port 8332 is the default port used by bitcoin for RPC connections and is the localhost address (that is, connecting to means you are connecting to a service running on the local system). You can change the port number if you have a conflict on your system by specifying rpcport in bitcoin.conf. Dec 10, 2013 at 16:47

1 Answer 1


You need to run either Bitcoin-Qt or bitcoind on your system. Create a bitcoin.conf file containing the following lines:


You can then connect to your bitcoin node by specifying address and port 8332. Use the userid and password you specified in the bitcoin.conf file.

While it is possible to open port 8332 to allow remote users to connect to the local node, this is not a good idea for security reasons because it allows access to your wallet. Instead, your users would communicate with your application and your application would then make the necessary RPC calls to the local node.

  • Thanks Ron, that makes sense. So if I wanted to create a wallet service, where each user creates their own account on my site, and each account is associated with a wallet, then I'd have to have multiple wallets on my server right? One for each user? Dec 5, 2013 at 16:13
  • A single wallet can have multiple bitcoin addresses. So you would generate a bitcoin address for each user to allow them to send coins to their account. Partial withdrawals would be handled by sending the change back to the receive address or to a new change address. For the strongest security, bitcoin addresses should not be reused. So your application should allow users to create new addresses as needed. Your application would then need a database to associate bitcoin addresses with user accounts. Dec 5, 2013 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.