# How to fetch a contract's current WASM code by address?

**URL:** <https://forum.klever.org/t/how-to-fetch-a-contracts-current-wasm-code-by-address/4501>\
**Category:** Developers\
**Created:** [August 5, 2026, 4:15pm UTC](https://forum.klever.org/t/how-to-fetch-a-contracts-current-wasm-code-by-address/4501 "2026-08-05T16:15:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![janill](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.klever.org/janill/32/187_2.png) [@janill](https://forum.klever.org/u/janill)\
**Post date:** [August 5, 2026, 4:16pm UTC](https://forum.klever.org/t/how-to-fetch-a-contracts-current-wasm-code-by-address/4501/1 "2026-08-05T16:16:00Z")

</div>

Hey everyone!

I’m building a smart contract on Klever and want to let users verify that the deployed bytecode matches the open-source repository. My plan is straightforward: rebuild the contract reproducibly, hash the result, and compare it against what’s actually running on-chain. The problem is the last step. I can’t find a way to read a contract’s current code from its address.

The only approach I’ve found is to look up the transaction history, find the most recent `deployContract` or `upgradeContract` transaction, and pull the bytecode out of its `data` field (which is hex-encoded twice, with the WASM sitting between `@` separators). This works, but it feels like the wrong tool for the job.

Is there a node or API endpoint that returns a contract’s code directly by address?

---

<div class="post-metadata">

**Author:** ![Samuel\_Facanha\_Marti](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.klever.org/samuel_facanha_marti/32/489_2.png) [@Samuel\_Facanha\_Marti](https://forum.klever.org/u/Samuel_Facanha_Marti)\
**Post date:** [August 5, 2026, 7:42pm UTC](https://forum.klever.org/t/how-to-fetch-a-contracts-current-wasm-code-by-address/4501/2 "2026-08-05T19:42:21Z")

</div>

Hello janill!

There is a way of verifying the smart contract source code vs the deployed wasm in kleverscan at the smart contract page:

[https://kleverscan.org/smart-contract/{your\_contract\_address}](https://kleverscan.org/smart-contract/%7Byour_contract_address%7D)

connect the wallet that has deployed it, and you’ll see a “verify contract” tab.

* * *

if you really need to get the current wasm bytes, you can get the latest deploy/upgrade tx hash here:

[https://api.mainnet.klever.org/v1.0/sc/{your\_contract\_address}](https://api.mainnet.klever.org/v1.0/sc/%7Byour_contract_address%7D)

then fetch the transaction at [https://node.mainnet.klever.org/transaction/{deploy/upgrade\_tx\_hash}](https://node.mainnet.klever.org/transaction/%7Bdeploy/upgrade_tx_hash%7D) to get its metadata.

however validating the source code against the chain hash has a lot of underlying steps that might cause a mismatch, so i’d recommend trying the kleverscan way first, and if you have any feedback on it’s usage, let us know!

best regards.

---

<div class="post-metadata">

**Author:** ![janill](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.klever.org/janill/32/187_2.png) [@janill](https://forum.klever.org/u/janill)\
**Post date:** [August 5, 2026, 9:27pm UTC](https://forum.klever.org/t/how-to-fetch-a-contracts-current-wasm-code-by-address/4501/3 "2026-08-05T21:27:33Z")

</div>

Oh, I’ve managed to get it to work on testnet. I’ve never seen anyone using this feature. Thank you
