Open hboon opened 2 years ago
Its need to update code base with ability to use Eden private network. Checkout RPC url while sending a transaction to network.
The icons need for PR could find here: https://app.zeplin.io/project/5d0356be2f25b319dcc5944b/styleguide/components?coid=6197a1c20ba031a7c0eb8347
Note, in case if android doesn't support sending requests for ethermine
, check RPC url for seach server:
.main
- https://rpc.ethermine.org
;
other servers
- use default RPC url.
For .eden use the next private RPC urls:
.main
- https://api.edennetwork.io/v1/rpc
;
ropsten
- https://dev-api.edennetwork.io/v1/rpc
;
other servers
- use default RPC url.
Note, in case if android doesn't support sending requests for ethermine, check RPC url for seach server:
No, it doesn't yet. Might as well do it together.
@oa-s thanks. Help assign this to @JamesSmartCell when you are done. Maybe screenshots of where the changes are in the UI too?
@oa-s bump
@JamesSmartCell can you please guide me on this?
seems like edennetwork website is not accessible right now. Also I dont have the access to the given zeplin project.
@oa-s or @hboon can you show the current flow on iOS? Is there any special handling or is it just done as a new network as normal?
If it's a normal network, I see RPC calls but no transaction query API routes. Do these correspond to existing networks? Or a single existing network eg Mainnet?
So, eg would I send the transaction via eden, get a tx hash and then scan for that on mainnet?
"Note, in case if android doesn't support sending requests for ethermine" what does this mean? Why would Android natively support any crypto transaction mechanism? what is "ethermine" and how does it affect or interact with eden?
Sorry I don't really understand any of this PR or how it's supposed to work. Can you clarify with a quick run through for Asif and myself?
@oa-s or @hboon can you show the current flow on iOS? Is there any special handling or is it just done as a new network as normal?
If it's a normal network, I see RPC calls but no transaction query API routes. Do these correspond to existing networks? Or a single existing network eg Mainnet?
So, eg would I send the transaction via eden, get a tx hash and then scan for that on mainnet?
Sure. This isn't the same as adding a chain that we normally do.
What Eden and Ethermine does is, they are miners and they offer an RPC endpoint for us to post transactions to. These transactions are only broadcast after they are mined, to prevent front-running (by others). Hence "private". They also offer some other functionality that involves staking, but we aren't using those.
So technically, if the user has to use Eden, everything stays the same, except when the user sends a transaction on Ethereum mainnet:
This should be built, keeping in mind that we support more than one of this. In fact, we have Eden and Ethermine:
The 3 RPC endpoints are mentioned in the 2nd comment above.
Thanks @hboon for the detailed explanation. I think I understand what needs to be done. How does the user select he wants to use Eden or ethermine? Maybe its in zeplin spec. I can't access that yet.
@asif-finimble Sorry, missed this. Like this:
⬇️
⬇️
Enabled (will look a bit different for Android):
@hboon how can the user disable private transactions? Does the selection state toggles on clicking the selected item? @JamesSmartCell what view do you think we should use here?
@asif-finimble Yes, it should toggle to off if the user taps on a selected item.
I don't know how to present it though.
@asif-finimble Yes, it should toggle to off if the user taps on a selected item.
I don't know how to present it though.
OK. Thanks. Got it
@hboon, @JamesSmartCell is this setting common for all wallets(if the user has multiple wallets) or we need to store the setting separately for each wallet? Also I don't have the icons for Eden, ethermine and private txn settings item.
@asif-finimble Up to @JamesSmartCell , we just make it global for all users on iOS.
Eden icon here: https://github.com/AlphaWallet/alpha-wallet-ios/issues/3445 Ethermine's: https://github.com/AlphaWallet/alpha-wallet-ios/issues/3270#issuecomment-953592854
For iOS, we just use the selected option's (Eden or Ethermine) icon in Settings > Advanced. If none is chose, use Ethermine's
Thanks @hboon.
As for the icons, the ticket contains link to zeplin which I don't have access to.
@JamesSmartCell As per my understanding, we need to add new chain IDs and corresponding NetworkInfo
objects for Eden and Ethermine in the networkMap
. And we will check at the time of sending transactions, if private transactions are enabled, then we will use the selected private network's rpc for sending on mainnet and ropsten. Am I Right? or can you suggest appropriate flow.
Thanks @hboon. As for the icons, the ticket contains link to zeplin which I don't have access to.
How about this? https://app.zeplin.io/project/5d088205bff2d15de6a4397b/styleguide/components?coid=6197a1c20ba031a7c0eb8347 (the 1st 2 icons). You can get here from the Android project in Zeppelin.
Thanks @hboon. As for the icons, the ticket contains link to zeplin which I don't have access to.
How about this? https://app.zeplin.io/project/5d088205bff2d15de6a4397b/styleguide/components?coid=6197a1c20ba031a7c0eb8347 (the 1st 2 icons). You can get here from the Android project in Zeppelin.
Thanks. This will do.
@JamesSmartCell As per my understanding, we need to add new chain IDs and corresponding
NetworkInfo
objects for Eden and Ethermine in thenetworkMap
. And we will check at the time of sending transactions, if private transactions are enabled, then we will use the selected private network's rpc for sending on mainnet and ropsten. Am I Right? or can you suggest appropriate flow.
I get it that the chainId will remain 1 - MAINNET_ID. But where do we specify to use the private rpc.?
NetworkInfo
will contain the private networks as well, and NetworkInfo
will return private or public rpc url based on whether private txn is active. We can update the getWeb3jService
method for deciding which rpc url to use for building AWHttpService
. Transaction
class to record whether this was a private or public transaction so when we show it from cache, we can call appropriate rpc for status.Hi @asif-finimble my apologies these came through while I was at the conference I am going through these now.
Yes, it looks like you stay on mainnet (1) but you'd need to have a shim wherever the transaction is sent to the chain. This only happens in class TransactionRepository
and always by web3j.ethSendRawTransaction
.
So it would probably be best to abstract that out into a function within that class that selects either: the normal path to send the raw transaction via web3j.ethSendRawTransaction
, or, if the Ethermine or Eden options are selected then you'd send the exact same transaction to the Ethermine or Eden.
I would set the Ethermine/Eden usage with SharedPrefs rather then realm since it's a global setting, like default wallet etc.
The pending transaction would still be written to Realm in exactly the same way (within TransactionRepository
).
@asif-finimble I refactored the code to make this slightly simpler - although you will now have to accomodate EIP1559 and Legacy transactions. Ping me for more info if required, but I suspect the method you'll be modifying is this code:
EthSendTransaction raw = web3j
.ethSendRawTransaction(Numeric.toHexString(signedMessage.signature))
.send();
You probably want to abstract the 3 uses of this out into a separate function which can switch between sending to Eden/Ethermine or default chain.
@oa-s would you help to elaborate? Note that checking for pending transaction status needs to be updated too.