Closed AlbertoHdezCerezo closed 4 years ago
Hi, first of all thank you for your contribution with this awesome gem.
I am new in Ethereum.rb and I am trying to load a simple smart contract in my Ruby on Rails application.
I am using:
After setting up the system, creating a new client that connects to Parity and creating a new wallet I proceed to create a new contract and deploy it:
def self.deploy_carepoints_contract contract = Ethereum::Contract.create(client: client, file: "#{Dir.pwd}/app/contracts/CarePointsToken.sol").new key = Eth::Key.decrypt File.read("#{Dir.pwd}/parity/key.json", "Lberdo1991") contract.key = key address = contract.deploy_and_wait() end def self.client Ethereum::HttpClient.new("http://parity:30303") end
However the function fails in the line:
contract = Ethereum::Contract.create(client: client, file: "#{Dir.pwd}/app/contracts/CarePointsToken.sol").new
The error message is:
/usr/local/lib/ruby/2.7.0/net/protocol.rb:225:in `rbuf_fill' /usr/local/lib/ruby/2.7.0/net/protocol.rb:191:in `readuntil' /usr/local/lib/ruby/2.7.0/net/protocol.rb:201:in `readline' /usr/local/lib/ruby/2.7.0/net/http/response.rb:42:in `read_status_line' /usr/local/lib/ruby/2.7.0/net/http/response.rb:31:in `read_new' /usr/local/lib/ruby/2.7.0/net/http.rb:1528:in `block in transport_request' /usr/local/lib/ruby/2.7.0/net/http.rb:1519:in `catch' /usr/local/lib/ruby/2.7.0/net/http.rb:1519:in `transport_request' /usr/local/lib/ruby/2.7.0/net/http.rb:1492:in `request' /usr/local/lib/ruby/2.7.0/net/http.rb:1485:in `block in request' /usr/local/lib/ruby/2.7.0/net/http.rb:933:in `start' /usr/local/lib/ruby/2.7.0/net/http.rb:1483:in `request' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/http_client.rb:33:in `send_single' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/client.rb:126:in `send_command' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/client.rb:137:in `block (2 levels) in <class:Client>' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/client.rb:56:in `default_account' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/contract.rb:21:in `initialize' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/initializer.rb:16:in `new' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/initializer.rb:16:in `block in initialize' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/initializer.rb:12:in `each' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/initializer.rb:12:in `initialize' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/contract.rb:58:in `new' /usr/local/bundle/gems/ethereum.rb-2.5/lib/ethereum/contract.rb:58:in `create' (irb):8:in `rescue in irb_binding' (irb):6:in `irb_binding' /usr/local/lib/ruby/2.7.0/irb/workspace.rb:114:in `eval' /usr/local/lib/ruby/2.7.0/irb/workspace.rb:114:in `evaluate' /usr/local/lib/ruby/2.7.0/irb/context.rb:439:in `evaluate' /usr/local/lib/ruby/2.7.0/irb.rb:540:in `block (2 levels) in eval_input' /usr/local/lib/ruby/2.7.0/irb.rb:695:in `signal_status' /usr/local/lib/ruby/2.7.0/irb.rb:537:in `block in eval_input' /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `block (2 levels) in each_top_level_statement' /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `loop' /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:135:in `block in each_top_level_statement' /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `catch' /usr/local/lib/ruby/2.7.0/irb/ruby-lex.rb:134:in `each_top_level_statement' /usr/local/lib/ruby/2.7.0/irb.rb:536:in `eval_input' /usr/local/lib/ruby/2.7.0/irb.rb:471:in `block in run' /usr/local/lib/ruby/2.7.0/irb.rb:470:in `catch' /usr/local/lib/ruby/2.7.0/irb.rb:470:in `run' /usr/local/lib/ruby/2.7.0/irb.rb:399:in `start' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/commands/console/console_command.rb:70:in `start' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/commands/console/console_command.rb:19:in `start' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/commands/console/console_command.rb:102:in `perform' /usr/local/bundle/gems/thor-1.0.1/lib/thor/command.rb:27:in `run' /usr/local/bundle/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command' /usr/local/bundle/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/command/base.rb:69:in `perform' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/command.rb:46:in `invoke' /usr/local/bundle/gems/railties-6.0.3.3/lib/rails/commands.rb:18:in `<main>' /usr/local/bundle/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' /usr/local/bundle/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' /usr/local/bundle/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' /usr/local/bundle/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require' /usr/local/bundle/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require' /usr/local/bundle/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency' /usr/local/bundle/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require' bin/rails:9:in `<main>' Traceback (most recent call last): 2: from (irb):6 1: from (irb):8:in `rescue in irb_binding' EOFError (end of file reached)
I checked the path to the file is correct and the file can be readed. Do you know what might be the issue?
I just discovered the problem was related to the parity server. Using kauriorg/parity-docker image and connecting to port 8545 everything works fine.
Hi, first of all thank you for your contribution with this awesome gem.
I am new in Ethereum.rb and I am trying to load a simple smart contract in my Ruby on Rails application.
I am using:
After setting up the system, creating a new client that connects to Parity and creating a new wallet I proceed to create a new contract and deploy it:
However the function fails in the line:
The error message is:
I checked the path to the file is correct and the file can be readed. Do you know what might be the issue?