
Togzhan Barakbayeva
PhD Candidate, Computer Science and Engineering
Hong Kong University of Science and TechnologyI'm a PhD candidate in the Computer Science and Engineering department at the Hong Kong University of Science and Technology (HKUST). My research is supervised by Prof. Amir Goharshady and I'm proudly part of the ALPACAS research group. I'm also fortunate to be co-supervised by Prof. Dimitris Papadopoulos.
My research focuses on developing secure, efficient and trustless protocols, and solving optimization problems within blockchain systems. During my PhD, I've worked on a wide range of interesting projects, and my most favorite ones were about optimizing miner revenue. In my work, I combine ideas from applied cryptography, algorithms, software engineering, and game theory.
My background in academia and industry has provided me with a strong foundation to work on challenging tasks in blockchain.
Publications
PhD research
LockFee: Refundable Transaction Admission via Time-Locked Collateral
J. Ballweg, Togzhan Barakbayeva, Zhuo Cai, Amir Kafshdar Goharshady
IEEE International Conference on Decentralized Applications and Infrastructures, DAPPS 2026 (a.r. 12.28%)
Abstract
Irreversible transaction fees create a persistent revenue flow from users to validators. This protocol-defined base-admission revenue channel contributes to centralization driven by maximal extractable value (MEV), specialized builder markets, and economies of scale in block production. We study LockFee, a principal-preserving primitive in which each admitted transaction locks collateral for a fixed duration and later receives the nominal principal back in full; users still bear the opportunity cost of locked capital, along with any risk on the locked asset itself. Under a simplified equal-size-transaction model, we prove that sustaining full occupation of all admission slots at throughput q with lock amount L and lock duration D requires capital on the order of qLD. A baseline protocol pairs the admission rule with inflation-funded validator rewards, achieving validator participation and self-spam resistance without base-admission fees flowing from users to validators. The result removes the protocol-defined fee-revenue channel from ordinary admission. As a downstream implication, LockFee screens users by heterogeneous opportunity cost of capital rather than by a uniform irreversible payment.
Boosting Gas Revenues of Ethereum Miners
Togzhan Barakbayeva, Soroush Farokhnia, Amir Kafshdar Goharshady, Sergei Novozhilov
IEEE/ACM International Conference on Software Engineering, ICSE 2026 (a.r. 19.77%)
Abstract
In cryptocurrency networks, transaction-fee revenue serves as the primary financial incentive for miners to participate in the consensus mechanism, securing the network by validating transactions and extending the blockchain. Maximizing this revenue is therefore a key optimization problem for miners. While this has been studied for UTXO blockchains like Bitcoin, where transaction fees are fixed, we focus on Ethereum, where the challenge is significantly greater. On Ethereum, the fee paid by a transaction depends on its execution cost (gas), which can change based on the ordering of preceding transactions in a block. This creates a combinatorial explosion, as miners must select not only a subset of transactions but also their optimal permutation to maximize revenue.
In this work, we present a randomized framework to address this problem. Our approach first uses randomized testing, executing sample permutations of pending transactions to profile their gas usage. From this data, we employ decision trees to learn transaction interdependencies, identifying a small "neighborhood" of transactions that influence each other's execution costs. These dependencies are then encoded as a set of logical rules that predict gas usage based on local transaction ordering. Finally, we translate these rules and other constraints (e.g., block gas limit, nonce ordering) into an integer linear programming (ILP) instance, which we solve to find a block composition that maximizes total tip revenue. Our experimental results demonstrate significant gains: our method outperforms real-world Ethereum miners by an average of 73.45 percent per block, which corresponds to roughly 63 million USD per annum.
Smart Contracts for Trustless Sampling of Correlated Equilibria
Togzhan Barakbayeva, Zhuo Cai, Amir Kafshdar Goharshady, K. Keypoor
34th International Joint Conference on Artificial Intelligence, IJCAI 2025 (a.r. 19.3%)
Abstract
Correlated equilibria are a standard solution concept in game theory and generalize Nash equilibria. In a 2-player non-cooperative game in which player i has action set Aᵢ, a correlated equilibrium is a self-enforcing probability distribution σ over A₁ × A₂. Specifically, when a strategy profile (s₁, s₂) ∈ A₁ × A₂ is sampled according to σ, each player i can observe their own component sᵢ, but not the other player's component. Knowing sᵢ and σ, player i cannot increase their expected payoff by defecting and playing a strategy s'ᵢ ≠ sᵢ. Correlated equilibria are ubiquitous and crucial in mechanism design, including in the design of blockchain-based protocols which aim to incentivize honest behavior.
A correlated equilibrium depends on a centralized and impartial oracle, often called the "external signal" in game theory literature, to sample a strategy profile and disclose each player's component to them, while keeping the other player's component secret. However, there is currently no trustless method to achieve this on the blockchain without centralization or relying on trusted third parties.
In this work, we address this challenge and provide two novel protocols, one based on oblivious transfer and the other based on zkSNARKs, to replace the public signal with a smart contract. We prove that our approaches are secure and provide the desired privacy properties of a correlated equilibrium, while also being efficient in terms of gas usage and thus affordable in practice.
Improved Gas Optimization of Smart Contracts
Togzhan Barakbayeva, Soroush Farokhnia, Amir Kafshdar Goharshady, Peiyu Li, Zhuo Lin
International Conference on Fundamentals of Software Engineering, FSEN 2025
Abstract
Smart contracts are programs executed on top of a blockchain consensus protocol. Their compiled code (bytecode) is stored on the blockchain and is immutable after deployment. They are self-enforcing in the sense that any function call to a smart contract is executed by all nodes on the network, ensuring that they all reach consensus about the final state of the contract. To prevent denial-of-service attacks, such an execution is costly by design. A "gas" cost is assigned to each bytecode operation, roughly proportional to the resources required to execute it, and any user who initiates a function call to a smart contract has to pay the total gas cost of the resulting execution. On Ethereum alone, the users pay an astounding gas cost of more than 4 billion USD/year.
Smart contracts are often written in high-level programming languages such as Solidity and then compiled to bytecode before being deployed on the blockchain. Thus, a natural compiler optimization problem arising in this context is to produce efficient bytecode that minimizes the total gas usage. A leading approach in this direction is superoptimization, which considers every basic block of the smart contract separately and tries to rewrite it as an equivalent block that uses as little gas as possible. The current state-of-the-art tool is syrup 2.0, which encodes gas superoptimization as Max-SMT and then relies on SMT-solvers to synthesize an equivalent contract with optimized gas usage.
In this work, we make two observations: First, the performance of Max-SMT declines significantly as block sizes increase. Thus, although syrup is able to find an optimal rewriting for a small block with a dozen bytecode operations, its output on blocks with hundreds or thousands of operations, when given any realistic timeout, is far from optimal. Second, optimizations that can be applied to basic blocks are often local and compositional, i.e. they rewrite several small and disjoint parts of the block. Such locality is lost to Max-SMT solvers, mainly because it is unpredictable and there are no clear ways on how one should cut blocks of bytecode into smaller sub-blocks. To ameliorate these issues, we present a simple dynamic programming algorithm that tries every possible division of a block into sub-blocks, recursively calling syrup as a black box on each sub-block. Surprisingly, this simple idea leads to highly significant improvements in the gas usage, more than doubling the savings obtained by syrup, and reducing the gas usage of real-world smart contracts by 11.23 percent.
Pixiu: Optimal Block Production Revenues on Cardano
Togzhan Barakbayeva, Soroush Farokhnia, Amir Kafshdar Goharshady, Michael Gufler, Sergei Novozhilov
IEEE International Conference on Blockchain, Blockchain 2024 (a.r. 18.89%)
Abstract
Cardano is a blockchain protocol based on proof-of-stake and an extended UTXO model which also supports arbitrary smart contracts. Its primary currency, Ada, is currently one of the global top ten cryptocurrencies with a market cap of more than 16 billion USD. In Cardano, new blocks are produced by stake pools. Any holder of Ada can delegate their stake to a pool. The underlying proof-of-stake consensus protocol is Ouroboros Praos, which divides time into a number of epochs and each epoch into a number of slots, each corresponding to one second. In each slot, leaders are randomly selected to produce and add new blocks to the blockchain, with their selection probability being proportional to their stake. Each block can contain a sequence of transactions and block production is rewarded in two ways: (i) transaction fees and (ii) monetary expansion. The producers have no control over (ii), but can optimize (i) by choosing which transactions to include in their blocks. Thus, they are incentivized to maximize the total transaction fees.
In this work, we consider the natural optimization problem of forming a block with maximum transaction fees given a set of unmined Cardano transactions. We show that by exploiting the sparsity of interrelations between transactions, i.e. the small treedepth of dependency-conflict graphs, it is possible to obtain a polynomial-time algorithm that outputs optimal blocks. We implemented our algorithm in a free and open-source tool called Pixiu. Using Pixiu, we provide extensive experimental results over real-world transaction data on the Cardano blockchain demonstrating that our approach increases the block producers' revenue by almost 1,357.82 USD/day = 495,604.3 USD/year.
Gas-Efficient Decentralized Random Beacons
Vasiht P. Abidha, Togzhan Barakbayeva, Zhuo Cai, Amir Kafshdar Goharshady
IEEE International Conference on Blockchain and Cryptocurrency, ICBC 2024 (a.r. 19.34%)
Abstract
Decentralized random number generation is a widely-studied problem in the blockchain community and much attention has been paid to the so-called on-chain random beacons, i.e. smart contracts that generate randomness which can in turn be used in other contracts. Following the classical methodology of RANDAO, most on-chain beacons receive inputs from a large number n of participants and then aggregate them to compute a final random output. The aggregation is done in a manner that ensures the final output is uniformly random as long as at least one of the participants acts honestly. While being highly successful in providing security guarantees such as unpredictability and tamper-resistance, a major downside of these beacons is their cost. Since every participant has to call a function in the smart contract to provide their input, the total gas usage to generate a single random number is at least Ω(n).
In this work, we propose a novel protocol that offloads most of the on-chain communication between the participants and the smart contract to an alternative off-chain communication with a dealer. This leads to a gas-efficient on-chain random beacon with only O(1) gas usage per generated output. Crucially, our protocol is trustless and the dealer is unable to predict or tamper with the result. We maintain the same security guarantees as previous on-chain beacons, while significantly reducing the gas usage. We also show that our protocol is secure even if all but one of the participants, potentially including the dealer, are dishonest.
SRNG: An Efficient Decentralized Approach for Secret Random Number Generation
Togzhan Barakbayeva, Zhuo Cai, Amir Kafshdar Goharshady
IEEE International Conference on Blockchain and Cryptocurrency, ICBC 2024 (a.r. 19.34%)
Abstract
Many blockchain protocols and applications require access to a reliable source of distributed random numbers. This has led to the recent interest in the study of distributed random number generation (RNG) and randomness beacons. Numerous approaches have been proposed in the literature, using different cryptographic techniques and working under different assumptions. A problem that has recently been studied is that of generating secret random numbers. There is a natural use-case for this. Suppose a casino CASSIE wishes to offer its gambling games as a smart contract. It is not viable to generate a fresh distributed random number for each bet. Instead, a secret random number should be generated at predefined intervals, e.g. each day, and used as a seed to create the randomness for the whole day. This seed should only be known to CASSIE. Moreover, at the end of the day, CASSIE should be able to disclose the seed and prove that there was no tampering.
In this work, we propose a simple and novel distributed random beacon protocol that generates distributed random numbers while preserving secrecy. The generated random number can be used in DeFi applications, such as decentralized casinos, for some time, until it is published along with proof that it is indeed the output of our random beacon. In addition to achieving the desired secrecy property, our approach is also efficient and requires the same amount of computation and communication as non-secret random beacons. Our protocol can easily be implemented as a smart contract.
Pre-PhD research
Fully Automatic CNN Design with Inception Blocks
Togzhan Barakbayeva, M. Fatih Demirci
International Conference on Digital Image Processing (ICDIP 2021)
Abstract
Convolutional Neural Networks (CNNs) are widely used in image classification tasks and have demonstrated promising classification accuracy results. Designing a CNN architecture requires a manual adjustment of parameters through a series of experiments as well as sufficient knowledge both in the problem domain and CNN architecture design. Therefore, it is extremely difficult for users without prior experience to design a promising CNN for their purposes. To solve this issue, various solutions on the automatic construction of CNN architectures are proposed, including but not limited to a genetic algorithm AE-CNN for automatically evolving CNN design using ResNet and DenseNet blocks. In this paper, a significant improvement of the afore-mentioned solution by the addition of Inception blocks is introduced. Performance of the algorithm is assessed on the CINIC-10 benchmark dataset without and with the usage of Inception blocks. As it can be observed from the outcome of the experiment, the addition of Inception blocks positively affects the final classification accuracy. The proposed algorithm does not only improve the current solution but also keeps the advantages of automatic CNN without requesting any manual interventions.
Fully Automatic CNN Design with Inception and ResNet Blocks
Togzhan Barakbayeva, M. Fatih Demirci
Neural Computing and Applications (NCAA 2022)
Abstract
Although convolutional neural networks (CNNs) are widely used in image classification tasks and have demonstrated promising classification accuracy results, designing a CNN architecture requires a manual adjustment of parameters through a series of experiments as well as sufficient knowledge both in the problem domain and CNN architecture design. Therefore, it is difficult for users without prior experience to design a CNN for specific purposes. In this paper, we propose a framework for the automatic construction of CNN architectures based on ResNet, DenseNet, and Inception blocks and the roulette wheel selection method with a dynamic learning rate. Compared with the state of the art, the proposed approach has a significant improvement in the domain of image classification. Experimental evaluation of our approach including a comparison with the previous works on three benchmark datasets demonstrates the effectiveness of the overall method. The proposed algorithm not only improves the previous algorithm but also keeps the advantages of automatic CNN construction without requiring manual interventions.
CV
Education

