DCSCY: DRL-Based Cross-Shard Smart Contract Yanking in a Blockchain Sharding Framework
Abstract
1. Introduction
- DCSCY is proposed, making this the first study to apply DRL techniques to optimizing the yanking trajectory of smart contracts in sharded blockchain frameworks. By leveraging DRL, DCSCY dynamically learns and predicts the optimal sequence for contract relocations, improving the execution efficiency.
- The DCSCY framework effectively balances three critical factors: the number of processed smart contracts, the waiting time for nodes requiring contract execution, and the communication cost associated with yanking.
- The experimental results show that DCSCY improves the performance by more than 95% compared to that of order-based and random-based yanking methods. These results highlight the effectiveness of DCSCY in enhancing smart contract execution efficiency and reducing system congestion in sharded blockchain environments.
2. Related Work
2.1. Cross-Shard Smart Contract Transactions in the Sharded Blockchain
2.2. Smart Contracts from Locking to Yanking
2.3. The DRL-Based Sharded Blockchain
3. The System Model: Yanking Smart Contract Calling Based on DRL
3.1. The System Overview
3.2. Workflow Overview
- Step-1.
- Update the calling list and waiting time. The first step in the framework is initializing with the smart contract deployed to a shard based on a calling request. The smart contract calling request and waiting times are updated for all shards in each episode (every blocks), where the calling list and the waiting time for each shard are refreshed based on the latest transaction data collected during this interval.
- Step-2.
- Train the model with the DRL algorithm. Acting as the agent, the YC trains the model using the collected data to evaluate the current state. This involves utilizing the DRL-based model to simulate smart contract yanking decisions and output the optimal shard placement for the smart contract.
- Step-3.
- Determine whether to yank the smart contract. The YC iteratively calculates rewards over multiple epochs to determine the optimal action. Based on the training results and DRL model predictions, it calculates the rewards for each action and decides whether to yank the smart contract to a new shard.
- Step-4.
- The yanking operation. The smart contract is yanked to the new shard, as determined by the DRL agent. This executes the yanking operation to relocate the smart contract to the optimal shard and completes related transactions.
3.3. System Assumptions
4. The DRL Framework
Algorithm 1: DQN-based yanking algorithm |
4.1. Optimizations, Rewards, and DRL
4.2. The DRL-Based Sharding Optimization Model
5. Experiments and Evaluation
5.1. The Experimental Framework
5.2. The Experimental Results
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Zheng, Z.; Xie, S.; Dai, H.N.; Chen, X.; Wang, H. Blockchain challenges and opportunities: A survey. Int. J. Web Grid Serv. 2018, 14, 352–375. [Google Scholar] [CrossRef]
- Kayikci, S.; Khoshgoftaar, T.M. Blockchain meets machine learning: A survey. J. Big Data 2024, 11, 9. [Google Scholar] [CrossRef]
- Guo, H.; Yu, X. A survey on blockchain technology and its security. Blockchain Res. Appl. 2022, 3, 100067. [Google Scholar] [CrossRef]
- Soltani, P.; Ashtiani, F. Analytical Modeling and Throughput Computation of Blockchain Sharding. IEEE Trans. Parallel Distrib. Syst. 2024, 35, 983–997. [Google Scholar] [CrossRef]
- Kruglik, S.; Nazirkhanova, K.; Yanovich, Y. Challenges beyond blockchain: Scaling, oracles and privacy preserving. In Proceedings of the 2019 XVI International Symposium “Problems of Redundancy in Information and Control Systems” (REDUNDANCY), Moscow, Russia, 21–25 October 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 155–158. [Google Scholar]
- Nakamoto, S. Bitcoin: A Peer-to-Peer Electronic Cash System. Decentralized Business Review, 2008, p. 21260. Available online: https://assets.pubpub.org/d8wct41f/31611263538139.pdf (accessed on 8 July 2025).
- Buterin, V. Ethereum white paper. GitHub Repos. 2013, 1, 16–23. [Google Scholar]
- Buterin, V. A next-generation smart contract and decentralized application platform. White Pap. 2014, 3, 2-1. [Google Scholar]
- Jiang, E.; Qin, B.; Wang, Q.; Wang, Z.; Wu, Q.; Weng, J.; Li, X.; Wang, C.; Ding, Y.; Zhang, Y. Decentralized finance (DeFi): A survey. arXiv 2023, arXiv:2308.05282. [Google Scholar] [CrossRef]
- Mohammed Abdul, S.S.; Shrestha, A.; Yong, J. Toward the Mass Adoption of Blockchain: Cross-Industry Insights from DeFi, Gaming, and Data Analytics. Big Data Cogn. Comput. 2025, 9, 178. [Google Scholar] [CrossRef]
- Wang, X.; Yu, G.; Liu, R.P.; Zhang, J.; Wu, Q.; Su, S.W.; He, Y.; Zhang, Z.; Yu, L.; Liu, T.; et al. Blockchain-enabled fish provenance and quality tracking system. IEEE Internet Things J. 2021, 9, 8130–8142. [Google Scholar] [CrossRef]
- Wang, H.; Wang, T.; Shi, L.; Liu, N.; Zhang, S. A blockchain-empowered framework for decentralized trust management in Internet of Battlefield Things. Comput. Netw. 2023, 237, 110048. [Google Scholar] [CrossRef]
- Gadiraju, D.S.; Aggarwal, V. Prism blockchain enabled Internet of Things with deep reinforcement learning. Blockchain Res. Appl. 2024, 5, 100205. [Google Scholar] [CrossRef]
- Yu, G.; Wang, X.; Yu, K.; Ni, W.; Zhang, J.A.; Liu, R.P. Scaling-out blockchains with sharding: An extensive survey. In Blockchains for Network Security: Principles, Technologies and Applications; Institution of Engineering and Technology: London, UK, 2020. [Google Scholar]
- Zhang, Z.; Yu, G.; Sun, C.; Wang, X.; Wang, Y.; Zhang, M.; Ni, W.; Liu, R.P.; Reeves, A.; Georgalas, N. TbDd: A new trust-based, DRL-driven framework for blockchain sharding in IoT. Comput. Netw. 2024, 244, 110343. [Google Scholar] [CrossRef]
- Liu, Y.; Liu, J.; Salles, M.A.V.; Zhang, Z.; Li, T.; Hu, B.; Henglein, F.; Lu, R. Building blocks of sharding blockchain systems: Concepts, approaches, and open problems. Comput. Sci. Rev. 2022, 46, 100513. [Google Scholar] [CrossRef]
- Dang, H.; Dinh, T.T.A.; Loghin, D.; Chang, E.C.; Lin, Q.; Ooi, B.C. Towards scaling blockchain systems via sharding. In Proceedings of the 2019 International Conference on Management of Data, Amsterdam, The Netherlands, 30 June–5 July 2019; pp. 123–140. [Google Scholar]
- Huang, H.; Lin, Y.; Zheng, Z. Account Migration across Blockchain Shards using Fine-tuned Lock Mechanism. In Proceedings of the IEEE INFOCOM 2024-IEEE Conference on Computer Communications, Vancouver, BC, Canada, 20–23 May 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 271–280. [Google Scholar]
- Wang, G.; Shi, Z.J.; Nixon, M.; Han, S. Sok: Sharding on blockchain. In Proceedings of the 1st ACM Conference on Advances in Financial Technologies, Zurich, Switzerland, 21–23 October 2019; pp. 41–61. [Google Scholar]
- Buterin, V. Cross-Shard Contract Yanking. 2018. Available online: https://ethresear.ch/t/cross-shard-contract-yanking/1450 (accessed on 3 January 2025).
- Buterin, V. Phase 2 Pre-Spec: Cross-Shard Mechanics. 2019. Available online: https://ethresear.ch/t/phase-2-pre-spec-cross-shard-mechanics/4970 (accessed on 3 January 2025).
- Robinson, P.; Ramesh, R.; Johnson, S. Atomic crosschain transactions for ethereum private sidechains. Blockchain Res. Appl. 2022, 3, 100030. [Google Scholar] [CrossRef]
- Kokoris-Kogias, E.; Jovanovic, P.; Gasser, L.; Gailly, N.; Syta, E.; Ford, B. Omniledger: A secure, scale-out, decentralized ledger via sharding. In Proceedings of the 2018 IEEE Symposium on Security and Privacy (SP), San Francisco, CA, USA, 21–23 May 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 583–598. [Google Scholar]
- Al-Bassam, M.; Sonnino, A.; Bano, S.; Hrycyszyn, D.; Danezis, G. Chainspace: A sharded smart contracts platform. arXiv 2017, arXiv:1708.03778. [Google Scholar] [CrossRef]
- Zhang, Z.; Yin, H.; Wang, Y.; Yu, G.; Wang, X.; Ni, W.; Liu, R.P. Enabling Efficient Cross-Shard Smart Contract Calling via Overlapping. In Proceedings of the International Conference on Provable Security, Gold Coast, Australia, 25–27 September 2024; Springer: Berlin/Heidelberg, Germany, 2024; pp. 164–178. [Google Scholar]
- Li, M.; Lin, Y.; Zhang, J.; Wang, W. Jenga: Orchestrating smart contracts in sharding-based blockchain for efficient processing. In Proceedings of the 2022 IEEE 42nd International Conference on Distributed Computing Systems (ICDCS), Bologna, Italy, 10–13 July 2022; IEEE: Piscataway, NJ, USA, 2022; pp. 133–143. [Google Scholar]
- Qi, X.; Li, Y. LightCross: Sharding with Lightweight Cross-Shard Execution for Smart Contracts. In Proceedings of the IEEE INFOCOM 2024-IEEE Conference on Computer Communications, Vancouver, BC, Canada, 20–23 May 2024; IEEE: Piscataway, NJ, USA, 2024; pp. 1681–1690. [Google Scholar]
- Liang, J.; Yao, P.; Chen, W.; Hong, Z.; Zhang, J.; Cai, T.; Sun, M.; Zheng, Z. SPARROW: Expediting Smart Contract Execution for Blockchain Sharding via Inter-shard Caching. In IEEE Transactions on Parallel and Distributed Systems; IEEE: Piscataway, NJ, USA, 2024. [Google Scholar]
- Wels, S. Guaranteed-TX: The Exploration of a Guaranteed Cross-Shard Transaction Execution Protocol for Ethereum 2.0. Master’s Thesis, University of Twente, Enschede, The Netherlands, 2019. [Google Scholar]
- Al Bassam, M. Securely Scaling Blockchain Base Layers. Ph.D. Thesis, University College London, London, UK, 2020. [Google Scholar]
- Zamani, M.; Movahedi, M.; Raykova, M. Rapidchain: Scaling blockchain via full sharding. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security, Toronto, ON, Canada, 15–19 October 2018; pp. 931–948. [Google Scholar]
- Yu, G.; Wang, X.; Ni, W.; Lu, Q.; Xu, X.; Liu, R.P.; Zhu, L. Adaptive resource scheduling in permissionless sharded-blockchains: A decentralized multiagent deep reinforcement learning approach. IEEE Trans. Syst. Man Cybern. Syst. 2023, 53, 7256–7268. [Google Scholar] [CrossRef]
- Yang, X.; Xu, T.; Zan, F.; Ye, T.; Mao, Z.; Qiu, T. An Overlapping Self-Organizing Sharding Scheme Based on DRL for Large-Scale IIoT Blockchain. IEEE Internet Things J. 2023, 11, 5681–5695. [Google Scholar] [CrossRef]
- Li, P.; Song, M.; Xing, M.; Xiao, Z.; Ding, Q.; Guan, S.; Long, J. SPRING: Improving the Throughput of Sharding Blockchain via Deep Reinforcement Learning Based State Placement. In Proceedings of the ACM on Web Conference 2024, Singapore, 13–17 May 2024; pp. 2836–2846. [Google Scholar]
- Mnih, V.; Kavukcuoglu, K.; Silver, D.; Rusu, A.A.; Veness, J.; Bellemare, M.G.; Graves, A.; Riedmiller, M.; Fidjeland, A.K.; Ostrovski, G.; et al. Human-level control through deep reinforcement learning. Nature 2015, 518, 529–533. [Google Scholar] [CrossRef] [PubMed]
- Schulman, J.; Wolski, F.; Dhariwal, P.; Radford, A.; Klimov, O. Proximal policy optimization algorithms. arXiv 2017, arXiv:1707.06347. [Google Scholar] [CrossRef]
- Etherscan. Etherscan: Ethereum Blockchain Explorer. Available online: https://etherscan.io/ (accessed on 20 February 2025).
- Naik, A.; Wan, Y.; Tomar, M.; Sutton, R.S. Reward Centering. arXiv 2024, arXiv:2405.09999. [Google Scholar] [CrossRef]
Feature | Locking [17,18,19] | Yanking [20,21] |
---|---|---|
Holds contract in one shard, preventing access by others | Immediate-execution contract relocation to target shard | |
Contract-level | Function-level | |
Higher, due to synchronization delays across shards | Lower, as it avoids long multi-block synchronization | |
Higher due to cross-shard locks | Reduces inter-shard communication complexity | |
Maintains consistency with locks | Ensures consistency through real-time relocation | |
Critical-consistency low-frequency cross-shard interactions | High-frequency rapid cross-shard processing |
Notation | Description |
---|---|
N | Number of nodes in the network |
K | Number of shards in the network |
Fixed episode for state update | |
Smart contract calling requests by -th node in k-th shard during the episode | |
Total smart contract calling requests by k-th shard during episode | |
Waiting time for -th node in k-th shard to call smart contract during episode | |
Cumulative waiting time of k-th shard to call smart contract during episode | |
Historical trajectory of smart contract yanking | |
Predicted trajectory of smart contract yanking | |
Yanking cost, including the yanking operation (adding, deleting, and communication) | |
Constant value for each yanking operation |
Notation | Description | Value |
---|---|---|
The node number of each shard | [5, 20] | |
K | The total shard number | [3, 7] |
Hop number for predicting the trajectory of smart contract yanking | [1, 4] | |
The proposed block in the fix episode | 5 | |
Max requests processed by the k-th shard during the -th episode | 50 | |
Max transactions generated by the k-th shard during the -th episode | 50 | |
e | The epoch number | 50 |
The weight of | ||
The weight of | ||
The weight of |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Wang, Y.; Zhang, Z.; Yin, H.; Yu, G.; Wang, X.; Sun, C.; Ni, W.; Liu, R.P.; Cheng, Z. DCSCY: DRL-Based Cross-Shard Smart Contract Yanking in a Blockchain Sharding Framework. Electronics 2025, 14, 3254. https://doi.org/10.3390/electronics14163254
Wang Y, Zhang Z, Yin H, Yu G, Wang X, Sun C, Ni W, Liu RP, Cheng Z. DCSCY: DRL-Based Cross-Shard Smart Contract Yanking in a Blockchain Sharding Framework. Electronics. 2025; 14(16):3254. https://doi.org/10.3390/electronics14163254
Chicago/Turabian StyleWang, Ying, Zixu Zhang, Hongbo Yin, Guangsheng Yu, Xu Wang, Caijun Sun, Wei Ni, Ren Ping Liu, and Zhiqun Cheng. 2025. "DCSCY: DRL-Based Cross-Shard Smart Contract Yanking in a Blockchain Sharding Framework" Electronics 14, no. 16: 3254. https://doi.org/10.3390/electronics14163254
APA StyleWang, Y., Zhang, Z., Yin, H., Yu, G., Wang, X., Sun, C., Ni, W., Liu, R. P., & Cheng, Z. (2025). DCSCY: DRL-Based Cross-Shard Smart Contract Yanking in a Blockchain Sharding Framework. Electronics, 14(16), 3254. https://doi.org/10.3390/electronics14163254