Smart contracts are critical to blockchain but face significant security challenges, where potential vulnerabilities can lead to financial losses and undermine system trustworthiness. Code obfuscation has emerged as a crucial technique for countering reverse engineering and enhancing contract security. However, existing methods suffer from three major limitations: (1) current bytecode obfuscation methods are primarily designed for traditional programming languages and cannot be directly applied to Solidity; (2) these methods exhibit limited resistance against advanced decompilation tools; and (3) they often result in high gas consumption. To this end, we propose BOSC , a novel bytecode obfuscation method that integrates four obfuscation strategies from both structural and semantic perspectives to enhance obfuscation effectiveness. Specifically, in structural perturbation, we adopt and refine incomplete instruction obfuscation and false branch obfuscation, while in semantic perturbation, we improve and employ instruction reordering obfuscation and flower instruction obfuscation. Experimental results demonstrate that BOSC significantly increases the decompilation failure rate from 6.06% to 96.4%, and raises cyclomatic complexity by 81.83%, providing robust protection against automated attacks. This improvement incurs only a modest additional gas cost of 1,792 gwei , which translates to an approximate expense of 0.33869 USD , thereby achieving a balance between obfuscation effectiveness and economic efficiency.
Zhang et al. (Fri,) studied this question.