<p>I've solved the problem by changing the url as follows. 
http://'rpcuser':'rpcpassword'@127.0.0.1:8332'</p>

CC BY-SA 3.0
2015-12-06T07:40:07.117Z
2015-12-06T07:40:07.117Z
Toshi
<p>I'd like to access local bitcoin node from ruby by using RPC client. The following is my code, and it returns the next code. Could you tell me how to call Bitcoin client on ruby?</p>

<pre><code>#console    
NoMethodError (undefined method `getblockcount' for #&lt;BitcoinRpc:0x007fe4e2577050&gt;):


#product_controller.rb
require 'net/http'
require 'uri'
require 'json'
class BitcoinRpc
  def initialize(service_url)
    @uri = URI.parse(service_url)
  end
end

class ProductsController &lt; ApplicationController
  require 'openassets'
  require 'bitcoin'
  include Bitcoin::Util
  include Bitcoin::Builder
  h = BitcoinRpc.new('http://'rpcuser':'rpcpassword'@localhost:8332')
  puts(h.getblockcount)
  ....
</code></pre>

CC BY-SA 3.0
2015-12-06T06:34:29.377Z
When you `require 'bitcoin'`, what library are you referencing?
Nick ODell
CC BY-SA 3.0
2015-12-06T07:40:05.517Z
Dear Nick  it is bitcoin-ruby.
Btw, it has been solved. Thank you for your kindenss:)
Toshi
<bitcoind><ruby>
How to access bitcoin client from ruby using Rpc client?
Toshi
# How to access bitcoin client from ruby using Rpc client?

(Asked by: username_0 on 2015-12-06)

I'd like to access local bitcoin node from ruby by using RPC client. The following is my code, and it returns the next code. Could you tell me how to call Bitcoin client on ruby?

```
#console    
NoMethodError (undefined method `getblockcount' for #<BitcoinRpc:0x007fe4e2577050>):

#product_controller.rb
require 'net/http'
require 'uri'
require 'json'
class BitcoinRpc
  def initialize(service_url)
    @uri = URI.parse(service_url)
  end
end

class ProductsController < ApplicationController
  require 'openassets'
  require 'bitcoin'
  include Bitcoin::Util
  include Bitcoin::Builder
  h = BitcoinRpc.new('http://'rpcuser':'rpcpassword'@localhost:8332')
  puts(h.getblockcount)
  ....

```

**Tags:** bitcoind, ruby

> **Comments:**
> **username_1**: When you `require 'bitcoin'`, what library are you referencing?  
> **username_0**: Dear username_1  it is bitcoin-ruby. Btw, it has been solved. Thank you for your kindenss:)  

---

## 1 answers

### Answer by username_0 on 2015-12-06. Score: 0 | Accepted answer

I've solved the problem by changing the url as follows.
http://'rpcuser':'rpcpassword'@127.0.0.1:8332'


---

