Hey recently i ran through such transaction https://solscan.io/tx/R2uium8xqH614P29yccRSpE7HQwEqWLANGZmLq6aC21gAxBcU3wi1jz7XuFoVpXEKBxxxbuoDQjjRZTCLLpQaSK and im wondering how did they manage to create a program that shows "Unknown: Unknown" as instruction and basically hides the amount on solscan? I would like to try creating something like that as well, but im not sure where do i even start.
1 Answer
They are most likely using their own deployed program and directly changing the lamports probably like so:
**ctx
.accounts
.chest_vault
.to_account_info()
.try_borrow_mut_lamports()? -= CHEST_REWARD;
**ctx
.accounts
.player
.to_account_info()
.try_borrow_mut_lamports()? += CHEST_REWARD;
Here is an example to try yourself: https://beta.solpg.io/tutorials/tiny-adventure-two You can build and deploy it in the browser.
It does not really hide anything well though and only works for native sol. You can see the change here: https://explorer.solana.com/tx/R2uium8xqH614P29yccRSpE7HQwEqWLANGZmLq6aC21gAxBcU3wi1jz7XuFoVpXEKBxxxbuoDQjjRZTCLLpQaSK and most wallets also show it and it only works when you substract from an account that is owned by the program.
If you really want to hide amount of tokens check out the Confidential Transfers token extension that is coming with version 1.18: Confidential Transfers https://spl.solana.com/confidential-token/quickstart