emeraldpay / dshackle

Fault Tolerant Load Balancer for Ethereum and Bitcoin APIs
Apache License 2.0
299 stars 65 forks source link

Binance Smart Chain - BSC support #146

Open feraudet opened 2 years ago

feraudet commented 2 years ago

Hello, Could it be possible to add BSC support ? I'm not a java/groovy aficionados but as far as I can see it's seems possible by adding some lines, I am wrong ? What is your thought ? Cyril

quickchase commented 2 years ago

If you copy #103 with the right chain info for BSC, it should work...

splix commented 2 years ago

Yes, as @quickchase said, at this moment the idea is to use it just use it as ethereum. Consider it as a generic ethereum configuration. It works. But the limitation of that approach it that you'll be limited with only one ethereum chain withing a single Dshackle instance. I mean you can have multiple upstreams, just make sure all of them are on same chain. Don't mix Ethereum Mainnet and Binance Mainnet on same instance.

feraudet commented 2 years ago

Yes, as @quickchase said, at this moment the idea is to use it just use it as ethereum. Consider it as a generic ethereum configuration. It works. But the limitation of that approach it that you'll be limited with only one ethereum chain withing a single Dshackle instance. I mean you can have multiple upstreams, just make sure all of them are on same chain. Don't mix Ethereum Mainnet and Binance Mainnet on same instance.

It's what I did but it constraint me to have a dedicated instance for BSC and send stats tagged as "ETH" in prom :/

feraudet commented 2 years ago

If you copy #103 with the right chain info for BSC, it should work...

Code seems to have changed a lot since this PR. But I will try by my own

splix commented 2 years ago

yes, right, that's a limitation. In all logs and metrics it going to be just ETH, that's why I called it "generic ethereum"

99hops commented 2 years ago

This will be a huge leap for the project, dapps use lots of networks and BSC is a big one that we need to utilize in the project. Having a separate instance just because of ETH vs BSC network is unwanted trouble that seems not a viable solution to the problem.

Zorlin commented 2 years ago

@splix How do you use BSC as generic ethereum? Isn't the chainID different?

EDIT: For those who come after me, this is roughly what I figured out from these hints. You can run a "BSC-dedicated" instance, and list BSC RPC endpoints as if they were mainnet Ethereum endpoints, with the same chainID as Ethereum, and that instance will pretty much "just work" as if it were actually a BSC version of Dshackle. You can then front that instance with something like nginx to provide different paths (some.server.com/bsc, some.server.com/eth) for different chains.