Hong Kong University of Science and Technology
Sep 2022 – Present
Doctor of Philosophy in Computer Science and Engineering · Hong Kong
- Became a member of a group supervised by Amir Goharshady through an interview process with a success rate of 1.7%.
- Awarded a Hong Kong PhD Fellowship Scheme (HKPFS) scholarship with funding of US$184,100.

Nazarbayev University
Aug 2018 – Jun 2022
Bachelor of Science in Computer Science, Minor in Math · Kazakhstan
- Graduated with "Cum Laude" honours with cGPA 3.74/4.00.
- Placed 9th out of 138 students in the Computer Science class of 2022 (top 7% of class).
Experience

Visiting Scholar · University of Oxford, St Catherine's College
May 2026
Oxford, United Kingdom

Research Intern · Nethermind
Jun 2024 – Aug 2024
London, United Kingdom (remote)
- Performed experimental evaluations of Nova and Mova folding schemes.
- Explored BLS signature schemes and protocols with private senders.

Research Assistant · Nazarbayev University
Jan 2021 – Jan 2022
Astana, Kazakhstan
- Implemented the addition of Inception blocks into the evolutionary algorithm AE-CNN for image classification tasks. Skills: Python, TensorFlow, CNNs.

Software Engineering Intern · GroveFlow
Jun 2020 – Aug 2020
San Francisco, USA (remote)
- Integrated the COVID dashboard backend for displaying trends and growth rates at the county and state levels, and performed CSV parsing and data processing. Dashboard reached 100,000+ views. Skills: Node.js.
- Developed the frontend of a web-chart generation application that creates graphs based on user input. Skills: React, Node.js.

