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

Add support for SLP tokens on the BCH network (Bitcoin colored coins) #701

Closed
damascene opened this issue Jul 11, 2020 · 69 comments
Closed

Comments

@damascene
Copy link

SLP tokens are Bitcoin colored coins on the BCH network. SLP stands for Simple Ledger Protocol.
SLP tokens are growing in popularity, Tether is now available as a Standard Ledger Protocol token on the Bitcoin Cash network.

image

SLP tokens are cheap to trade, they benefit from BCH simple and low transfer cost ($0.0012).
I've noticed that most stable currencies on the AtomicDEX are Ethereum based which makes it a bit expensive to trade, I think SLP tokens can solve this issue and benefit the project.

I'm opening this issue after a suggestion by KomodoWorld on reddit.

@ca333
Copy link

ca333 commented Jul 14, 2020

thanks for opening this @damascene - we have additional protocol integrations on our post-RC roadmap (starting 2021) - however, there might be option to add SLP support as a 3rd party/community contribution before RC. Our core lead developer @artemii235 can provide you details/references ref. this topic. Thanks!

@ca333 ca333 added After beta enhancement New feature or request labels Jul 14, 2020
@damascene
Copy link
Author

@artemii235 would like to hear your input on this, is it technically possible?

@artemii235
Copy link
Member

@damascene Hi! It's unclear for me now whether it's possible to implement an HTLC for SLP so I'm not able to say if the integration is 100% possible. To answer this question we should do a research on this topic, but we don't have resources for it right now.

But community contributions are always welcome. I think that we possibly can assign a bounty for such initial research, also there is Flipstarters BCH program that can be also used to fund such research and then integration if research shows that it is technically possible.

@artemii235
Copy link
Member

I'm glad to announce that HTLC proof of concept for SLP on Rust is eligible for 1000 KMD bounty!
The requirements to receive it are as follows:

  1. The proof of concept must be implemented on pure Rust with pure Rust dependencies.
  2. The PoC should contain tests demonstrating creation of HTLC transaction for SLP of BCH testnet and then redeeming using secret and refunding the HTLC when time lock is expired (so there must be at least 2 tests).
  3. PoC must use Electrum client so the demo does not require local BCH testnet daemon configuration and sync.
  4. Using existing AtomicDEX-API code (e.g. for Electrum client implementation) is encouraged but not mandatory.
    AtomicDEX-API team can provide limited support to the developer who will be implementing the PoC in regards to this item.

@damascene damascene changed the title Add support for SLP tokens tokens on the BCH network (Bitcoin colored coins) Add support for SLP tokens on the BCH network (Bitcoin colored coins) Oct 4, 2020
@molecular
Copy link

I'm glad to announce that HTLC proof of concept for SLP on Rust is eligible for 1000 KMD bounty!

I'll throw in another 560 USD worth of BCH to whoever gets this bounty.

@damascene
Copy link
Author

damascene commented Oct 7, 2020

These resources could be useful for developers:

Rust libraries
https://crates.io/crates/bitcoin-cash
https://crates.io/crates/bitcoin-cash-slp

SLP Rust project
Onchain trading console written in Rust that allows users to auction SLP tokens for bitcoin cash
https://github.com/EyeOfPython/slpagora
More info and a video here

More SLP resources:
https://simpleledger.cash/get-started/
https://slp.dev/get-started/

Mint tokens online:
https://mint.bitcoin.com

@blockparty-sh
Copy link

The SLP Foundation would like to add another $1000 in Bitcoin Cash to the bounty for a HTLC proof of concept for SLP.

We are also happy to assist in any questions related to SLP in building this POC. You can contact me directly on Telegram @blockparty_sh or tag me on GitHub.

@dagurval
Copy link

  1. The PoC should contain tests demonstrating creation of HTLC transaction for SLP of BCH testnet and then redeeming using secret and refunding the HTLC when time lock is expired (so there must be at least 2 tests).

Do these tests for HTLC transaction creation + refunding of any other UTXO-based coins exist? Something like “we want this, but it needs to support SLP”.

