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?

q9f
  • 32,913
  • 47
  • 156
  • 395
xpnimi
  • 723
  • 1
  • 7
  • 10

5 Answers5

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.

arodriguezdonaire
  • 3,027
  • 3
  • 20
  • 37
  • 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 '16 at 10:12
  • If you know about js, Truffle is what you are looking for – arodriguezdonaire Apr 17 '16 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 '16 at 11:36
  • I think Truffle is a framework. It runs in node btw – arodriguezdonaire Apr 17 '16 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:

Marek Kirejczyk
  • 543
  • 4
  • 6
  • Might be a useful tutorial too https://chainstack.com/deploying-an-ethereum-smart-contract-with-eth-ruby-gem/ – Ake Dec 28 '23 at 02:53
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.

q9f
  • 32,913
  • 47
  • 156
  • 395
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.

Steve Ellis
  • 1,357
  • 13
  • 21
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)
JZ.
  • 153
  • 9