Abstract
With the addition of multiple blockchain platforms in the ecosystem, the Dapp owners need to migrate their smart contracts from one platform to another to remain competitive, cost-effective, and secure. A smart contract is a piece of code that contains logic and data. To migrate a smart contract, whether it’s on the same blockchain platform or a different one, we need both its source code that represents the logic and data that indicate the state of the contract. The source code can be easily set up, but to complete the migration, we have to extract the current state of the contract. In this paper, we have developed an advanced state extraction technique that uses static analysis to analyze the smart contract’s call graph and events, and extracts the entire storage state from the storage trie, along with the proper associations across function calls, enabling users to visualize, manage, and transform the state as desired for migration. The soundness of the extracted state was confirmed using the method of abstract interpretation. Further, the migration adapter is designed to transform the extracted state into slot-value pairs and migrate it to the target blockchain. Using our new approach, we were able to completely analyze 14% more smart contracts with the extraction of 53% more data by analyzing function calls and event logs from 67,993 contracts and also migrated some contracts to the multiple popular EVM-compatible blockchains.
Similar content being viewed by others
Explore related subjects
Discover the latest articles, news and stories from top researchers in related subjects.References
Marr, B.: Blockchain: a very short history of ethereum everyone should read (2018). http://surl.li/ojmzu
Bandara, H.D., Xu, X., Weber, I.: Patterns for blockchain data migration. EuroPLoP ’20. Association for computing machinery, NewYork, USA (2020). https://doi.org/10.1145/3424771.3424796
Paik, H.-Y., Xu, X., Bandara, H.M.N.D., Lee, S.U., Lo, S.K.: Analysis of data management in blockchain-based systems: from architecture to governance. IEEE Access 7, 186091–186107 (2019). https://doi.org/10.1109/ACCESS.2019.2961404
Coinbase: COINBASE wallet (2012). https://www.coinbase.com/wallet
Metamask: the crypto wallet for defi, Web3 Dapps and nfts (2016). https://metamask.io/
Wallet, T.: Best cryptocurrency wallet: ethereum wallet: Erc20 wallet (2017). https://trustwallet.com/
Murdock, M.: A deep dive. Avalanche bridge built by Ava Labs. LI.FI Blog (2022). https://blog.li.fi/avalanche-bridge-a-deep-dive-d51d60dda47f
Binance: Binance: Binance Smart Chain: Binance bridge: binance Swap: Binance.org. Binance (2022). https://www.bnbchain.org/en/bridge
Josselinfeist: How contract migration works. Accessed: (2020)-08-12. https://blog.trailofbits.com/2018/10/29/how-contract-migration-works/
Wood, G., Habermeier, R., Czaban, P.: Polkadot: Web3 interoperability: decentralized blockchain (2020). https://polkadot.network/
Kwon, J.: The internet of Blockchains (2019). https://cosmos.network/
Ayub, M., Saleem, T., Janjua, M.U., Ahmad, T.: Storage state analysis and extraction of Ethereum blockchain smart contracts. ACM Trans. Softw. Eng. Methodol. (2022). https://doi.org/10.1145/3548683
Ethereum:history and Forks of ethereum. Ethereum (2021). https://ethereum.org/en/history/
Polygon: \$28b investment firm migrates equity from ethereum to polygon, upgrading speed, liquidity, and compliance. polygon labs (2021). https://bit.ly/44EjdMV
Suisse, B.: Compatible competition - empowering or encroaching on ethereum?: Bitcoin Suisse. Bitcoin Suisse (2021). https://bit.ly/43Au4WQ
Emin Sirer, T.Y., Kevin Sekniqi: Avalanche Chain. Avalanche (2020). https://www.avax.network/
Monarchy, R.: Binance smart contracts (BSC). Binance (2023). https://www.binance.com/en/feed/post/1227710
Jaynti Kanani, S.N.: Polygon Chain. Polygon (2017). https://polygon.technology/developers
Herlihy, M.: Atomic cross-chain swaps. In: Proceedings of the 2018 ACM Symposium on Principles of Distributed Computing. PODC ’18, pp. 245–254. Association for Computing Machinery, New York (2018). https://doi.org/10.1145/3212734.3212736
Wood, G.: Polkadot: vision for a heterogeneous multi-chain framework (2016). https://polkadot.network/polkadotpaper.pdf./
Kwon, J., Buchman, E.: Internet of blockchains (2021). https://v1.cosmos.network/resources/whitepaper
Westerkamp, M., Küpper, A.: Smartsync: Cross-blockchain smart contract interaction and synchronization. In: 2022 IEEE International Conference on Blockchain and Cryptocurrency (ICBC), pp. 1–9 (2022)
Marx, S.: Understanding Ethereum smart contract storage (2018). https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/
Chriseth, Hari, Mathias, Baumann, Tony: Layout of state variables in storage (2021). https://docs.soliditylang.org/en/v0.8.11/internals/layout_in_storage.html
Makers, D.W.: How Ethereum manages transactions (2023). https://coding-bootcamps.com/blog/how-ethereum-manages-transactions.html
Csiro: Token swap (2021). https://research.csiro.au/blockchainpatterns/general-patterns/blockchain-payment-patterns/token-swap/
Cousot, P., Cousot, R.: Abstract interpretation frameworks. J. Logic Comput. (1992). https://doi.org/10.1093/logcom/2.4.511
Nielson, F., Nielson, H.R., Hankin, C.: Data flow analysis 2, 35–139 (1991)
web3py: Introduction (2023). https://web3py.readthedocs.io/
Infura: Ethereum API: Ipfs API amp; gateway: ETH Nodes as a service (2016). https://infura.io/
web3py: Providers (2023). https://web3py.readthedocs.io/en/v5/providers.html
Zheng, P., Zheng, Z., Dai, H.: Xblock-eth: Extracting and exploring blockchain data from ethereum. CoRR abs/1911.00169 (2019) arXiv:1911.00169
Gondek, C.: Polygon vs. Ethereum-what’s the difference. OriginStamp (2023). https://originstamp.com/blog/polygon-vs-ethereum-whats-the-difference/
Academy, B.: BNB smart chain vs. Ethereum: What’s the difference? Binance academy (2023). https://academy.binance.com/en/articles/binance-smart-chain-vs-ethereum-what-s-the-difference
Shuttleworth, D.: Neon: An Ethereum Virtual Machine on Solana (2022). https://consensys.io/blog/neon-an-ethereum-virtual-machine-on-solana
Metamask: The Ethereum address format and why it matters when using metamask (2022). https://bit.ly/3Kc40ua
Funding
This research project was partially funded by the National Center of Cyber Security (NCCS) Pakistan.
Author information
Authors and Affiliations
Contributions
Maha Ayub: (Conceptualization of this study, Methodology, Writing), Waiz Khan: (Results, Implementation), Muhammad Umar Janjua: (Editing, and Review).
Corresponding author
Ethics declarations
Conflict of interest
The Authors do not have any conflict to declare.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Ayub, M., Khan, M.W. & Janjua, M.U. Sound analysis and migration of data from Ethereum smart contracts. Autom Softw Eng 31, 21 (2024). https://doi.org/10.1007/s10515-024-00422-3
Received:
Accepted:
Published:
DOI: https://doi.org/10.1007/s10515-024-00422-3