SLP tokens are client-validated. To know if we’re working with a valid token UTXO using electrum, we need to traverse its transaction DAG back to the token genesis transaction. To solve this issue, is this validation required, or can we assume we’re working with a valid SLP utxo?

@artemii235
Copy link
Member

@dagurval

Do these tests for HTLC transaction creation + refunding of any other UTXO-based coins exist? Something like “we want this, but it needs to support SLP”.

There are tests using komodod daemon in Docker: https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2/mm2src/docker_tests.rs#L351. The common code building HTLC transactions for UTXO-based coins can be found at https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2/mm2src/coins/utxo/utxo_common.rs#L537

SLP tokens are client-validated. To know if we’re working with a valid token UTXO using electrum, we need to traverse its transaction DAG back to the token genesis transaction. To solve this issue, is this validation required, or can we assume we’re working with a valid SLP utxo?

We can assume that we're working with valid SLP utxo, I think that we can omit the validation for PoC.

@damascene
Copy link
Author

@EyeOfPython have offered to do it in for $4000. We have successfully added $2000 to the bounty in this Flipstarter https://flipstarter.googol.cash/
Hopefully we can get this done very soon :)

@EyeOfPython
Copy link

Hey, I can do it. I'm the author of the above mentioned libraries.

@EyeOfPython
Copy link

@artemii235 One question. I‘m using the secp256k1 library on Rust, which links to the libsecp256k1 library written in C. I have feature flags to switch over to the pure-Rust equivalent written by Parity, but I don't trust it as much regarding side channel attacks etc.

Would using secp256k1 defy your "pure Rust dependencies" requirement?

@EyeOfPython
Copy link

Also, could you provide a link to an Electrum client for Rust?

@molecular
Copy link

https://flipstarter.googol.cash/

that site doesn't load for me.

What about the 560 USD I pleged above? Should I "cancel" that pledge and "move" it to this flipstarter?

@damascene
Copy link
Author

@molecular page is archived now. https://archive.is/O9HXr
Don't cancel your pledge. The Flipstarter was to get extra fund for the project.

@molecular
Copy link

@damascene I see, thanks. Ping me when I should pay.

Thanks @EyeOfPython for offering to do this.

@dth88
Copy link

dth88 commented Dec 6, 2020

ouch, I was actually working on this past week, almost ready...

@EyeOfPython
Copy link

EyeOfPython commented Dec 7, 2020

Great news! I was able to finish the HTLC SLP PoC in Rust.

You can find the code here:

https://github.com/EyeOfPython/slp-htlc

SLP Hash Timelock Contract

Nomenclature and (modified) script taken from https://github.com/bitcoin/bips/blob/master/bip-0199.mediawiki.

Usage

Setup

