5000 NAM sent ![]()
prove it ![]()
(15 characters)
, oh lord. Ah well, he was 50 min earlier when it came to posting here
!
Posting my tx here:
Created disposable keypair with alias disposable-key-BEC126D2A0FA74454B735C917D02282F0CB54E3F-created-at-1751043498
Sending unshielded funds to disposable address tnam1qzlvzfkj5ra8g32twdwfzlgz9qhsed2w8u8kcgdt
Created disposable keypair with alias disposable-key-5217A52A2E0D946FA40C42508BECBB108CB08E7C-created-at-1751043503
converting current asset type to latest asset type…
converting current asset type to latest asset type…
converting current asset type to latest asset type…
Transaction added to mempool.
Transaction hash: C346A5CA5D7ADDD9BF13768011145604BCA5B46DB628CB405BA1BCA90758BF5B
Transaction batch C346A5CA5D7ADDD9BF13768011145604BCA5B46DB628CB405BA1BCA90758BF5B was applied at height 2564160.
Batch results:
Transaction C8E5E45C1B1A371D78855FBFFB34E2384B5AFDE423C4654ACBD253BFEB7B1B6D was successfully applied.
Events:
- tx - ibc/ibc_transfer:
- amount: 1000000000
- denom: tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7
- event-domain: ibc
- memo: {“wasm”:{“contract”:“osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h”,“msg”:{“osmosis_swap”:{“final_memo”:{“namada”:{“osmosis_swap”:{“overflow_receiver”:“tnam1qzlvzfkj5ra8g32twdwfzlgz9qhsed2w8u8kcgdt”,“shielded_amount”:“0”,“shielding_data”:“020000000A27A726A675FFE900000000522227000000000000”}}},“on_failed_delivery”:{“local_recovery_addr”:“redacted”},“output_denom”:“uosmo”,“receiver”:“tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,“route”:[{“pool_id”:“3017”,“token_out_denom”:“factory/osmo1z6r6qdknhgsc0zeracktgpcxf43j6sekq07nw8sxduc9lg0qjjlqfu25e3/alloyed/allBTC”},{“pool_id”:“1995”,“token_out_denom”:“uosmo”}],“slippage”:{“min_output_amount”:“0”}}}}}
- receiver: osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h
- sender: tnam1qqwx7dw4e45jxcmvrauvgy57eefkmxjqwu5mps3c
- tx - ibc/message:
- event-domain: ibc
- module: ibc_channel
- tx - ibc/message:
- event-domain: ibc
- module: transfer
- tx - ibc/send_packet:
- event-domain: ibc
- packet_channel_ordering: ORDER_UNORDERED
- packet_connection: connection-1
- packet_data: {“denom”:“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”,“amount”:“1000000000”,“sender”:“tnam1qqwx7dw4e45jxcmvrauvgy57eefkmxjqwu5mps3c”,“receiver”:“osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h”,“memo”:“{"wasm":{"contract":"osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h","msg":{"osmosis_swap":{"final_memo":{"namada":{"osmosis_swap":{"overflow_receiver":"tnam1qzlvzfkj5ra8g32twdwfzlgz9qhsed2w8u8kcgdt","shielded_amount":"0","shielding_data":"020000000A27A726A675FFE900000000522227000000000000"}}},"on_failed_delivery":{"local_recovery_addr":"osmo18rwcr5pdtz932vdg8j7yvvpe8qqqhw5frrnmmq"},"output_denom":"uosmo","receiver":"tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah","route":[{"pool_id":"3017","token_out_denom":"factory/osmo1z6r6qdknhgsc0zeracktgpcxf43j6sekq07nw8sxduc9lg0qjjlqfu25e3/alloyed/allBTC"},{"pool_id":"1995","token_out_denom":"uosmo"}],"slippage":{"min_output_amount":"0"}}}}}”}
- packet_data_hex: redacted
-
- packet_dst_channel: channel-98451 - packet_dst_port: transfer
- packet_sequence: 1010
- packet_src_channel: channel-1
- packet_src_port: transfer
- packet_timeout_height: 0-0
- packet_timeout_timestamp: 1751047123756008020
- tx - masp/fee-payment:
- indexed-tx: {“block_height”:2564160,“block_index”:0,“batch_index”:0}
- section: {“MaspSection”:[44,27,75,38,150,166,127,68,15,144,120,89,223,227,20,25,12,73,158,210,113,65,184,211,50,5,230,29,247,196,162,123]}
- tx - token/transfer:
- post-balances: [[[“internal-address/tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“26413143305857”],[[“internal-address/tnam1qpfp0ff29cxegmayp3p9pzlvhvggevyw0sfqhdxh”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“100000”]]
- source-accounts: [[[“internal-address/tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“100000”]]
- target-accounts: [[[“internal-address/tnam1qpfp0ff29cxegmayp3p9pzlvhvggevyw0sfqhdxh”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“100000”]]
- token-event-descriptor: transfer-from-wasm
- tx - token/transfer:
- post-balances: [[[“internal-address/tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“26413143405857”],[[“internal-address/tnam1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvtr7x4”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“8164453321436”]]
- source-accounts: [[[“internal-address/tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“1000000000”]]
- target-accounts: [[[“internal-address/tnam1qcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqvtr7x4”,“tnam1q9gr66cvu4hrzm0sd5kmlnjje82gs3xlfg3v6nu7”],“1000000000”]]
- token-event-descriptor: transfer-from-wasm
The batch consumed 69714 gas units.
So um this first tx cost me 1000 nam and due to specifying parameters dumb did not received osmo back. Subsequent tx did received osmo back, lmk if you want those too.
@zenodeapp 5000 NAM sent ![]()
Let me also note for anyone trying this that while source denom is whole unit (1), min-amount is in udenom, so if one does not realize that, one can end up with a lot less funds after the swap. Js I don’t think people should send any big amounts of funds atm. (which I did not.)
confirmed
and congrats ![]()
pls provide znam! will reward anyway (but that’s it, last one!)
ty! (15 chars and all that)
@preto 5000 NAM sent ![]()
@zenodeapp @dismad @preto wanna post any learnings you’ve had? warnings? to anyone following in your footsteps
Warnings
Yes, first a couple important warnings!
--minimum-amount
The --slippage-percentage isn’t implemented yet, so we have to make use of --minimum-amount for now. This however has some caveats!
-
Make sure to set a
--minimum-amountthat roughly matches the amount the Osmosis UI tells you will receive if you do the swap on their platform. I’d even make it a bit less due to potential slippage. The reason why is because you will actually receive this configured amount if the swap succeeds. In that sense this is not the minimum amount you receive, but the actual amount you receive.I’m not sure where the remaining portion goes, but this is already brought to light at the Heliax engineers by Gavin.→ see @preto’s comment. -
Like @preto already stated,
--minimum-amountshould be a udenom (for instance if you want to receive1OSMO, you put1000000as value). -
Don’t set a too high
--minimum-amount.In my test I lost my NAM when I did this. Also something that’s passed along to the devs by Gavin.→ see @preto’s comment.
Example: Shielded Swap NAM to OSMO via CLI
Here’s an example of swapping 100 NAM for 14 OSMO (14000000 uosmo) — this is based on the current price as of writing.
namadac osmosis-swap --source your-shielded-key --token nam --amount 100 --channel-id channel-1 --osmosis-rest-rpc https://lcd.osmosis.zone --output-denom transfer/channel-1/uosmo --local-recovery-addr an-osmo-recovery-addr --swap-contract osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h --target-pa your-payment-addr --minimum-amount 14000000 --gas-token nam --gas-limit 100000
Make sure you have imported a shielded address (e.g.
namadaw derive --shielded --alias your-shielded-key), generated a payment address (namadaw gen-payment-addr --key your-shielded-key --alias your-payment-addr) and shielded sync’d (namadac shielded-sync) before you do this via the CLI.
If you get a gas error, you likely have to up the
--gas-limit(default is50000, I set it to100000).
Namada shielded swap from CLI
This will swap 10 Shielded NAM into ~ 1.1 Shielded OSMO without using the Osmosis frontend
Install binaries
Create wallet
My alias zechub_test is the wallet I setup using:
namadaw gen --shielded --alias $SPENDING_KEY_ALIAS
where in my case $SPENDING_KEY_ALIAS is zechub_test
Sync your keys
note: sync before you send!
namadac shielded-sync --viewing-keys zechub_test --with-indexer https://masp-namada.5elementsnodes.com/api/v1
Shielded Swap
Change local-recovery-addr to your osmo address
Change target-pa to your znam address
You can choose which tokens to use for fees.
note:
use shielded metrics to find possible tokens | --output-denom | --gas-token options
Notice the “Whitelisted Token” sections which also include channel info ![]()
The command
namadac osmosis-swap --source zechub_test --token nam --amount 10 --channel-id channel-1 --osmosis-rest-rpc https://rest.lavenderfive.com:443/osmosis --output-denom transfer/channel-1/uosmo --local-recovery-addr osmo1ksyqwuyx4f8zzgdcaz3jg2aq6mzr02e7kacfqc --swap-contract osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h --minimum-amount 1100000 --target-pa znam1v7ej7nmqngy6h9f0gq5wprk9qwyzlhkw44rq3nyfd4nu72jwufegmk9tjltdahnewezk7m946g9 --gas-limit 200000 --gas-token nam --gas-spending-key zechub_test --node https://namada-rpc.emberstake.xyz
note: Things to notice 
- You must use
---nodeif you are not running a full node yourself. Otherwise you can leave that off - verify units like @zenodeapp suggested!
- replacing
target-patotargetcreates a shielded => unshielded transaction and as such you would use a tnam address - add
--dry-runto estimate gas usage before submission
Example TX:
namada side:
osmosis side:
Suggestion for improvements
- A transaction plan displayed before submission to verify what you typed is what you expect!
- A command that list all available
--nodeRPC’s and--osmosis-rest-rpcREST rpc’s - Much better gas estimation ( gas station website?)
Questions?
let me know!
Perfect! Thank you for such a thorough explanation @dismad ![]()
!
What could be the reason for this error ?
@Gavin @dismad
Dry-run result:
Transaction B6C99CC623ACE977BBD7C90E15BE8932E792E0570A32B46A354A240369F46DE4 was rejected by VPs: [
“tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”
]
Errors: [
[
“tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah”,
“Native VP error: Spend description refers to an invalid anchor”
]
]
I’m not sure, but perhaps make sure you sync right before you try.
Hmm, I had this as well, not sure again where I had this. Perhaps it happened when I used --target instead of --target-pa? For shielded swaps pa (payment address) needs to get used. Does this match your situation?
If you’re okay with it you could sent the CLI command/SDK call you use. And we could perhaps decipher it!
I’ve used below CLI commands
sync
$ namadac shielded-sync --viewing-keys h-nam-shielded
==== Shielded sync started using ledger client ====
fetched : 100%|████████████████████████████████████████████| 11759/11759 [00:00<00:00, 37585.59it/s]
scanned : 100%|██████████████████████████████████████████████████| 154/154 [00:00<00:00, 493.71it/s]
applied : 0it [00:00, ?it/s]
Syncing finished
Balance query:
$ namada client balance --owner h-nam-shielded --token NAM
converting current asset type to latest asset type...
converting current asset type to latest asset type...
nam: 22.1
Shielded Swap (NAM → OSMO)
namada client osmosis-swap --source h-nam-shielded --token nam --amount 10 --channel-id channel-1 --osmosis-rest-rpc https://rest.lavenderfive.com:443/osmosis --output-denom transfer/channel-1/uosmo --swap-contract osmo14q5zmg3fp774kpz2j8c52q7gqjn0dnm3vcj3guqpj4p9xylqpc7s2ezh0h --target-pa h-nam-shielded-pa --minimum-amount 100000 --gas-token nam --gas-limit 100000 --gas-spending-key h-nam-shielded --local-recovery-addr osmo1r9aw0sf9z2wcm3pa47eyt4gz7nxmuuhdd2lm5u
Enter your decryption password for h-nam-shielded:
Created disposable keypair with alias disposable-key-F13F060CD8272185F938178E9ED14C21F684CC2B-created-at-1751377586
Sending unshielded funds to disposable address tnam1qrcn7psvmqnjrp0e8qtca8k3fssldpxv9vd23lgj
Created disposable keypair with alias disposable-key-D77CE805173CF33F639F3993EC56B96B8F58093A-created-at-1751377590
converting current asset type to latest asset type...
converting current asset type to latest asset type...
Error:
0: Encountered error while broadcasting transaction: StringTracer: server error: {"codespace":"","code":9,"data":"","log":"Mempool validation failed: Error trying to apply a transaction: Error while processing transaction's fees: The transparent balance of the fee payer was insufficient to pay fees. The protocol tried to run the first transaction in the batch to pay fees via the MASP but it failed: Some VPs rejected it: [(Internal MASP: tnam1pcqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzmefah, \"Native VP error: Spend description refers to an invalid anchor\")]","hash":"3BA17B50FD2C12D0C15850EBF6A3FE69E89F157D088FD19E476891DEB8F0025C"}
Did try shielded sync multiple times getting same issue every time and change CLI command with different flags but same issue is repeating
Hmm, strange, command doesn’t seem off.
You tried to invalidate your shielded context before shielded-syncing by removing the shielded.dat and shielded_sync.cache in the namada chain folder?
Also I’m not sure how old this account is, but if it had a shielded balance before we migrated masp events, you may need to shielded sync against an indexer of tududes or emberstake (by using the with-indexer flag). One you’re certain of having those masp events converted.
But first, if you haven’t already tried, I’d attempt to invalidate the shielded context first and maybe up the gas limit, but I doubt that’s the issue.
Oh btw, does it work if you omit the gas-spending-key?
yes, I’ve removed shielded.dat & cache and did sync again with and without masp indexer
this shielded account is derived form one of my genesis account
same issue even if I omit gas-spending-key
Thank you for looking into it, I’ll try with a newly created account once and see