Summer Intern · Ethereum Foundation
Jun 2020 – Oct 2020
Remote
- Developed a staking application to deposit and withdraw funds on the Ethereum blockchain as part of the open-source scaffold-eth project. Wrote a full tutorial on setting up the smart contract and interacting with the frontend. Skills: Solidity, React, web3.
- Implemented an input component to convert between bytes32 and string.
- Implemented a commitment scheme and added a frontend for the application.
- Developed a collectors leaderboard page and recent color history page for nifty.ink. Skills: Solidity, React, web3.
Software Engineering Intern · Method Pro
Jun 2019 – Aug 2019
Almaty, Kazakhstan
- Developed a full-stack admin app to display data statistics, integrating data science approaches. Skills: Python.
- Implemented an algorithm for text processing of comments — removing stopwords and punctuation, performing lemmatization — and extracted relevant nouns, displaying them on a t-SNE plot. Skills: Python, NLP.
Teaching
Modern Consensus Mechanisms
Instructor · ALPACAS research group, Hong Kong University of Science and Technology
Spring 2026
COMP 1029P: Python Programming Bridging Course
Teaching assistant · Hong Kong University of Science and Technology
Fall 2025
COMP 1029V: Excel VBA Programming Bridging Course
Teaching assistant · Hong Kong University of Science and Technology
Fall 2025
COMP1021: Introduction to Computer Science
Teaching assistant · Hong Kong University of Science and Technology
Spring 2025
COMP 1029J: Java Programming Bridging Course
Teaching assistant · Hong Kong University of Science and Technology
Spring 2024
COMP 4901W: Introduction to Blockchain, Cryptocurrencies, and Smart Contracts
Teaching assistant · Hong Kong University of Science and Technology
Spring 2023
Supervision
Research intern supervision
Jun 2023 – Jan 2024
Hong Kong University of Science and Technology
Supervised a research intern, Karaneh Keypoor, and together we published "Smart Contracts for Trustless Sampling of Correlated Equilibria."
Activities
MARBLE 2026
Program Committee Member
Sep 16 – 18, 2026
Aarhus University, Prof. Andreas Pavlogiannis
Research visitor · Aarhus, Denmark
Aug 23 – Aug 25, 2024
IEEE International Conference on Blockchain, IEEE Blockchain 2024
Presenter · Copenhagen, Denmark
Aug 19 – Aug 22, 2024
IEEE International Conference on Blockchain and Cryptocurrency, ICBC 2024
Presenter · Trinity College Dublin, Dublin, Ireland
May 27 – May 31, 2024
CIMPA Research School on Graph Structure and Complex Network Analysis
Program participant · Nesin Mathematics Village in Şirince, Izmir, Turkey
Jun 4 – Jun 16, 2023
C3: Consensus, Concurrency & Cryptography Workshop
Program participant · National University of Singapore, Singapore (remote)
Dec 12 – Dec 14, 2022
Grants & Awards
- HKPFS Conference Travel Allowance
2026
- Ethereum Foundation Research Grant
2024
- HKPFS Conference Travel Allowance
2024
- Research Travel Grant
2024
- HKPFS Conference Travel Allowance
2023
- Hong Kong PhD Fellowship Scheme
2022–2026
