Closed unixneo closed 2 years ago
Changed the endpoint to alchemy using the goerli testnet since ropsten is deprecating
hain = Eth::Client.create Endpoint::Provider.alchemy_goerli
This this I get an more interesting error:
Unsupported method: eth_coinbase. Alchemy does not support mining eth...
MacStudio:client tim$ rails c
Loading development environment (Rails 7.0.3)
irb(main):001:0> require "#{Rails.root}/lib/assets/eth.rb"
=> true
irb(main):002:0> EthGem::Core.contract("hello_world")
METAMASK_ETH_ADDRESS: 0xE179C056024150d56A4e94af9C5A36BCC0B4e502
HELLO DEF SEND
"{\"jsonrpc\":\"2.0\",\"id\":1,\"result\":\"0x853a0d2313c0000\"}"
Balance is 6.0e+17
FILE: /Users/tim/rails/eth/lib/assets/contracts/hello_world.sol
HELLO DEF SEND
"{\"jsonrpc\":\"2.0\",\"result\":\"0x5\",\"id\":2}"
HELLO DEF SEND
"{\"jsonrpc\":\"2.0\",\"error\":{\"code\":-32600,\"message\":\"Unsupported method: eth_coinbase. Alchemy does not support mining eth. See available methods at https://docs.alchemy.com/alchemy/documentation/apis\"},\"id\":3}"
/Users/tim/rails/eth/vendor/bundle/ruby/3.0.0/gems/eth-0.5.5/lib/eth/client.rb:453:in `send_command': Unsupported method: eth_coinbase. Alchemy does not support mining eth. See available methods at https://docs.alchemy.com/alchemy/documentation/apis (IOError)
irb(main):003:0>
So, seems I need to disable or nil chain.eth_coinbase
?
Any ideas how best to do this?
client.rb
def default_account
@default_account ||= Address.new eth_coinbase["result"]
end
It appears this is part of the problem?
For test networks which do not mine, this call returns an error, correct?
What is the best way around this issue with test chains which do not mine?
Thanks
Thank you, this is actually a bug. I partially fixed it in #85 but have not seen this. :+1:
Testing all these various blockchain provider endpoints is useful it seems.
See summary of first test results here:
Do you want to submit a PR?
Do you want to submit a PR?
I don't yet have the skills to debug the ETH protocol; but if I did, or if I ever do, I would be happy to help out anyway I can.
Not even sure where to start, to be honest. I've been focused on testing provider endpoints and not the underlying protocol; where would I start to debug / fix this issue?
My guess is it would be easier to just use the sender signing key?
# Deploys a contract. Uses `eth_coinbase` or external signer
# if no sender key is provided.
Is this documented on how to deploy a contract using a sender key? I'm happy to try that, if you think that is a good way forward @q9f
Oh, sure:
my_key = Eth::Key.new priv: "30137644b564785d01420f8043f043d74dcca64008e57c59f8ce713a0005a54b"
# ...
chain.deploy_and_wait(contract, sender_key: my_key)
This issue is resolved. Thanks for your help @q9f
Hi Again, and thanks for this great gem and your fast support.
Made the change you suggested in (now closed) issue #113, but this leads to another error:
Here is the module as tested:
Here is the calling (rails console) process:
Looking at the line (453) where the error happens:
hello_world.sol
FWIW, get this same error with my earlier (issue #113) greeter.sol file as well:
I read the updated wiki (thanks for updating the docs, we all know that docs are our least favorite thing to do) and reviewed the steps again. Am I following your docs, to the letter, for endpoints such as CHAINSTACK or ALCHEMY, etc.? I think so, but maybe I'm missing something? Have reviewed the docs many times, but it seems I am following....
Where did I go wrong this time?
Thank you.