bitshares / bitshares-ui

Fully featured Graphical User Interface / Reference Wallet for the BitShares Blockchain
https://wallet.bitshares.org
MIT License
517 stars 570 forks source link

Adding ETH Token ERC20 and PIVX forked coin #3390

Open ultra-pool opened 3 years ago

ultra-pool commented 3 years ago

Im trying to find a way to add a ETH ERC20 token. What files need to edited in order to do so? And is there a gateway or something needed? Im also trying to add a PIVX forked coin and ERC20 ETH token.

AmmarYousefM commented 3 years ago

Im trying to find a way to add a ETH ERC20 token. What files need to edited in order to do so? And is there a gateway or something needed? Im also trying to add a PIVX forked coin and ERC20 ETH token.

This UI is running on top of BitShares Blockchain; ETH is another different Blockchain, there are ETH gateways operating on BitShares that you can use at your own risk as they're the owners of Issued Assets on BitShares and being the custodian of ETH Blockchain assets.

Perhaps it's the same case with PIVX if it's an asset on a different Blockchain.

ckerflag commented 3 years ago

I'm pretty sure they're still integrating the site with eth and other currencies going to be a day or two yet or more

Sent from the all new AOL app for Android

On Thu, Aug 26, 2021 at 2:23 PM, Ammar Yousef @.***> wrote:

Im trying to find a way to add a ETH ERC20 token. What files need to edited in order to do so? And is there a gateway or something needed? Im also trying to add a PIVX forked coin and ERC20 ETH token.

This UI is running on top of BitShares Blockchain; ETH is another different Blockchain, there are ETH gateways operating on BitShares that you can use at your own risk as they're the owners of Issued Assets on BitShares and being the custodian of ETH Blockchain assets.

Perhaps it's the same case with PIVX if it's an asset on a different Blockchain.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

ultra-pool commented 3 years ago

I wonder how crypto bridge had it added.

AmmarYousefM commented 3 years ago

I wonder how crypto bridge had it added.

They'd created a custodian gateway; you can find the codes they'd used on UI and you will have to create an APIs that would feed the information needed in UI.

AmmarYousefM commented 3 years ago

I wonder how crypto bridge had it added.

This is helpful: https://github.com/bitshares/bitshares-ui/wiki/Gateway-Integration-Requirements

Crypto-Jacob commented 2 years ago

I know how to and have added ERC20 tokens to a version of bitshares.

I will not give a full example and code of how to integrate them into the blochchain and gateway, but will give you the steps needed.

First, you will need to create the asset on the blockchain. I would recommend running a local witness_node and using the cli_wallet. Import the owner and active key of a properly funded account, and make sure you have an account with the correct user level/permissions. Then you can issue the command to create your asset on the blockchain.

create_asset Your-Account TOKEN 12 { "max_supply": "100000000000000000", "market_fee_percent": 0, "max_market_fee": "0", "issuer_permissions": 79, "flags": 0, "core_exchange_rate": { "base": { "amount": 100000, "asset_id": "1.2.3" }, "quote": { "amount": 100, "asset_id": "1.2.3" } }, "whitelist_authorities": [], "blacklist_authorities": [], "whitelist_markets": [], "blacklist_markets": [], "description": "{\"main\":\"\",\"market\":\"\"}", "extensions": { "reward_percent": 0, "whitelist_market_fee_sharing": [] } } null true/false

The last flag I have as true/false is used to test with. Use false first to make sure there are no errors. Then once you have it like you want it changes the false to true and creates the asset on the blockchain. Next, you will need to issue it to the account you will use in your gateway to accept the ERC20 tokens and then issue them to the user.

issue_asset Gatewat-Account 1000000 TOKEN "initial issue" true/false Same thing about the last flag being true or false. Make sure you test it first.

Next you will need to set up a gateway server. You will need to install geth and run it. i suggest making a shell script to run it. Here are a few flags you will need to get it working with the gateway and you can figure out the rest. --ws --ipcdisable --ws.addr 127.0.0.1 --ws.origins "" --http --http.corsdomain "" --http.addr 127.0.0.1

Now that the easy part is over... YES that was the easy part. You will need to make sure the gateway wallet file is able to generate an ETH address and private key, then store this safely when you need to sweep all deposits into a withdrawal account. <- Make a cron job to do this if enough deposits are made.

Now you just need to make a process that will monitor generated addresses for deposits and then transfer the asset to the proper user when they deposited ERC20 token.

Now you can make another process to monitor the blockchain for a withdrawal request "The process must require them to transfer the asset back to Gatewat-Account". Then you use geth in the process to send the token to the withdrawal address from the ETH withdrawal account you sweep the tokens into.

This is in no way a how-to guide on doing it but it should point you in the correct direction.