Code Monkey home page Code Monkey logo

Comments (9)

keirfb avatar keirfb commented on September 26, 2024

Also now reproduced with Ruby 2.0.0

from bitcoin-ruby.

lian avatar lian commented on September 26, 2024

we never tried that part on windows.

ffi_lib': Could not open library 'ssl' mean it was not able to load (as in find) ssl.dll on your system. its not about the openssl ruby gem. if you know the path to your ssl.dll you can set it in bitcoin/ffi/openssl.rb:8

also, are you really using the bitcoin-ruby gem? don't, please use the git version from github. the gem was never officially released and is very outdated

from bitcoin-ruby.

keirfb avatar keirfb commented on September 26, 2024

Thanks for the feedback. I'll use the git version from now on. I can't however find an ssl.dll on my machine. Any ideas where I can get it from? Web searches aren't helping.

from bitcoin-ruby.

lian avatar lian commented on September 26, 2024

http://www.openssl.org/related/binaries.html i guess. but maybe its not called ssl.dll. i have no clue on windows, sorry.

from bitcoin-ruby.

keirfb avatar keirfb commented on September 26, 2024

Thanks for you help anyway. I've learned how to install Ubuntu, Ruby, all the required packages and have now got the function working on Linux, and can create public addresses from private keys.

Incidentally, the get balance example doesn't seem t o be working properly: it doesn't detect when an address has not transactions (returning a balance of 0), and if you use the --list option it tries to get transactions from nil, and returns the following:

 balance2.rb:47:in `block (2 levels) in <main>': undefined method `get_addresses' for nil:NilClass (NoMethodError)
    from balance2.rb:46:in `each'
    from balance2.rb:46:in `block in <main>'
    from balance2.rb:41:in `each'
    from balance2.rb:41:in `<main>'

from bitcoin-ruby.

mhanne avatar mhanne commented on September 26, 2024

Well, the balance being 0 is the expected behavior. It just tells you how many BTC this address has to spend. In many cases when you check the balance, it makes no difference if the address has previously had coins and spent them all, or never received anything. The amount available to spend is 0 either way.

With the --list option I'm not quite sure. It's supposed to exit when there are no transactions.
(You're having different line numbers apparently, so I guess this is where it fails: https://github.com/lian/bitcoin-ruby/blob/master/examples/balance.rb#L42)

Is the address you use with --list empty as well? Have you tried with different addresses? I just generated one and tried on an empty blockchain DB:

> ruby examples/balance.rb 1J63mvBh16Lcwh5XMJmP3nYrq9FhJd3o62       
INFO  storage: opened database sqlite://bitcoin.db
Balance: 0.00000000
> ruby examples/balance.rb 1J63mvBh16Lcwh5XMJmP3nYrq9FhJd3o62 --list
INFO  storage: opened database sqlite://bitcoin.db
Address not seen.

So to me it looks like your address wasn't empty, and one of the inputs doesn't have a prev_out (or it can't be found).
Was there maybe a generation tx to your address? (That would explain it, and it's entirely possible we never tested that)
The only other thing I could think of would be a corrupted DB.

Unfortunately, I can't test it with a real DB right now, but to fix it you could try to check if the prev_out is nil, and instead of calling .get_addresses on it, just output "generation" or something.

from bitcoin-ruby.

keirfb avatar keirfb commented on September 26, 2024

It looks like the problem is with generation addresses - so they could do with testing. Thanks for your help.

I am about four days in to generating a blocks.db from my blk*.dat files, and am about 60% in. Slow business...

from bitcoin-ruby.

mhanne avatar mhanne commented on September 26, 2024

a9970d8 should fix it. thanks for bringing it up! :)

from bitcoin-ruby.

keirfb avatar keirfb commented on September 26, 2024

I shouldn't have added the balance problem to the ssl.dll problem. However, I have verified that the new balance.rb works with generation addresses, so I think we can close this thread.

from bitcoin-ruby.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.