11

I am looking for some kind of walk through or tutorial about how to use ethereum with an ruby on rails application?

Is there anything out there?

0

5 Answers 5

4

You can find so many tools for using ruby to access the Ethereum Blockchain.

You have for example (like 5chdn♦ said in a comment):

Also, here you have an Ethereum StackExchange answer which tells about how to connect Geth by IPC on rails.

4
  • this are certainly some useful links, but not really a tutorial on how to create a frontend / sql & eth backend symbiosed application. I have questions like: Where and how to host your geth client, how to read/write from/to it with a controller and how to present data in the view(and/or send input fields data to geth). Is it secure or is it practical at all? etc....
    – xpnimi
    Apr 17, 2016 at 10:12
  • If you know about js, Truffle is what you are looking for Apr 17, 2016 at 10:29
  • I know js, but I'm more familiar to write in a conventional db with rails. Is truffle for frameworks like Meteor / AngualrJS / backbone etc? or is it compatible with rails?
    – xpnimi
    Apr 17, 2016 at 11:36
  • I think Truffle is a framework. It runs in node btw Apr 17, 2016 at 11:39
2

You can check also ethereum.rb.

It is more recent ruby gem, supporting parity 1.5+ and solidity compiler. It comes with:

1

There is also the ethereum-tx gem. It is intended for keeping the signing and building of transactions separate from the full node. You could host your full node on the same server, but you don't need to. For a lot of Ethereum applications, you only need to be able to read the blockchain and send transactions. Depending on the frequency with which you need to do this, you could run your own node, or maybe get away with using a block explorer's API.

If you already have private keys with ether you can import them, or generate new keys to send Ethereum(see Ethereum::Key class). Once you have some keys you can build transactions and sign them with the key(see Ethereum::Tx class). Finally, you can encode those transactions and broadcast them to an Ethereum full node using the JSON-RPC API, or any block explorer that supports raw transactions(either way you just need an HTTP library).

The one thing left to do is get notifications about when an address receives messages or ether. Events work for contracts, but not regular accounts. I'm not really sure of a fully comprehensive solution in any language, so I'd recommend rolling your own based on your specific needs.

1

I have published an Ethereum on Rails template on Github.

It is a boilerplate application that allows authenticating users in your Rails 7.0 application with an Ethereum wallet (e.g., MetaMask).

Screenshot of the Demo

You can use this repository as a template to create your custom Rails application that already has Ethereum support bundled. It uses the new eth gem for Ethereum account management.

0

https://github.com/fogonthedowns/blupee is a simple Ruby interface for working with the Ethereum Blockchain:

new wallet:

ether_wallet = Blupee::API::Ether.new_wallet('[hidden]')

wallet balance:

ether_balance = Blupee::API::Ether.balance("0xad96B1072E60f6279F628E7512242F9b1A83127F")

erc20 tokens:

args = {wallet_address:"", contract_address:""}
Blupee::API::Token.balance(args)

Your Answer

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

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