My goal is to create a wallet for my own website where people can deposit and withdraw, Just imagine I am building a Binance version on icp
Thinking out loud, have you considered this architecture?
You create an ICP canister.
For each user, within the ICP canister, you create ECDSA key with the derivation path as a user ID.
Users can send the native USDC and USDT to their ECDSA key.
If they need to send their USDC or USDT somewhere, the canister can sign on their behalf.
I am describing this quite high level at the moment but let me know if you need a deep dive in a specific area!
I am trying to use something like oisy now, and first step is to create eth wallet then call encodePrincipalToEthAddress(Principal.fromText(profile.id)) but still tryting to figure out the code, i got all the theories by now
I want to call scketh and from it swap to used and verify that the user made a deposit
i made this https://codesandbox.io/p/sandbox/6pp95t just to get started with make usdc wallet and generate usdc address
Thinking out loud again:
If you are trying to swap ckETH to USDC, it might make sense to swap to ckETH to ckUSDC and then convert ckUSDC to USDC with the deposit account as the ECDSA key that you generated for the user.
I am not sure if this is the right approach since the Principal is not specific to your canister and a user id. For example, let’s say that your user’s id is “abc”, you are then converting “abc” to a principal and then to an ETH address without any regard to the user specifically using your canister. Another dapp could convert the same text “abc" to a principal and then an ETH address. Multiple users could potentially share the same principal and ETH address.
Have you looked into Threshold ECDSA examples?
Yes, i was checking, oisy repo, and chain fusion example,
for ECDSA examples i think it is the most helpful one, as they have send_eth and ethereum_address methods. I am assuming calling the ethereum_address method is used to deposit. So u copy the address and put it in binance account to deposit
@AliSci Also check out this just published example app on how to build an ETH wallet on ICP. It doesn’t support ERC-20 tokens but that could easily be added.
I’ve been playing around with setting up ckTestBTC and learned a lot from doing it. It’s not complete but it’s interesting for this kind of thing. Needed it to figure out how to create a custodial wallet for gifting crypto to others where a custodian holds funds from one user to be delivered to another.
Questions it answers:
- How do you handle local development features without access to ckTestBTC or Physical TestNet funds? (Mock canisters that conform to ckBTC (minter and leger) at ic/rs/bitcoin at 65e12ce072d7e2c4961f327325f21b210298378b · dfinity/ic · GitHub )
- How can you mint some ckTestBTC and deliver it to an Authenticate Principal without needing physical TestNet BTC? Grant access to the minter locally!
- How do you receive ckTestBTC as a custodian? Need a deposit mechanism to pass from an authenticated principal to your canisters custodial solution (needs mapping of funds using subaccounts).
- Other interesting goodies there too.