Support for signed transactions and blockchain explorer url helpers
Signed transactions
Ethereum.rb now supports signing transactions with key using ruby-eth gem.
To create a new key simply do the following:
key = Eth::Key.new
Then you can use the key to deploy contracts and send transactions, i.e.:
contract = Ethereum::Contract.create(file: "...")
contract.key = key
contract.deploy_and_wait("Allo Allo!")
contract.transact_and_wait.set("greeting", "Aloha!")
You can also transfer ether transfer using custom keys:
client.transfer(key, "0x342bcf27DCB234FAb8190e53E2d949d7b2C37411", amount)
client.transfer_and_wait(key, "0x949d7b2C37411eFB763fcDCB234FAb8190e53E2d", amount)
Url helpers for rails applications
Often in the application you want to link to blockchain explorer. This can be problematic if you want links to work with different networks (ropsten, mainnet, kovan) depending on environment you're working on.
Following helpers will generate link according to network connected:
link_to_tx("See the transaction", "0x3a4e53b01274b0ca9087750d96d8ba7f5b6b27bf93ac65f3174f48174469846d")
link_to_address("See the wallet", "0xE08cdFD4a1b2Ef5c0FC193877EC6A2Bb8f8Eb373")
They use etherscan.io as a blockexplorer.
Note: Helpers work in rails environment only.