Note: Apart from the RPC configuration, the below commands for the setup can also be done in the GUI. They are done via the commandline for reproducability here.

  1. Install Electron Cash SLP Edition (https://simpleledger.cash/project/electron-cash-slp-edition/) and locate its executable (assumed to be ./electron-cash from here on).
  2. Run ./electron-cash --testnet setconfig rpcport 7777 to set the JSON RPC port.
  3. Run these commands and keep the username and password ready:
    • ./electron-cash --testnet getconfig rpcuser
    • ./electron-cash --testnet getconfig rpcpassword
  4. Create the Seller wallet (seller is the party that will receive the SLP tokens, and presumably sell some other cryptoasset of value, e.g. ETH or BTC):
    • ./electron-cash --testnet create_slp -w ./sellerwallet
  5. Create the Buyer wallet (buyer is the party that sends the SLP tokens, and presumably buy some other cryptoasset of value, e.g. ETH or BTC):
    • ./electron-cash --testnet create_slp -w ./buyerwallet
  6. Run Electron Cash SLP edition either as daemon or GUI:
    • Either: ./electron-cash --testnet (GUI, for testing)
    • Or: ./electron-cash --testnet daemon (no GUI, for servers)
  7. In a new terminal, run ./electron-cash --testnet daemon load_wallet -w ./sellerwallet to switch to Seller's wallet.
  8. Get the address from seller's wallet:
    • Run curl --data-binary '{"id":0,"method":"getunusedaddress"}' http://<rpcuser>:<rpcpassword>@127.0.0.1:7777, where rpcuser and rpcpassword are the values from above, and keep the generated address ready.
    • Also send some tBCH to that address for the 'gas' for txs. 0.00010000 tBCH suffices. You might need to convert the address to bchtest for this.
    • Run curl --data-binary '{"id":0,"method":"slp_add_token","params":{"token_id":"<token_id>"}}' http://<rpcuser>:<rpcpassword>@127.0.0.1:7777, where token_id is the token you want to send.
  9. Run ./electron-cash --testnet daemon load_wallet -w ./buyerwallet to switch to Buyer's wallet.
  10. Fund the buyer's wallet:
    • Run curl --data-binary '{"id":0,"method":"getunusedaddress"}' http://<rpcuser>:<rpcpassword>@127.0.0.1:7777.
    • Send some SLP tokens to that address (prefix is "slptest"; if prefix is "bchtest", you loaded a non-SLP wallet previously; restart Electron Cash SLP in this case and load the daemon wallet anew).
    • Also send some tBCH to that address for the 'gas' for txs. 0.00010000 tBCH suffices. You might need to convert the address to bchtest for this.
    • Run curl --data-binary '{"id":0,"method":"slp_add_token","params":{"token_id":"<token_id>"}}' http://<rpcuser>:<rpcpassword>@127.0.0.1:7777, where token_id is the token you've sent.
  11. Setup complete!

Fund HTLC

From the setup above, you should have these values ready:

  • The JSON RPC URI http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
  • An unused address from Seller.

Also, you should be switched to Buyer's wallet.

Now we can fund the HTLC:

  1. Clone this repository (git clone https://github.com/EyeOfPython/slp-htlc.git)
  2. Run cargo run -- gen-secret and keep the secret and secret hash ready (this would happen on Sellers's computer).
    Example output:
    secret: eb5078d1f306784715040d1846871adfb476e848e7e7c6aaec1822bce35311dd
    secret hash: 6af9c9b8635b453c9ce522bf44a11f0afcd8ad9d
    
  3. Run the following command:
    cargo run -- \
        send-htlc \
        --token-id <token-id> \
        --amount <amount> \
        --seller-address <seller-address> \
        --secret-hash <secret-hash> \
        --timeout <timeout> \
        --uri <uri>
    Where:
    • token-id: token you've sent
    • amount: amount of the token you want to lock into the HTLC
    • seller-address: address from Seller we've previously generated
    • secret-hash: the secret hash Seller has provided us for this setup (from gen-secret)
    • timeout: UNIX timestamp for when this HTLC expires
    • uri: JSON RPC URI
      Example:
    $ cargo run -- \
        send-htlc \
        --token-id bb309e48930671582bea508f9a1d9b491e49b69be3d6f372dc08da2ac6e90eb7 \
        --amount 1 \
        --seller-address slptest:qrzurumzwn7kwtcszk3jgpgfgecp4ws8wcvvxgnrts \
        --secret-hash 6af9c9b8635b453c9ce522bf44a11f0afcd8ad9d \
        --timeout 1607333086 \
        --uri http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
    buyer address: slptest:qqcjtkw3a3mdh26y0ryrtfmxf4y2jhle6y72nalmlq
    timeout: 1607333086
    contract UTXO: 6912c3a61f715dba3067e0a17e5613f9d19edeea593b9456f952bd34de06faa5:1
    
  4. Keep keep the buyer address, timeout and contract UTXO handy (this would be sent to Seller).
  5. HTLC funded!

Redeem HTLC

From the fund step above, you should have these values ready:

  • The JSON RPC URI http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
  • The seller address from the HTLC.
  • The buyer address from the HTLC.
  • The timeout for the HTLC.
  • The contract UTXO for the HTLC.
  • The secret (preimage) for the HTLC.
  1. Run ./electron-cash --testnet daemon load_wallet -w ./sellerwallet to switch to Seller's wallet.
  2. Run the following command:
     $ cargo run -- \
         redeem-htlc \
         --contract-utxo <contract-utxo> \
         --buyer-address <buyer-address> \
         --secret <secret> \
         --timeout <timeout> \
         --seller-address <seller-address> \
         --uri <uri>
    
    Example:
    $ cargo run -- \
         redeem-htlc \
         --contract-utxo 6912c3a61f715dba3067e0a17e5613f9d19edeea593b9456f952bd34de06faa5:1 \
         --buyer-address slptest:qqcjtkw3a3mdh26y0ryrtfmxf4y2jhle6y72nalmlq \
         --secret eb5078d1f306784715040d1846871adfb476e848e7e7c6aaec1822bce35311dd \
         --timeout 1607333086 \
         --seller-address slptest:qrzurumzwn7kwtcszk3jgpgfgecp4ws8wcvvxgnrts \
         --uri http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
    contract_amount: 10000
    token_id: TokenId(Sha256d(bb309e48930671582bea508f9a1d9b491e49b69be3d6f372dc08da2ac6e90eb7))
    57d3446c56b3557825cbb8b7f618d0ccef0fd26bef217e30d838ec413dcd2d86
    
  3. HTLC redeemed!

Timeout HTLC

Run the Fund HTLC section again to generate a new HTLC.

This will give you these values:

  • The JSON RPC URI http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
  • The seller address from the HTLC.
  • The buyer address from the HTLC.
  • The timeout for the HTLC.
  • The contract UTXO for the HTLC.
  • The secret hash for the HTLC.

Example:

$ cargo run -- gen-secret
secret: e51e578fd319d8a1b8b55256b3a0c9773a931252398f13847b89d789b9835e00
secret hash: 82fa07e4ee949640eb4eb5ed509c8a8732640b97
$ ./electron-cash --testnet daemon load_wallet -w ./buyerwallet
$ cargo run -- \
    send-htlc \
    --token-id bb309e48930671582bea508f9a1d9b491e49b69be3d6f372dc08da2ac6e90eb7 \
    --amount 1 \
    --seller-address slptest:qq49s69jttj8ay9fuqknttrwxesztm88vqfrk4c040 \
    --secret-hash 82fa07e4ee949640eb4eb5ed509c8a8732640b97 \
    --timeout 1607334641 \
    --uri http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
buyer address: slptest:qqcjtkw3a3mdh26y0ryrtfmxf4y2jhle6y72nalmlq
timeout: 1607334641
contract UTXO: ef44a5ee9e481b8eb2343d8e46417281a90a02051f3bc1ef901229fcab5b555f:1
  1. Run the following command:
    $ cargo run -- \
        timeout-htlc \
        --contract-utxo <contract-utxo>
        --seller-address <seller-address>
        --secret-hash <secret-hash>
        --timeout <timeout>
        --buyer-address <buyer-address>
        --uri <uri>
    
    Example:
    $ cargo run -- \
        timeout-htlc \
        --contract-utxo ef44a5ee9e481b8eb2343d8e46417281a90a02051f3bc1ef901229fcab5b555f:1 \
        --seller-address slptest:qq49s69jttj8ay9fuqknttrwxesztm88vqfrk4c040 \
        --secret-hash 82fa07e4ee949640eb4eb5ed509c8a8732640b97 \
        --timeout 1607334641 \
        --buyer-address slptest:qqcjtkw3a3mdh26y0ryrtfmxf4y2jhle6y72nalmlq \
        --uri http://<rpcuser>:<rpcpassword>@127.0.0.1:7777
    contract_amount: 10000
    token_id: TokenId(Sha256d(bb309e48930671582bea508f9a1d9b491e49b69be3d6f372dc08da2ac6e90eb7))
    dff9d9964d5276794d82f5e930aeb9f3a2088dd34744a6d815e89e19d6fd4203
    
  2. Wait for MTP timeout to arrive.
  3. HTLC refunded!

@artemii235
Copy link
Member

Hi @EyeOfPython, please excuse me for long response, I was offline on weekend.

One question. I‘m using the secp256k1 library on Rust, which links to the libsecp256k1 library written in C. I have feature flags to switch over to the pure-Rust equivalent written by Parity, but I don't trust it as much regarding side channel attacks etc.
Would using secp256k1 defy your "pure Rust dependencies" requirement?

It is fine to use the libsecp256k1 written in C, we were using the pure Rust version from Parity too, but already switched back some MM2 subcrates back to secp256k1 C bindings.

Also, could you provide a link to an Electrum client for Rust?

The code is here: https://github.com/KomodoPlatform/atomicDEX-API/blob/mm2.1/mm2src/coins/utxo/rpc_clients.rs, it is planned to publish it as separate crate one day, but as I can see you were able to complete a PoC without it.

Great news! I was able to finish the HTLC SLP PoC in Rust.
You can find the code here: https://github.com/EyeOfPython/slp-htlc

Great! I need some time to check and test the code, will post a comment tomorrow in regards to this, thanks!

@artemii235
Copy link
Member

@EyeOfPython Hi! I've started checking the PoC and noticed that I don't know any SLP token on BCH testnet. Could you please send some to following addresses and give the corresponding token_id?
qr7rn5l339y50hy8ls0hx5czz6jxuhpmss6mmqp3wh
qp572pj0nhfvrsau8493cl9vzxt50atr5ca0lm42pf

Could you please also provide info on how I can convert the above addresses to the bchtest? Would be best if you can add the code of such conversion to the PoC repo.

@EyeOfPython
Copy link

EyeOfPython commented Dec 8, 2020

I send 10 Fake USD to each of those addresses! Token ID is bb309e48930671582bea508f9a1d9b491e49b69be3d6f372dc08da2ac6e90eb7.

Btw, minting SLP tokens is really easy in Electron Cash SLP, but I would say overkill for this.

Tell me if you need more tokens, they're literally worthless.

@artemii235
Copy link
Member

artemii235 commented Dec 8, 2020

I send 10 Fake USD to each of those addresses! Token ID is

Thanks a lot!

Could you please also provide info on how I can convert the addresses to bchtest: prefixed addresses? I guess SLP has a different address generation algorithm and it is not quite clear to me now how I can convert them without digging too much into the code.

@dth88
Copy link

dth88 commented Dec 8, 2020

artemii235 added a commit that referenced this issue Sep 29, 2021
* WIP. Made full order matching and swap test with RICK and FUSD.

* WIP. Implementing traits for SlpToken.

* WIP. Implemented SLP withdraw. Added BchCoin.

* WIP. Avoiding usage of SLP UTXOs for normal BCH. Some tests fail.

* WIP. Added UtxoTxBuilder. All tests pass.

* Fixes after merge.

* WIP. Refactoring tx builder. Code doesn't compile.

* WIP. RICK/FUSD trade failed with the "transaction was rejected by network rules" on RICK side.

* WIP. Refactored BCH unspents retrieval.

* Fix Clippy and WASM.

* WIP. Added tx_size arg to get_htlc_spend_fee.

* WIP.Properly handle ActualTxFee::FixedPerKb case in get_htlc_spend_fee.

* WIP. Remove bitcoin-cash-slp dependency. Build SLP sending script in MM2 entirely.

* WIP. Add more checks in parse_slp_script.

* WIP. Remove RICK/FUSD from trade_test_electrum_and_eth_coins - will move to docker_tests.

* WIP. Moving SLP trading tests to docker_tests.

* WIP. Added docker_tests_common and few SLP-related tests.

* Fix zhtlc feature compilation. Check that RICK/ZOMBIE trade test pass.

* WIP. Researching tx building with Sapling spends.

* WIP. Dummy add_sapling_spend that doesn't work yet.

* WIP. Sent the shielded spend transaction using pure Rust code.

* Sent and refunded dex fee on ZOMBIE chain.

* WIP. Added send_outputs and started using it in z_send_dex_fee and z_send_htlc.

* Add SendOutputsErr::InsufficientBalance and return it accordingly in send_outputs.

* WIP. Making dex fee a shielded output with the public OVK.

* WIP. Made dex fee a shielded output with the public OVK. Implemented validation.

* WIP. Try using cached commitment tree.

* WIP. Adding the DB to cache the Sapling data.

* WIP. Refactored send_outputs to use cached Sapling data.

* WIP. Refactor to avoid unwraps etc.

* Verbose tx format hotfix for tBCH electrum. tBCH and USDF activation examples.

* WIP. ZCoin withdraw.

* Add separate methods to get BCH/SLP unspents for balance display.
Did that to avoid locking the mutex on each balance call.
#1034

* Extract recently_spent from SlpTxPreimage to avoid occasional deadlocks.

* WIP. Implemented withdraw for ZCoin.

* WIP. Building Sapling cache DB for ARRR.

* Restore sapling_state_cache_loop. Add ARRRConsensusParams. Sent first HTLC on PIRATE.

* Use ARRRConsensusParams to build tx in z_p2sh_spend.

* Increase TAKER_FEE_RECV_TIMEOUT to 600.

* WIP. Fixing after merging from dev.

* Fixes after merge.

* Fixes after merge.

* Fix WASM.

* Fix after merge.

* One more fix.

* Fixes after merge.

* Review fixes.
artemii235 added a commit that referenced this issue Oct 8, 2021
* WIP.

* WIP. Switched to gRPC-WEB. Removed tonic. Tested GetSlpTrustedValidation.

* Add validate_slp_utxos and test.

* Recreate branch.

* WIP. Adding WASM support for gRPC web.

* WIP. Adding WASM support for gRPC web.

* WIP. Adding WASM support for gRPC web.

* WIP. Added check_slp_transaction API support.

* WIP. Adding more validation.

* WIP. Adding more validation.

* Added more tests. The feature seems complete.

* Remove unneeded allow.

* Fix ZHTLC compilation.

* Review fixes.
@artemii235
Copy link
Member

I have recently added BCHD gRPC-web API support to validate SLP UTXOs and transactions generated by AtomicDEX to prevent token burning. As we have ongoing work on web browser support, I was curious to try it in WASM to have SLP tokens supported on the web right away. I faced the CORS issue during my tests: gcash/bchd#489. If someone has a direct communication channel with BCHD developers/public instances maintainers, please let me know.

Also an update regarding overall progress: BCHD support seems to work well in the desktop GUI. I'm currently working on tx history implementation, which requires a bit of refactoring including enable 2.0 RPC. It may take a few weeks, but we are on the home stretch for sure 🙂

artemii235 added a commit that referenced this issue Nov 11, 2021
* WIP. Adding RequestBody::Bytes.

* WIP. gRPC-web doesn't work under WASM yet.

* WIP. Catching up with dev. WASM doesn't compile.

* Fixed compilation after merging with dev. Some tests fail.

* WIP. Added x-grpc-web header to make CORS working. Tests still fail for other reason.

* Got gRPC-web working in WASM. Added Provider::Nomics.
artemii235 added a commit that referenced this issue Nov 11, 2021
#1130)

* WIP.

* WIP. Making enable_v2 split into separate protocol activation RPCs.

* WIP. Figuring out the design for generic coins and tokens activation functions.

* WIP. Compilation fails.

* WIP.

* Added coins_activation crate. Implemented new enable_slp v2 method.

* Fix ZHTLC.

* Fix fmt for empty TODO modules.

* Fix after merge.

* Remove enable_v2.rs.
artemii235 added a commit that referenced this issue Nov 22, 2021
* WIP. Implementing platform_coin_with_tokens.rs

* WIP.

* WIP.

* WIP. Clippy fails.

* Initial version of enable_bch_with_tokens is complete.

* Review fixes.
artemii235 added a commit that referenced this issue Dec 28, 2021
* WIP.

* WIP. Added SqliteTxHistoryStorage.

* WIP. Implementing BCH and SLP tx history fetching as state machine.

* WIP.

* WIP. Tests fail.

* WIP. Refactoring.

* WIP.

* WIP.

* WIP.

* WIP.

* WIP.

* WIP. Fixes after merging dev.

* WIP.

* WIP. Adding tests.

* WIP. Updated toolchain. Adding block timestamp method to coins.

* WIP. Implementing my_tx_history_v2_rpc.

* WIP. Fixes after merging dev.

* WIP. Implementing my_tx_history 2.0 RPC.

* WIP.

* WIP. Implementing querying history from SQLite.

* WIP. Added db_common crate.

* WIP. RPC 2.0 is ready. Some tests left todo.

* Finish tests. Fix Clippy.

* Fix WASM.

* Add a couple of allows for my_tx_history_v2 under WASM.
@artemii235
Copy link
Member

We can consider the SLP integration status as final on the API side and ready for the pre-release testing! It took a while so I'm posting a detailed report of what has been done since the last update:

  1. Added a new enable_bch_with_tokens RPC 2.0 method. It allows activating BCH and any number of SLP tokens at once in a traffic effective manner returning balances for all of them in a single response. It also took some effort to perform internal refactoring and design abstractions allowing to use of the same concept for other protocols.
  2. Added a new enable_slp RPC 2.0 method. It allows enabling more tokens in addition to ones activated using the enable_bch_with_tokens.
  3. Implemented transactions history background fetching for BCH and SLP from scratch using our internal state machine pattern. It stores the data for SLP transfers if tokens are not activated or even not added to the config. If BCH history fetch is complete, all SLPs' history will be immediately available after activation.
  4. Added the TxHistoryStorage trait and implemented it for our SQLite DB. This is more effective than our old way of using plain JSON files. The abstraction will also allow implementing tx history easier for WASM in the future.
  5. Implemented a new my_tx_history 2.0 RPC that works on top of TxHistoryStorage.

For testing, please use the https://github.com/KomodoPlatform/atomicDEX-API/tree/dev branch and config from https://github.com/KomodoPlatform/coins/tree/bch-slp-mainnet-TEST-ONLY. In the beginning, please avoid using a significant amount of the real value assets. If any tokens get burned, please let us know about it immediately in this issue.

New RPCs will be documented and published on the website soon, examples can be found in the corresponding issue KomodoPlatform/developer-docs#343.

I'm now preparing issues for the final integration in our GUIs. The desktop release should happen in early 2022. Mobile can happen a bit later afterward.

@molecular
Copy link

Is anyone testing? I'm not savvy enough to do it.

@artemii235
Copy link
Member

@molecular The desktop GUI initial integration should be coming quite soon - you and everyone will be able to test it without digging into the CLI stuff 🙂

@Milerius
Copy link

I finished the last rpc call implementation, after @smk762 confirm the basic tests we can extend the testing to the community!

@artemii235
Copy link
Member

Our internal testing stage is finished, but we also need to complete additional internal security reviews of the #1184 PR. It takes more time than I initially expected - it should be finished in March.
I apologize for the delay and thank everyone for their patience.

@artemii235
Copy link
Member

Hello everyone!
SLP integration is complete, but the release PR (#1184) is still on ongoing security review, which is taking more time than we initially expected. Unfortunately, we can't release this PR until this review is finished, but we are doing our best to complete it as fast as possible.
Thanks everyone for their patience!

@molecular
Copy link

Status?

@artemii235
Copy link
Member

@molecular API PR with SLP was merged and published few months ago. We will finally have a desktop release with SLP support in the coming week or two. Also, SLP will be likely included in the upcoming web version public alpha release.

@smk762
Copy link

smk762 commented Nov 4, 2022

Status?

Can you please recommend where I can trade to get some SLP tokens for testing? Everywhere I look seems to have "Smooth Love Potion", but I'm pretty sure that's not what I need.

@artemii235
Copy link
Member

@molecular @damascene
We have released a new desktop GUI version https://github.com/KomodoPlatform/atomicDEX-Desktop/releases/tag/0.5.7-beta with SLP support.
Please note that it's still beta software, so it's not recommended to store and trade significant amounts.
The list of currently available tokens is mentioned in release notes. If you would like to add more, please feel free to create a PR in coins repo: https://github.com/KomodoPlatform/coins

I can also confirm that SLP tokens will be added to the upcoming web version public alpha. Will post an announcement to this issue once it is released.

@smk762
Copy link

smk762 commented Feb 16, 2023

Closed as completed.

@smk762 smk762 closed this as completed Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

13 participants