-
Notifications
You must be signed in to change notification settings - Fork 94
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
Comments
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! |
@artemii235 would like to hear your input on this, is it technically possible? |
@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. |
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. |
These resources could be useful for developers: Rust libraries SLP Rust project More SLP resources: Mint tokens online: |
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. |
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? |
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
We can assume that we're working with valid SLP utxo, I think that we can omit the validation for PoC. |
@EyeOfPython have offered to do it in for $4000. We have successfully added $2000 to the bounty in this Flipstarter https://flipstarter.googol.cash/ |
Hey, I can do it. I'm the author of the above mentioned libraries. |
@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? |
Also, could you provide a link to an Electrum client for Rust? |
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? |
@molecular page is archived now. https://archive.is/O9HXr |
@damascene I see, thanks. Ping me when I should pay. Thanks @EyeOfPython for offering to do this. |
ouch, I was actually working on this past week, almost ready... |
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 ContractNomenclature and (modified) script taken from https://github.com/bitcoin/bips/blob/master/bip-0199.mediawiki. UsageSetupNote: 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.
Fund HTLCFrom the setup above, you should have these values ready:
Also, you should be switched to Buyer's wallet. Now we can fund the HTLC:
Redeem HTLCFrom the fund step above, you should have these values ready:
Timeout HTLCRun the Fund HTLC section again to generate a new HTLC. This will give you these values:
Example:
|
Hi @EyeOfPython, please excuse me for long response, I was offline on weekend.
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.
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! I need some time to check and test the code, will post a comment tomorrow in regards to this, thanks! |
@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? Could you please also provide info on how I can convert the above addresses to the |
I send 10 Fake USD to each of those addresses! Token ID is 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. |
Thanks a lot! Could you please also provide info on how I can convert the addresses to |
@artemii235 you can try https://trest.bitcoin.com/#/slp/convert |
* 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.
* 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.
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 🙂 |
* 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.
#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.
* 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.
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:
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. |
Is anyone testing? I'm not savvy enough to do it. |
@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 🙂 |
I finished the last rpc call implementation, after @smk762 confirm the basic tests we can extend the testing to the community! |
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. |
Hello everyone! |
Status? |
@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. |
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. |
@molecular @damascene 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. |
Closed as completed. |
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.
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.
The text was updated successfully, but these errors were encountered: