Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for klaytn. #644

Closed
benjioh5 opened this issue Nov 3, 2019 · 6 comments
Closed

Adding support for klaytn. #644

benjioh5 opened this issue Nov 3, 2019 · 6 comments
Labels
discussion Questions, feedback and general information.

Comments

@benjioh5
Copy link

benjioh5 commented Nov 3, 2019

Klaytn is one of forked version of Ethereum and it aims enterprise usage of blockchain.
I saw #351 is accepted and I wonder kalytn's mainnet (cypress) and testnet (baobab) can be added. Klaytn has some few change of transaction model (e.g. adding fee delegation) but It's usally competible with ethereum's own structure.

Could I make some test cases and add for it?

@benjioh5 benjioh5 changed the title Is there any support for klaytn? Adding support for klaytn? Nov 3, 2019
@benjioh5 benjioh5 changed the title Adding support for klaytn? Adding support for klaytn. Nov 3, 2019
@ricmoo
Copy link
Member

ricmoo commented Nov 10, 2019

The only change required for ETC was adding backends to the list of common/known networks.

Changes to the Transaction serialization is far more substantial, but you can look at the @ethersproject-aion packages and related repository for an idea of how to extend ethers v5 to support new slightly different networks. I did the Aion library on behalf of a grant they provided, but in general supporting a new Etehreum-fork is outside of what I have time to do. :)

@ricmoo ricmoo added the discussion Questions, feedback and general information. label Nov 10, 2019
@ricmoo
Copy link
Member

ricmoo commented Nov 20, 2019

I'm going to close this now, but please feel free to re-open or continue discussion. I monitor closed issues.

Thanks! :)

@ricmoo ricmoo closed this as completed Nov 20, 2019
@benjioh5
Copy link
Author

benjioh5 commented Nov 23, 2019

Sorry for late comment.

Klaytn supports LEGACY mode (original Ethereum Tx) and DELEGATE_FEE mode. I think @ethersproject-aion would be good example for forking, but LEGACY mode is good enough for using klaytn. (Actually DELEGATE_FEE transaction is not yet widely used in klaytn network.)

Klaytn's caver-js's provider fully supports etherjs's HttpProvider method.

import { ethers } from 'ethers';
const Caver = require('caver-js') // forked version of web3js
const caver = new Caver('https://api.baobab.klaytn.net:8651/')

provider = new caver.providers.HttpProvider(`https://api.baobab.klaytn.net:8651/`);
provider = new ethers.providers.Web3Provider(provider);
// It Works!

Then I just want to add network information to etherjs. And I'll maintain or take care about klaytn's modified version of fee delegation transaction. It would be easy work for just adding provider for klaytn and then forks ethersjs for ethersjs-klaytn.

Thanks! :)

@taalswap
Copy link

taalswap commented Jan 4, 2022

After send a transaction to Klaytn busing ethers.js
const tx = await contract.method(parameters, ...overrides)

To receive the receipt
const receipt = await tx.wait()

Then... ethers.js emit an error:
Unhandled Rejection (Error): invalid BigNumber string (argument="value", value="TxTypeLegacyTransaction", code=INVALID_ARGUMENT, version=bignumber/5.5.0)

I think that Klaytn guys need to support ethers.js urgently to extend their dApp ecosystem because many dApps running already on ethereum, binance and so on are using ethers.js not caver-js

@benjioh5
Copy link
Author

benjioh5 commented Feb 16, 2022

I found Klaybank team made some forked version for klaytn. Is there any chance to review this and make it official klaytn ethersjs version?

https://github.com/klaybank/ethers_providers_klaytn

@ricmoo

@ricmoo
Copy link
Member

ricmoo commented Feb 16, 2022

I would love to check it out.

I’m working on a v6 Network for Klatyn, so seeing differences will help.

In v6, a simple Network object can override a lot of provide behaviour, so it makes ethers behave frictionlessly with other chains. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

3 participants