Content uploaded by Huawei Huang

Author content

All content in this area was uploaded by Huawei Huang on Jul 06, 2022

Content may be subject to copyright.

1

Elastic Resource Allocation against Imbalanced

Transaction Assignments in Sharding-based

Permissioned Blockchains

Huawei Huang ID , Zhengyu Yue ID , Xiaowen Peng, Liuding He, Wuhui Chen ID ,Member, IEEE,

Hong-Ning Dai ID ,Senior Member, IEEE, Zibin Zheng ID ,Senior Member, IEEE, Song Guo ID ,Fellow, IEEE

Abstract—This paper studies the PBFT-based sharded permissioned blockchain, which executes in either a local datacenter or a

rented cloud platform. In such permissioned blockchain, the transaction (TX) assignment strategy could be malicious such that the

network shards may possibly receive imbalanced transactions or even bursty-TX injection attacks. An imbalanced transaction

assignment brings serious threats to the stability of the sharded blockchain. A stable sharded blockchain can ensure that each shard

processes the arrived transactions timely. Since the system stability is closely related to the blockchain throughput, how to maintain a

stable sharded blockchain becomes a challenge. To depict the transaction processing in each network shard, we adopt the Lyapunov

Optimization framework. Exploiting drift-plus-penalty (DPP) technique, we then propose an adaptive resource-allocation algorithm,

which can yield the near-optimal solution for each network shard while the shard queues can also be stably maintained. We also

rigorously analyze the theoretical boundaries of both the system objective and the queue length of shards. The numerical results show

that the proposed algorithm can achieve a better balance between resource consumption and queue stability than other baselines. We

particularly evaluate two representative cases of bursty-TX injection attacks, i.e., the continued attacks against all network shards and

the drastic attacks against a single network shard. The evaluation results show that the DPP-based algorithm can well alleviate the

imbalanced TX assignment, and simultaneously maintain high throughput while consuming fewer resources than other baselines.

Index Terms—System Stability, Sharded Blockchain, Queueing Theory, Imbalanced Transaction Assignment

F

1 INTRODUCTION

Blockchain technologies have gained enormous atten-

tion in the past few years, leading to the blooming

of countless decentralized applications (DApps), such as

digital currencies [1], blockchain games [2], vehicles [3],

internet of things [4], and medical treatment solutions [5],

etc. Nevertheless, the scalability is still a barrier prevent-

ing the blockchain technology from widely being adopted.

Taking Bitcoin as an example, the mining time of a block is

around ten minutes, thus the Bitcoin network is only able

to handle a very limited number of Transactions Per Second

(TPS). Meanwhile, the constant block size also restricts the

scalability of the blockchain. Therefore, it is hard for a

blockchain network to achieve the similar throughput of

the mainstream payment network like Visa (more than 5000

TPS) or Paypal (about 200 TPS).

Sharding [6], designed originally as a principle of clas-

sical database, is now being considered as a promising

solution to improving the scalability of blockchains [7].

The key idea of sharding-based technique is to make a

distribution over the blockchain nodes. Through sharding,

the workload of transaction processing overhead can be

amortized by different blockchain shards. The blockchain

sharding network is analogous to a highway with multiple

•H. Huang, Z. Yue, X. Peng, L. He, W. Chen and Z. Zheng are with the

School of Computer Science and Engineering, Sun Yat-Sen University,

Guangzhou, China. E-mail: {huanghw28; zhzibin}@mail.sysu.edu.cn

•H.-N. Dai is with the Department of Computing and Decision Sciences,

Lingnan University, Hong Kong. Email: hndai@ieee.org.

•S. Guo is with the Department of Computing, The Hong Kong Polytechnic

University, Hong Kong. E-mail: song.guo@polyu.edu.hk

toll stations, each of which only needs to handle a subset of

all blockchain transactions. This parallel manner effectively

alleviates the congestion occurred in traditional blockchain

networks. Two obvious beneﬁts of sharding technique are

reviewed as follows. First, sharding technique can ensure

that transactions can be processed with much shorter con-

gestion latency. Second, the improved transaction through-

put will encourage more users and applications to engage

in blockchain ecosystems. This change will make blockchain

consensus more proﬁtable and increase the security of the

blockchain network.

Motivation. In the sharded blockchain, the blockchain

nodes are divided into a number of smaller committees [8],

each is also called a network shard. In each committee,

local consensus can be achieved with a set of designated

transactions using a speciﬁed consensus protocol such as

Practical Byzantine Fault Tolerance protocol (PBFT) [9].

Thus, the sharded blockchain can improve the blockchain

TPS by exploiting the concurrent transaction processing in

parallel shards. Several representative examples of sharded

blockchain protocols include Elastico [8], Omniledger [10],

RapaidChain [11], and Monoxide [12].

In this paper, we consider the Unspent Transaction Out-

put (UTXO)-based transaction model. In the hash-based

sharded blockchains [8], [10], [11], imbalanced transaction

assignments in some committees can be induced either by

the abnormal transaction execution [13] or by a low-quality

even a malicious transaction assignment strategy [14]. Re-

ferring to Elastico [8], committees work on different disjoint

sets of transactions assigned according to the committee ID.

2

However, if a malicious transaction assignment strategy [14]

aims to create a blockchain shard with low-speed trans-

action processing, the TPS of the entire blockchain can be

degraded drastically. For example, reference [14] mentioned

that a malicious transaction assignment may strategically

put a large number of transactions to a single shard. Such

asingle-shard ﬂooding attack [14] can be realized through

manipulating the hash value of transactions.

Speciﬁcally, the last sbits of a transaction’s hash specify

which committee ID that the transaction should be assigned

to. However, the attacker with enough UTXO addresses can

create a huge number of malicious transactions towards the

target shard. Let Dbe the ID of the target shard and Abe

the set of attacker’s UTXO addresses. Hash function H(·)

adopts SHA-256, and Ois the set of attacker’s available

addresses that can be generated arbitrarily by public-private

key pair. Then, Eq. (1) in [14] shows how to generate

malicious transactions in a sharding blockchain consisting

of 2sshards: for TX.in ∈ A,

while H(H(TX))& 0256−sk1s6=Ddo TX.out @

← O,(1)

where @

←denotes choosing a single element from the given

set O. In order to know the impact of such malicious

transaction assignment. We implement the malicious TX-

generation code given as Eq. (1) in Python and run the

code using 12 operating-system threads on an AMD Ryzen

9 3900X 12-core processor. When the number of shards

is 16, the TX-generation code can generate 8038886 TXs

per second, among which 502011 TXs can be assigned to

the target shard. Then, we conduct a group of simulations

using 8 million Bitcoin TXs by injecting them into the TX-

sharding system at the best ﬁxed rates. Fig. 1(a) demon-

strates the time-varying queue size of the target shard under

attacking in a 16-shard blockchain system. We evaluate the

performance of queue size while varying the the ratio of

malicious TXs from 0 to 0.5. The TX rate is ﬁxed to 4000

TPS, which is the best throughput of the 16-shard blockchain

system. We observe that the queue size of the shard under

attacking increases until all malicious TXs are injected. The

results show that a larger ratio of malicious TXs implies a

faster increase pace of the shard’s queue size. Then, Fig.

1(b) illustrates the target shard’s queue size versus different

numbers of shards when the ratio of malicious TXs is ﬁxed

to 20%. The results show that a larger number of shards

are more vulnerable in single-shard ﬂooding attacks. In this

paper, we call such single-shard ﬂooding attack the bursty-

TX injection attack.

In summary, the bursty-TX injection can bring a large-

size queue to a target blockchain shard, and thus cause a

large congestion in that shard. Therefore, a critical issue

is to maintain each shard in a stable status such that the

imbalance of transaction’s assignment can be quickly miti-

gated to guarantee low transaction conﬁrmation latency in

the shards suffering from the bursty-TX injection attack.

Challenges. We assume that the permissioned sharded

blockchain executes in a cloud platform, which is either im-

plemented in the local datacenter or rented from a popular

cloud provider such as Alibaba cloud or Amazon cloud.

In the context of such permissioned blockchain, the malicious

transaction assignment strategy [14] may inject a large num-

0 500 1000 1500 2000 2500

Time (s)

0

1

2

3

Queue Size

1e6

ratio = 0

ratio = 0.1

ratio = 0.2

ratio = 0.3

ratio = 0.4

ratio = 0.5

(a) Queue size vs malicious-TX ra-

tio in a 16-shard blockchain.

0 5000 10000 15000

Time (s)

0.00

0.25

0.50

0.75

1.00

1.25

1.50

Queue Size

1e6

4 shards

8 shards

16 shards

32 shards

(b) Queue size vs the # of shards

with 20% malicious TXs.

Fig. 1. The motivation examples: the impact of single-shard ﬂooding

attacks [14] (also called bursty-TX injection attacks in this paper).

ber of bursty transactions to some target shards. Further-

more, the resource budgets in a permissioned blockchain are

much more limited than that in a permissionless blockchain.

This is because the resources of a permissionless blockchain

(e.g, Bitcoin blockchain) are provided by a wide range of

miners all over the world. In contrast, the resources in

a cloud-based permissioned blockchain are provided by

the local datacenter or by the commercial cloud platform

provider. Thus, a challenge is how to maintain shards stable

in a resource-limited permissioned blockchain while taking

the threat of the bursty-TX injection attack into account.

On the other hand, although the existing state-of-the-

art blockchain sharding studies [8], [10]–[12] have pro-

posed a number of transaction-processing solutions in the

context of sharding-based blockchains, we still have not

yet found any available solutions to solving the stability

issue aforementioned. Therefore, a new strategy that can

handle the imbalanced transaction assignments occurred in

the shards of a permissioned blockchain is in an urgent

need. To this end, we formulate the congestion of the

permissioned sharded blockchain as the stability issue in

a multi-queue system. In this system, some shards may

congest if they are assigned a large number of transactions

either by the abnormal transaction execution [13] or by the

malicious transaction assignment strategy [14]. To alleviate

the congestion occurred in some shards, we adopt the Lya-

punov Optimization framework [15] to address the stability

issue. Our idea emphasizes on how to efﬁciently allocate

blockchain-network resources according to the observed

status of each shard’s Memory Pool (shorten as mempool),

so as to minimize the operation cost while simultaneously

keeping the sharded blockchain stable.

Contributions. The contributions are stated as follows.

•In the PBFT-based permissioned blockchain, we

study how to allocate budget-limited network re-

sources to blockchain shards in an elastic manner,

such that the transaction processing can be main-

tained stable in those blockchain shards, under the

condition of imbalanced transaction assignments or

even under the bursty-TX injection attacks. We for-

mulate this problem using the Lyapunov Optimiza-

tion framework. We then devise a drift-plus-penalty

(DPP)-based algorithm striving for the near-optimal

resource-allocation solution.

•We rigorously analyze the theoretical boundaries of

both the system objective and the shard’s queue

3

length, while utilizing the proposed DPP algorithm.

•Finally, the numerical simulation results show that

the proposed DPP algorithm can maintain a ﬁne-

balanced tradeoff between resource consumption

and queue stability. In particular, the DPP-based al-

gorithm can also well handle the bursty-TX injection

attack in two representative scenarios.

The rest of this paper is organized as follows. Section

2 reviews the state-of-the-art studies. Section 3 describes

the system model and problem formulation. Then, Section 4

depicts the proposed algorithm by exploiting the Lyapunov

Optimization framework. Section 5 shows the evaluation

results. Finally, Section 6 concludes this paper.

2 RE LATED WORK

Transaction Processing. Several studies investigate the

transaction processing of blockchains using queueing the-

ory. The representative studies are reviewed as follows. In

[16], the authors focus on how to develop queueing theory

of blockchain systems. They devised a Markovian batch-

service queueing system with two different service stages,

i.e., the mining process in the miners pool and the creation

of a new block. Besides, they adopted the matrix-geometric

solution to obtain stable condition of the system. Then, Ricci

et al. [17] introduced a simple queueing-theory model to

show the delay experienced by Bitcoin transactions. The

proposed model associates the delay of transactions with

both transaction fee and transaction value. Their result indi-

cates that users typically experience a delay slightly larger

than the residual lifetime of the total duration between block

generations. Memon et al. [18] implemented the simulation

of mining process in Blockchain-based systems using queu-

ing theory. Kawase et al. [19] considered a queueing model

with batch service and general input to understand the

stochastic behavior of the transaction-conﬁrmation process.

In [20], the authors applied Jackson network model on the

whole Bitcoin network where individual nodes operate as

priority M/G/1 queueing systems. The usefulness of this

model is demonstrated by efﬁciently computing the forking

probability in Bitcoin blockchain. Although these previous

works reviewed above adopted the traditional queueing

theory to depict transaction’s processing, they cannot offer

available solutions to handling the stability problem for

network shards when the bursty-TX injection attack occurs.

In contrast, the approach we propose in this paper utilizes

the Lyapunov optimization framework to resist the bursty-

TX injection attack for the permissioned sharded blockchain.

Sharding Protocols. Sharding is ﬁrst proposed by [21]

to distribute data at global scale and support externally-

consistent distributed transactions of distributed databases

and the cloud infrastructure. This technology allows the

network to partition into different parts. Motivated by

this distributed design, several studies have discussed the

intra-consensus protocols of blockchains under the sharding

mechanism. For example, Luu et al. [8] ﬁrst integrated

sharding with the blockchain to achieve a scale-out system

called Elastico, in which the capacity and throughput can be

linearly proportional to the number of shards while main-

taining decentralization and security. Elastico is viewed as

the ﬁrst candidate for a secure sharding protocol for per-

missionless blockchains, thereby scaling up the agreement

throughput near linearly with the computational power of

the network. It can also tolerate byzantine adversaries, by

controlling up to one-forth computation capacity, in the

partially synchronous network. Then, Kokoris et al. [10]

presented a sharding protocol named OmniLedger, which

ensures security and correctness by using a bias-resistant

public-randomness protocol for choosing large and statisti-

cally representative shards to process transactions, and by

introducing an efﬁcient cross-shard commit protocol that

atomically handles transactions affecting multiple shards.

Zamani et al. [11] proposed RapidChain, the ﬁrst sharding-

based public blockchain protocol that is resilient to Byzan-

tine faults from up to 1/3 of its participants, and achieves

a complete sharding of the communication, computation,

and storage overhead when processing transactions without

assuming any trusted setup. Wang et al. [12] proposed

Monoxide to maintain the simplicity of the blockchain

system and enhance the capacity by duplicating equal

and asynchronous zones, which work independently with

minimal coordination. In [22], the authors presented the

design of Chainspace which offers high scalability through

sharding across blockchain nodes using a novel distributed

atomic commit protocol named S-BAC, while offering high

auditability. The most similar work to this paper is the

sharding protocol proposed by Dang et al. [23]. In this

work, aiming to realize high transaction throughput at scale,

the authors proposed an efﬁcient shard formation protocol,

a trusted hardware-based performance-improving solution,

as well as a general distributed transaction protocol. Com-

paring with [23], our study in this paper also strives for

improving the sharding protocol for the PBFT-based permis-

sioned blockchain. The difference is that the goal of [23] is to

achieve high transaction throughput by proposing a shard

formation protocol, while our work in this paper is towards

stable transaction processing through efﬁciently allocating

network resources to blockchain shards.

Resource Allocation. Several previous studies paid at-

tention to the resource allocation of blockchain networks.

For example, Jiao et al. [24] considered deploying edge com-

puting services to support the mobile blockchain. The au-

thors proposed an auction-based resource-allocation mech-

anism for the edge-computing service provider. Luong et

al. [25] developed an optimal auction by exploiting the

deep learning technique for the edge-resource allocation

in the context of mobile blockchain networks. Fang et al.

[26] proposed a queue-based analytical model to solve

the resources allocation problem in PoW-based blockchain

networks. These previous works focus on the resource al-

location for traditional blockchain networks. In contrast,

the resource-allocation model we propose in this paper

aims at the PBFT-based permissioned sharded blockchain by

exploiting the queuing-based theory. More importantly, the

proposed resource-allocation mechanism can particularly

maintain the stability for each network shard.

4

Committee 1

Collation chain

of committee 1

Main chain

Collation chain

of committee 2 Collation chain

of committee 3

Final PBFT

A collation

block

Stage 1: Formation of

network shards

( i.e.,

committees

); Stage 2: TX assignment;

Stage 3: Formation of the final block.

Stage 1

Stage 2 Stage 3

Committee 2 Committee 3

PBFT

consensus

PBFT

consensus

PBFT

consensus

TX-assignment Strategy

All TXs

TXs

… …

TXs TXs

Fig. 2. A PBFT-based sharded permissioned blockchain, in which trans-

actions are assigned to different committees (network shards) according

to their hash values.

3 SYSTEM MODEL AND PROBLEM FORMULATION

3.1 Sharding-based Permissioned Blockchain

Suppose that an enterprise needs to build a permissioned

blockchain using the sharding technique. All blockchain

nodes are executing in a local cloud platform. Those

blockchain nodes are managed using sharding protocol,

in which the local consensus is achieved by exploiting

PBFT protocol. Thus, the natural goals of operating such

a permissioned blockchain include: to keep the blockchain

stable while processing transactions, and to consume the

minimum resources while maintaining the local cloud plat-

form. The cloud resources mainly include the computer

power measured in the number of CPU cores, the network

bandwidth, as well as the storage space provided by the

cloud-platform virtual machines.

As shown in Fig. 2, the transaction-sharding protocol

mainly includes the following stages: i) the blockchain net-

work is divided into different committees (or called network

shards); ii) each committee then independently processes

different sets of assigned transactions in parallel to achieve a

high throughput of transaction processing; and iii) collation

blocks are aggregated to perform the ﬁnal PBFT towards the

formation of a new block on the main chain. Referring to

the classic blockchain sharding protocol [8], the computing

power is mainly used to perform the PoW-based committee

formation, while the network bandwidth is exploited to run

the PBFT consensus protocol for generating new blocks.

3.2 Blockchain Shards

In a sharding-based blockchain network, several groups of

transactions are allocated to different network shards for

processing. The blocks generated in each shard chain are

called collation blocks, which are veriﬁed by all miners ( also

called collators) in this shard. The collators of each shard

are selected by the block validator in the entire blockchain

network through validator manager contract (VMC) [27],

which is the core of a sharding mechanism.

Each shard holds a memory, i.e., the local mempool in

each shard, where the arrived transactions are stored tenta-

tively and waiting to be processed by the committee. When

a new transaction is assigned to a network shard, it will be

validated by the committee node that the transaction ﬁrst

arrives at. After validation, this transaction will be stored

in the mempool and then be broadcast to other committee

nodes; otherwise, the transaction will be rejected. At the

beginning of each epoch, the miners in a network shard

will select a set of transactions from the local mempool to

generate a collation block. When a miner wins the mining

in each epoch, it will broadcast the new collation block to

its committee peers, which then validate the new block.

Afterwards, the new block will be added to the shard’s

collation chain and all the transactions contained in this

collation block will be removed from the local mempool of

this shard.

3.3 Arrived Transactions in Each Network Shard

Under the same UTXO-based transaction model presented

in [8], [10], [11], we consider that committees (network

shards) work on disjoint sets of transactions. In each net-

work shard, since the propagation time for spreading new

transactions is much shorter than the time spending on

achieving consensus towards the collation block, the propa-

gation time of new transactions is negligible in our system

model. Thus, new transactions are viewed as that they arrive

at all committee nodes within a network shard simultane-

ously. After transaction’s propagation, all committee nodes

in this shard share the same set of transactions. That is,

they hold the identical view of the local mempool. There-

fore, the mempool can be viewed as a single-server queue

which stores the assigned transactions waiting to be pro-

cessed by the multiple nodes in the shard. In this queueing

model, transactions arrive randomly following a Poisson

distribution. When being packed to a collation block, the

transactions contained in the block will be removed from

the mempool. We call this removing action the transaction’s

dequeueing. In each epoch, all committee members gener-

ate a new collation block when they reach an agreement

based on the PBFT consensus protocol. Every shard’s queue

represents the condition of the local mempool. Based on

the queueing model aforementioned, a blockchain sharding

network can be viewed as a multi-queue system shown in

Fig. 3.

3.4 Threat Model of Bursty-TX Injection Attack

Blockchain is typically implemented using conventional

hardware, software and networks. Even a theoretically se-

cure blockchain sharding protocol can be vulnerable to

various attacks. Similar to the single-shard ﬂooding attack

presented in [14], we consider that the hash-based transac-

tion assignment strategy could be malicious. In most hash-

based sharded blockchains [8], [10], [11], the several ending

5

Mempool

TX-assignment Strategy

(could be malicious)

Committee

# 1

: A large number of bursty TXs are injected.

: The change of the queue under attack.

TXs arrived at

queue #1

TXs dequeued

from queue #1

…

Committee

#

N

…

TXs dequeued

from queue #

N

Fig. 3. Multi-queue model and the bursty-TX injection attack in the

sharded blockchain.

bits of a transaction decide which network shard to place.

Through manipulating the transaction’s hash, the malicious

transaction assignment strategy can inject a large-volume

bursty transactions in a target shard at a speciﬁed epoch.

The large amount of transactions injected to a target shard

can cause the effect of denial-of-service (DoS) attack [28]

in the target. When such an attack occurs, the transactions

submitted by blockchain users may congest in the shard’s

mempool. Thus, the service quality of the blockchain system

degrades drastically, because the user’s transactions suffer

from large conﬁrmation latency in the shard under attack.

Especially in the context of transaction-sharding protocol

like Elastico [8], the target shard suffered from such bursty-

TX injection attack can delay the generation of the local

collation block, and then postpone the creation of the ﬁnal

block in the main chain.

3.5 Problem Formulation

We consider that the permissioned sharded blockchain stud-

ied in this paper runs in a time-slotted environment. All

timeslots are indexed by t∈ {0,1,2,3, ...}, and the length

of a timeslot is longer than the time of forming a collation

block. Let I={1,2,3, ..., N }be the set of mempool queues,

thus each queue is indexed by i∈I. Then, Kdenotes the

number of all types of aforementioned resources that can be

allocated to the permissioned sharded blockchain.

We then use a vector pi(t),[p1

i(t), p2

i(t), p3

i(t),· · · ,

pK

i(t)] to represent the total resources that can be allocated

to shard i∈Iat timeslot t. Note that, pk

i(t),k∈[K], denotes

the amount of the kth resource invested on the shard i∈Ito

generate a collation block in timeslot t∈T. Each type of the

kth resource has a maximum budget denoted by Pk

max. In

order to represent the signiﬁcance of each type of resources,

we devise a weight vector w,[w1, w2, w3,· · · , wK], where

wkindicates the weight of the kth resource.

In every timeslot t∈T, we assume that Bi(t)is the

amount of transactions (TXs) processed by shard i∈I.

The value of Bi(t)is closely associated with the allocated

TABLE 1

Symbols and Notations

Ithe set of queues, |I|(= N)represents the size of I

Tthe set of all timeslots, t∈T

Kthe # of all types of resources, k∈ {1,2,3, ..., K}

pi(t)the vector of resources allocated for shard i∈Iat t

pk

i(t)the k-th resource allocated to shard i∈Iat timeslot t

Pk

max the budget of the k-th resource

wkthe weight of the k-th resource

Q(t)vector of actual queues, Q(t)=[Q1(t), Q2(t), ..., QN(t)]

Qi(t)the queue length of shard i∈Iat timeslot t

Ai(t)the arrival transactions of queue i∈Iat timeslot t

Bi(t)the dequeued transactions of queue i∈Iat timeslot t

Rthe reward to measure each unit of dequeued data

Vthe parameter measuring the weight of penalty

αthe parameter reverse to the consensus difﬁculty

L(Q(t)) the Lyapunov function of Q(t)

∆(Q(t)) the Lyapunov drift, ∆(Q(t)) = L(Q(t+ 1)) −L(Q(t))

Z(t)vector of virtual queues, Z(t)=[Z1(t), Z2(t), ..., ZK(t)]

zk(t)the increment arrived in virtual queue kat timeslot t

Θ(t)the concatenated vector Θ(t)=[Q(t),Z(t)]

resource pi(t). Referring to [26], the data amount processed

by shard i∈Iat timeslot tis calculated as follows.

Bi(t) =

K

X

k=1 hwkpk

i(t)iα,∀i∈I, t ∈T, (2)

where α∈[0,1] is a normalized parameter associated with

the consensus speed of the PBFT protocol. In reality, αcould

be the normalized degree of network connectivity in a peer-

to-peer blockchain network. The larger αis, the easier a

collation block is generated with the given same amount

of resources.

At the beginning of a timeslot, a set of TXs will be

assigned to each network shard. The TXs arrived in shard

i∈Iat timeslot t∈Tare denoted by Ai(t). Afterwards,

the committee nodes in the shard will choose a subset of

TXs from the local mempool to participate in the consensus

process. The veriﬁed transactions will be packed into a new

collation block. Then, we use Qi(t)to represent the queue

length of shard iin the beginning of timeslot t. Thus, the

queue-length evolution can be expressed as:

Qi(t+1) = max{Qi(t)−Bi(t)+Ai(t),0},∀i∈I, t ∈T . (3)

On the other hand, to represent the investment cost on

the consensus of the sharded permissioned blockchain, we

deﬁne ci(t)as the numerical resource consumption by the

network shard i∈Iin timeslot t∈T:

ci(t) =

K

X

k=1

pk

i(t),∀i∈I, t ∈T. (4)

6

Objectives of Blockchain-Network Operator. From

the viewpoint of the operator of a permissioned sharded

blockchain, the objectives are twofold: (i) to pursue a high

speed of TX processing, and (ii) to lower the operating cost

in terms of resource consumption during the TX process-

ing. Those two objectives seem conﬂict with each other.

The operator has to maximize the payoff of transaction

processing while using a limited amount of resources. To

integrate those two conﬂict goals together, we devise a

penalty function pen(t), which is calculated by the total

resource consumption deﬁned in Eq. (4) minus the TX-

processing payoff. To measure the payoff while processing

a unit of data dequeued from Bi(t), we also deﬁne a

constant Ras the TX-processing reward parameter. Here,

we clarify the simpliﬁcation to measure each transaction

equally as the reward parameter Rwhen calculating the

payoff of dequeued transactions. This is because the unique

value of each transaction is blind to the proposed resource-

allocation method. Only the number of transactions in each

shard can be observed by the proposed method taking the

transaction’s privacy into account in the context of per-

missioned blockchain. Therefore, our system model treats

every transaction equally and calculates the payoff of trans-

action’s processing using the constant reward parameter R.

In practice, Rcan be conﬁgured according to the empirical

preference of the blockchain network operator, when he/she

deﬁnes the relative weights of two penalty terms ci(t)and

Bi(t). Then, the penalty function can be written as follows:

pen(t) =

N

X

i=1

[ci(t)−Bi(t)·R]

=

N

X

i=1

K

X

k=1

pk

i(t)−R·

N

X

i=1

K

X

k=1 hwkpk

i(t)iα,∀t∈T.

(5)

Recall that a sharded permissioned blockchain network

can be viewed as a multi-queue system as shown in Fig.

3. Besides the objective to minimize the penalty deﬁned in

Eq. (5), the network operator also intends to guarantee that

each shard queue is in a stable condition during a long

period, even under the large-volume bursty-TX injection

attack. Using the notion of queue stability deﬁned in [15],

the multi-queue system is strongly stable if it satisﬁes:

lim

t→∞

1

t·1

N

t−1

X

τ=0

N

X

i=1

E{Qi(τ)}<∞.(6)

The basic idea to prove the Ineq. (6) is that in a multi-

queue system, the assigned TXs in each queue will not

be accumulated to inﬁnity in the long run. Therefore, to

keep the multi-queue system stable, each shard needs to

process the TXs arrived in the queue with sufﬁcient al-

located resources. In this way, every TX assigned to this

network shard can be processed in time. With the objective

function and the constraints described above, we propose

the following resource allocation problem for the sharded

permissioned blockchain network.

min pen

s.t.

N

X

i=1

pk

i(t)≤Pk

max,∀k∈[K], t ∈T.

Queue stability depicted by Ineq. (6).

Var :pi(t),∀i∈I , t ∈T .

(7)

In next section, we design an adaptive resource allo-

cation algorithm that can ﬁnd a near-optimal solution to

problem (7).

4 DYNAMIC RESOURCE-ALLOCATION ALGORITHM

To address the proposed resource-allocation problem (7) in

the context of maintaining the stability of the multi-queue

sharded permissioned blockchain, we design a dynamic

resource-allocation algorithm using the stochastic Lyapunov

optimization technique [15]. In practice, the proposed al-

gorithm can execute in the same manner of the sharding

protocol.

4.1 Algorithm Design

Since the PBFT-based sharded blockchain is viewed as a

queueing system with N>0 queues, we deﬁne Q(t) =

[Q1(t), Q2(t), ..., QN(t)] as the vector of queue backlogs of

all network shards. To quantitatively measure the size of the

vector Q(t), a quadratic Lyapunov function L(Q(t)) is deﬁned

as follows:

L(Q(t)) ,1

2

N

X

i=1

Qi(t)2,∀t∈T. (8)

We then deﬁne a one-timeslot conditional Lyapunov drift

∆(Q(t)) as follows:

∆(Q(t)) ,L(Q(t+ 1)) −L(Q(t)),∀t∈T. (9)

This drift is in fact the change in the Lyapunov function

(8) over one timeslot. Suppose that the current queue state

in timeslot tis Q(t), we have the following lemma.

Lemma 1. (Lyapunov Drift) Given the quadratic Lyapunov

function (8), and assuming L(Q(0)) <∞, for arbitrary non-

negative constants B > 0and > 0, the following drift condition

holds:

lim

t→∞

1

t·

t−1

X

τ=0

N

X

i=1

E{Qi(τ)}< B/. (10)

Lemma 1 tells that if the drift condition Ineq. (10) holds

with > 0, then all queues are strongly stable with the

queue backlog bounded by B/. The proof of lemma 1

follows the same routine shown in [15], we omit the proof

detail because of the space limitation.

Next, we need to handle the ﬁrst constraint of problem

(7) to ensure that the total consumption of the k-th resource

should be restricted by the budget Pk

max. To solve this

issue, we transform the inequality constraints into a queue

stability problem. By deﬁning virtual queues Zk(t)for all

k∈[K], the update equation of Zk(t)is written as:

Zk(t+ 1) = max{Zk(t) + zk(t),0},∀k∈[K], t ∈T , (11)

7

where zk(t) = PN

i=1 pk

i(t)−Pk

max,∀k∈[K], t ∈T. The

initial length of the virtual queue Zk(0),∀k∈[K]is 0.

Insight: Eq. (11) indicates that Zk(t+ 1) −Zk(t)≥

zk(t). By summing the inequality above over timeslots

t= 0,1, ..., T −1, and dividing both sides by T, we

have Zk(T)−Zk(0)

T≥1

TPT−1

t=0 zk(t). With Zk(0) = 0, take

expectation on both sides and let T→ ∞, the result is

lim supT→∞

E{Zk(T)}

T≥lim supT→∞ zk(t), where zk(t)is

the time-average expectation of zk(t). If virtual queue Zk(t)

is mean-rate stable, we get lim supT→∞ zk(t)≤0, which

implies that the constraint of resource restriction in problem

(7) is satisﬁed.

With the objective to maintain both the actual and virtual

queues, we combine both of them to devise a concatenated

vector Θ(t) = [Q(t),Z(t)], which can be updated using both

Eq. (3) and (11). Then, the Lyapunov function of Θ(t)is

deﬁned as:

L(Θ(t)) ,1

2

N

X

i=1

Qi(t)2+1

2

K

X

k=1

Zk(t)2, t ∈T . (12)

If we successfully make L(Θ(t)) maintain a small value

for each timeslot t, both the actual queues Q(t)and virtual

queues Z(t)can be “squeezed” to a small space of queue

backlogs. In the following, we present how to achieve such

the goal using the technique of Lyapunov drift [15].

Lemma 2. (Optimality Over Resource Allocation) Let p∗=

p∗

1,p∗

2,p∗

3, ..., p∗

Nbe the optimal resource allocation solution

to problem (7). Suppose the sharded blockchain system satisﬁes

the boundedness assumptions [15] and the law of large numbers.

If the problem is feasible, then for any δ > 0, there exists

a stationary randomized policy that makes the resource alloca-

tion depend only on the state of multi-queue system, such that

pen(t)< pen∗(t) + δand Ai(t)< Bi(t), where

pen∗(t),

N

X

i=1

[c∗

i(t)−B∗

i(t)·R],∀t∈T. (13)

The proof of lemma 2 is given in [15]. The next step

is to minimize a concatenated vector ∆(Θ(t)), which is

deﬁned as the Lyapunov drift of Θ(t), and ∆(Θ(t)) =

L(Θ(t+1))−L(Θ(t)). It should be noticed that minimizing

the Lyapunov drift of Θ(t)would enforce queues towards a

lower congestion. However, only focusing on the drift part

may incur a large penalty pen(t). Thus, we then propose

a dynamic resource allocation algorithm based on the drift-

plus-penalty (DPP) technique [15] to maintain the stability

of a multi-queue blockchain system, and to minimize pen(t)

simultaneously. To achieve the goal, we integrate the penalty

function into the Lyapunov drift ∆(Θ(t)). In every timeslot

t, we try to minimize the following drift-plus-penalty:

∆(Θ(t)) + V·pen(t)

=∆(Θ(t)) + V·

N

X

i=1

[ci(t)−Bi(t)·R],∀t∈T, (14)

where Vis a weight parameter representing how much we

emphasize on minimizing the penalty pen(t). When V= 0,

the objective is to minimize the drift alone. Thus, to provide

guarantees on pen(t), we consider V > 0, which indicates

a joint optimization taking both the system stability and the

resource consumption into account.

Lemma 3. (Drift Boundary) The boundary of the drift-plus-

penalty expression shown in Eq. (14) satisﬁes:

∆(Θ(t)) + V·

N

X

i=1

[ci(t)−Bi(t)·R]

≤B+V·

N

X

i=1

[ci(t)−Bi(t)·R]

+

N

X

i=1

Qi(t) [Ai(t)−Bi(t)]

+

K

X

k=1

Zk(t)zk(t),∀t∈T,

(15)

where the positive constant Bexists and is bounded by:

B≥1

2

N

X

i=1

EAi(t)2+Bi(t)2|Θ(t)

+1

2

K

X

k=1

Ezk(t)2|Θ(t)

−

N

X

i=1

E{min{Qi(t), Bi(t)} · Ai(t)|Θ(t)}.

Proof. Exploiting the deﬁnition of Lyapunov drift, we have:

∆(Θ(t)) = L(Θ(t+ 1)) −L(Θ(t))

=1

2

N

X

i=1 Qi(t+ 1)2−Qi(t)2

+1

2

K

X

k=1 Zk(t+ 1)2−Zk(t)2

(a)

≤1

2

N

X

i=1 n[Qi(t)−Bi(t) + Ai(t)]2−Qi(t)2o

+1

2

K

X

k=1 n[Zk(t) + zk(t)]2−Zk(t)2o

=

N

X

i=1 1

2[Ai(t)−Bi(t)]2+Qi(t) [Ai(t)−Bi(t)]

+

K

X

k=1 1

2zk(t)2+Zk(t)zk(t)

≤B+

N

X

i=1

Qi(t) [Ai(t)−Bi(t)]

+

K

X

k=1

Zk(t)zk(t),∀t∈T,

where the inequation (a) follows from Eq. (3) and Eq. (11).

When adding V·PN

i=1 [ci(t)−Bi(t)·R]on both sides of

the above derivation, the inequation (15) holds.

Because the arrival new TXs Ai(t)in timeslot tis in-

dependent of Θ(t), minimizing the right-hand-side (RHS)

8

Algorithm 1: Drift-Plus-Penalty Resource Alloca-

tion

Input : T,V,R,α

Output: pi(t),∀i∈I,t∈T

1Q(0) ← ∅,Z(0) ← ∅;

2for ∀t∈Tdo

3Invoking Algorithm 2 (t, Q(t),Z(t), V, R, α) to

get the optimal resource allocation pi(t),∀i∈I.

4Update the actual and virtual queues Q(t)and

Z(t)according to Eq. (3) and Eq. (11),

respectively.

Algorithm 2: Resource Allocation Per Timeslot

Input : t, Q(t),Z(t), V, R, α

Output: pi(t),i∈I

1for ∀i∈I, ∀k∈[K]do

2pk

i(t)←α−1

qZk(t)+V

α(wk)α[Qi(t)+V R].

of Ineq. (15) for each timeslot tis equalized to solving the

original optimization problem (7). Thus, we expand the RHS

of Ineq. (15) and rearrange the objective as:

min Ψ(pi(t))

Var :pi(t),∀i∈I , t ∈T , (16)

where Ψ(pi(t)) = PN

i=1 PK

k=1(Zk(t) + V)pk

i(t)−(Qi(t)

+V R)[wkpk

i(t)]α.

Note that, problem (16) is a linear programming and

Ψ(pi(t)) is a convex function, through partially differenti-

ating Ψ(pi(t)) by pk

i(t)and rearranging terms, then we get:

∂Ψ(pi(t))

∂pk

i(t)=Zk(t) + V−α(wk)α(Qi(t) + V R)[pk

i(t)]α−1.

(17)

From Eq. (17) we can ﬁnd a real-numbered valley point

pk

i(t) = α−1

qZk(t)+V

α(wk)α[Qi(t)+V R](∀i∈I, ∀k∈[K]), which is

the optimal resource allocation solution to the optimization

problem (7). Then, given Eq. (17), the DPP-based resource-

allocation algorithms are presented as Algorithms 1 and 2.

4.2 Algorithm Analysis

In this section, we analyze the performance guarantee of the

proposed DPP-based algorithm.

4.2.1 Upper Bound of System Objective

First, Theorem 1 tells that the proposed DPP algorithm can

ensure the system objective guaranteed within an O(1/V )

distance to that of the optimal solution to problem (7).

Theorem 1. Suppose that problem (7) is feasible and there

exists an optimal resource allocation solution which can obtain

an optimal value pen∗, and L(Θ(0)) <∞. For any V > 0, the

time-average penalty yielded by the proposed Algorithm 1 satisﬁes:

lim

t→∞ sup 1

t

t−1

X

τ=0

N

X

i=1

[ci(τ)−Bi(τ)·R]≤pen∗+B

V,(18)

where Bis depicted in Lemma 3.

Proof. Integrating the result of Lemma 2 into the RHS of Eq.

(15), and let δ→0, we have:

∆(Θ(τ)) + V pen(τ)

≤B+V·pen∗+

N

X

i=1

Qi(τ) [Ai(τ)−Bi(τ)]

+

K

X

k=1

Zk(τ)zk(τ),

(19)

where ∆(Θ(τ)) = L(Θ(τ+ 1)) −L(Θ(τ)).

Taking expectations on both sides, and summing the

inequation (19) over τ∈ {0,1, ..., t −1}, it yields:

E{L(Θ(t))} − E{L(Θ(0))}+V

t−1

X

τ=0

pen(τ)

≤B·t+V t ·pen∗+E(t−1

X

τ=0

N

X

i=1

Qi(τ) [Ai(τ)−Bi(τ)])

+E(t−1

X

τ=0

K

X

k=1

Zk(τ)zk(τ)).

(20)

Eq. (3) implies that Qi(τ)≥0. Referring to Theorem

4.5 of [15] and the requirement of system stability, we have

E{Ai(τ)}−E{Bi(τ)} ≤ 0. Eq. (11) secures Zk(τ)≥0. Since

zk(t)denotes the inequality constraint in problem (7), we

have E{zk(τ)} ≤ 0. The Lyapunov function L(Θ(t)) ≥0

is due to Eq. (12). With those inequalities illustrated above,

rearranging the terms of Ineq. (20) and dividing both sides

by V·t, we have:

1

t

t−1

X

τ=0

pen(τ)≤pen∗+B

V+E{L(Θ(0))}

V·t.(21)

Then, taking a lim supt→∞ and invoking Eq. (5), the

conclusion of Theorem 1 holds.

4.2.2 Upper Bound of the Queue Length of Shards

In this part, we analyze the congestion performance (mea-

sured in queue length) of network shards when adopting the

proposed Algorithm 1. First, we give Assumption 1.

Assumption 1. (Slater Condition [15]) For the expected arrival

rates Ai(t)and process rates Bi(t), there exists a constant > 0,

which satisﬁes E{Ai(t)} − E{Bi(t)}≤−.

We see that such Slater Condition [15] is related to the

system stability. Using this condition, we then have the

following theoretical upper bound of queue length.

Theorem 2. If problem (7) is feasible and Assumption 1 holds,

then the proposed Algorithm 1 can stabilize the multi-queue

blockchain system, and the time-average queue length satisﬁes:

lim

t→∞ sup 1

t

t−1

X

τ=0

N

X

i=1

E{Qi(τ)} ≤ B+V(pen∗−penmin)

,

where Bis deﬁned in Lemma 3 and penmin is the minimum

resource consumption yielded by all the feasible solutions.

9

0 20 40 60 80 100

Queue Length

0.0

0.2

0.4

0.6

0.8

1.0

CDF

V=50

V=100

V=150

Codebook based [31]

(a) CDF of the queue length of all network

shards per timeslot.

120 130 140 150 160 170

Computing-Power Consumption

0.0

0.2

0.4

0.6

0.8

1.0

CDF

V=50

V=100

V=150

Codebook based [31]

(b) CDF of the computing-power consumption

of all network shards per timeslot.

70 75 80 85 90 95 100

Network Bandwidth Consumption (Kb/s)

0.0

0.2

0.4

0.6

0.8

1.0

CDF

V=50

V=100

V=150

Codebook based [31]

(c) CDF of the network bandwidth consump-

tion of all network shards per timeslot.

Fig. 4. Performance evaluation while varying parameter V.

Proof. Referring to Ineq. (20), we separate the actual queues

apart from the inequation. Given L(Q(t)) ≥0, we have:

−E{L(Q(0))}+V

t−1

X

τ=0

pen(τ)

≤B·t+V t ·pen∗+E(t

X

τ=0

N

X

i=1

Qi(τ) [Ai(τ)−Bi(τ)]).

Exploiting Assumption 1, we then have:

−E{L(Q(0))}+V

t−1

X

τ=0

pen(τ)

≤B·t+V t ·pen∗−

t

X

τ=0

N

X

i=1

Qi(τ).

Rearranging terms and dividing both sides by t·, we

get:

1

t

t

X

τ=0

N

X

i=1

Qi(τ)

≤B·t+E{L(Q(0))}+V t ·pen∗−VPt−1

τ=0 pen(τ)

t·

≤B+V(pen∗−penmin)

+E{L(Q(0))}

t·.

Finally, we take a lim sup as t→ ∞ to conclude the proof.

Insights: Theorem 1 and Theorem 2 show that the

proposed DPP-based algorithm has an O(1/V )∼O(V)

tradeoff between resource consumption and queue-length

performance. As the TX processing delay is proportional to

the queue’s length, thus the proposed algorithm can make

a ﬁne-balanced cost-delay tradeoff for the permissioned

sharded blockchain.

5 PERFORMANCE EVALUATION

In this section, we conduct numerical simulations to evalu-

ate the proposed DPP Res. Allocation algorithm in the context

of PBFT-based sharded permissioned blockchain.

5.1 Basic Settings for Numerical Simulation

In simulations, the sharded blockchain network consists of

a varying number of Nnetwork shards.

Dataset. For simulations, we generate numerical synthe-

sized transaction dataset as the arrived TXs Ai(t)for each

network shard i∈Iat each timeslot t∈ {1,2, ..., 1000}

timeslots. The integer value of Ai(t)is randomly distributed

within the range [5, 25].

Resources. Network shards consume the cloud-platform

resources to strive for consensus. We consider two types of

resources in our simulation. The ﬁrst type is the comput-

ing power (measured in the # of CPU cores). The second

type is the network bandwidth, measured in Kbit/Second

(Kb/s). Recall that we have mentioned that the computing

power is mainly for committee formation and the network

bandwidth is for PBFT consensus in Section 3.1. The weights

of those two resources are variable depending on different

network conﬁgurations. How to set the weights of different

resources is not the focus of this paper. Thus, we set the

weights of the two types of resources to 5 and 3, respectively.

Other weight settings can be also evaluated similarly and

thus omitted.

Other parameters. We then ﬁx R=5 to denote the reward

of dequeueing each unit of TX data. The consensus parame-

ter αfor all network shards is set to 0.5. The total simulation

duration is set as 1000 timeslots.

5.2 Metrics

To compare the performance of algorithms, we focus on the

following metrics.

•Queue Length. The backlog of each queue which

represents the number of unprocessed TXs in the

mempool of each shard.

•Computing-Power Consumption. The consumption

of computing-power for the all shards spending on

processing TXs in each timeslot.

•Network Bandwidth Consumption. The bandwidth

consumption for all network shards to process TXs

waited in mempool per timeslot.

5.3 Baselines

We consider the following baselines for the comparison with

the proposed algorithm.

10

5 10 15 50 100

Number of Shards

100

101

102

103

104

105

Average Queue Length

DPP Res. Allocation (proposed)

Top-S Res. Allocation [Huang 2020]

Longest-First Res. Allocation [Maguluri 2014]

Average Res. Allocation

Random Res. Allocation

(a) The average queue length of each shard per timeslot v.s. the #

of shards.

5 10 15 50 100

Number of Shards

0

1000

2000

3000

4000

5000

6000

7000

8000

Computing-Power consumption

DPP Res. Allocation (proposed)

Top-S Res. Allocation [Huang 2020]

Longest-First Res. Allocation [Maguluri 2014]

Average Res. Allocation

Random Res. Allocation

(b) The computing-power consumption of all shards per timeslot

v.s. the # of shards.

5 10 15 50 100

Number of Shards

0

500

1000

1500

2000

2500

3000

3500

4000

Network Bandwidth Consumption (Kb/s)

DPP Res. Allocation (proposed)

Top-S Res. Allocation [Huang 2020]

Longest-First Res. Allocation [Maguluri 2014]

Average Res. Allocation

Random Res. Allocation

(c) The network bandwidth consumption of all shards per timeslot

v.s. the # of shards.

5 10 15 50 100

Number of Shards

0

200

400

600

800

1000

1200

1400

Throughput

DPP Res. Allocation (proposed)

Top-S Res. Allocation [Huang 2020]

Longest-First Res. Allocation [Maguluri 2014]

Average Res. Allocation

Random Res. Allocation

(d) The throughput (total dequeued TXs in each timeslot) of all

shards per timeslot v.s. the # of shards.

Fig. 5. Performance comparison with baseline algorithms.

•Top-S Res. Allocation [29]. This baseline equally

allocates each type of resource to the queues that

locate in the top-Spercentage of all network shards

with respect to (w.r.t) their queue length.

•Longest-First Res. Allocation [30]. This baseline al-

ways allocates each type of resource to the queue that

has the longest queue among all network shards w.r.t

their queue length.

•Average Res. Allocation. This strategy allocates each

type of available resources to all network shards on

average at each timeslot.

•Random Res. Allocation. The last baseline allocates

each type of available resources with a random

amount to every network shard at each timeslot.

5.4 Performance Analysis

5.4.1 Effect of Tuning Parameter V

The ﬁrst group of simulations evaluates the effect of param-

eter V. Firstly, we ﬁx N= 4 and set Vto 50, 100, and 150

in different executing cases. In addition, to study the effect

of dynamically tuning parameter V, we also implement a

codebook-based method referring to [31]. In such codebook-

based approach, Vis adaptively varied within the range

[50, 150] according to the changes of shard’s queue backlog

and the resource consumption. The goal is to maintain a

balanced trade-off between those two objective terms. For

example, when the queue length of shards is observed too

large, Vis tuned to a small value accordingly. When too

many resources are consumed by network shards, Vis then

tuned to a large value. For all network shards, the total

computing-power budget and the total network bandwidth

budget are set to 200 CPUs and 100 Kb/s, respectively.

From Fig. 4(a), Fig.4(b) and Fig.4(c), we can observe that

the proposed DPP Res. Allocation can stabilize all queues

of network shards, since the length of 90% of all queues

is within 40 while varying the parameter V. Secondly,

the virtual-queue technique can keep the two types of

resources under their given individual budgets. Finally, we

ﬁnd that a larger Vleads to a lower resource-consumption

in terms of both computing-power and network bandwidth

consumption. Thus, the resource consumption illustrates an

O(1/V ) ratio. However, a large Vincreases the queue length

and thus causes larger waiting latency for TXs. Therefore,

11

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

101

102

103

104

Average Queue Length

Launch the bursty-TX injection attack

Stop the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(a) The average queue length of each baseline under continued

bursty-TX injection attacks.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

0

250

500

750

1000

1250

1500

1750

2000

Throughput

Launch the bursty-TX injection attack

Stop the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(b) The throughput (total dequeued TXs in each timeslot) of each

baseline under the bursty-TX injection attack.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

3000

3500

4000

4500

5000

5500

6000

Computing-Power consumption

Launch the bursty-TX injection attack

Stop the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(c) The computing-power consumption of each baseline under the

bursty-TX injection attack.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

1900

2000

2100

2200

2300

2400

2500

2600

2700

Network Bandwidth Consumption (Kb/s)

Launch the bursty-TX injection attack

Stop the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(d) The network bandwidth consumption of each baseline under

the bursty-TX injection attack.

Fig. 6. Performance evaluation under the continued bursty-TX injection attack against all network shards.

the queue length shows an O(V) ratio. Those observations

match the insights disclosed in the end of Section 4.2. In

contrast, the codebook-based method has a similar resource-

consumption performance with other cases under ﬁxed V,

but yields a more narrow range of queue length than other

three cases. In conclusion, the tradeoff between the resource

consumption and the queueing delay of TXs should be

made carefully by tuning the parameter V.

5.4.2 Performance Comparison with Baselines

Through Fig. 5, we compare the proposed DPP Res. Allo-

cation algorithm with the three baselines aforementioned.

The budgets of computing-power and network bandwidth

resources are set to 5000 CPUs and 2500 Kb/s, respectively.

The number of network shards varies from 5 to 100. For the

Top-S Res. Allocation, we set Sto 50%.

Interestingly, from Fig. 5(a), we observe that when the

shard number is smaller than 100, Top-S Res. Allocation has

the similar queue length as the proposed DPP Res. Allocation

does. However, when the shard number reaches 100, the

Top-S Res. Allocation strategy cannot maintain the stable

queue length anymore, because the the Top-S strategy only

focuses on allocating resources for the queues that locate

at the top Spercentage of all w.r.t queue length. When

the number of network shards grows large, the resources

are not able to fulﬁll the requirement of maintaining short

queues for network shards. As for the Longest-First Res.

Allocation, it can only maintain stable queue length when the

number of shards is less than 10. When the number of shards

exceeds 15, the average queue length of Longest-First Res.

Allocation soars to about 700. Therefore, this strategy fails

to guarantee a stable queue length. The reason is that this

baseline allocates all available resources to the longest queue

every timeslot. Thus, other queues are ignored, making the

average queue length grows sharply.

On the other hand, when the number of shards is less

than 50, Random Res. Allocation yields a shorter queue length

than DPP Res. Allocation. This is because Random Res. Alloca-

tion can provide sufﬁcient required resources to all network

shards with the given budgets. However, once the number

of shards exceeds 50, the average queue length indicated by

Random Res. Allocation increases drastically from 20 to 780,

as shown in Fig.5(a). Since the queue length grows exponen-

12

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

101

102

103

104

Average Queue Length

Launch the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(a) The average queue length of each baseline under a drastic

bursty-TX injection attack.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

0

250

500

750

1000

1250

1500

1750

2000

Throughput

Launch the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(b) The throughput (total dequeued TXs in each timeslot) of each

baseline under the bursty-TX injection attack.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

3000

3500

4000

4500

5000

5500

6000

Computing-Power consumption

Launch the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(c) The computing-power consumption of each baseline under the

bursty-TX injection attack.

0 100 200 300 400 500 600 700 800 900 1000

Timeslot

1900

2000

2100

2200

2300

2400

2500

2600

2700

Network Bandwidth Consumption (Kb/s)

Launch the bursty-TX injection attack

DPP Res. Allocation (proposed)

Top-S Res. Allocation

Longest-First Res. Allocation

(d) The network bandwidth consumption of each baseline under

the bursty-TX injection attack.

Fig. 7. Performance evaluation under the drastic bursty-TX injection attack against a single network shard.

tially under the Random Res. Allocation strategy when the

number of shards increases, its low resource-consumption

properties shown in Fig. 5(b) and Fig. 5(c) are meaningless.

In the case of Average Res. Allocation strategy, we see that

the queue length is even lower than that of Random Res.

Allocation when the number of shards is small, and still

maintains a very low level when the blockchain has 100

network shards. However, such low-level queue length is

achieved by supplying all the available resources (i.e., the

full computing-power budget shown in Fig. 5(b) and the

full network-bandwidth budget shown in Fig. 5(c)) to all

network shards. Therefore, the Average Res. Allocation strat-

egy cannot achieve a balance between resource consumption

and queue’s stability.

In contrast, the proposed DPP Res. Allocation algorithm

can always maintain a stable queue length shown in Fig.

5(a) when the number of shards varies from 5 to 100. Also,

Fig. 5(b) and Fig. 5(c) demonstrate that DPP Res. Allocation

requires a linearly-growing resource consumption when the

number of shards increases from 5 to 100. Even though

when the shard number reaches 100, the average resource

consumption of DPP Res. Allocation is still lower than that of

the other three baselines including Top-S,Longest-First and

Average Res. Allocation.

Regarding throughput (calculated by the total # of de-

queued TXs in each timeslot), Fig. 5(d) shows that when the

shard number is less than 15, ﬁve strategies have similar

throughput. However, when the number of shards exceeds

50, the throughput of Longest-First Res. Allocation is signif-

icantly lower than other four baselines. The reason is that

Longest-First Res. Allocation only serves the shard having the

most congested memory pool whenever the shard number

varies. When the shard number reaches 100, the throughput

of the proposed DPP Res. Allocation is higher than that of

Top-S and Random Res. Allocation schemes, and is similar to

that of Average Res. Allocation. Considering the throughput

performance shown in Fig. 5(b) and Fig. 5(c), it’s not hard

to see that the DPP Res. Allocation has the most efﬁcient

resource utilization among the ﬁve algorithms.

In summary, the proposed DPP Res. Allocation attains a

ﬁne-balanced tradeoff between queue stability and resource

consumption comparing with other baselines.

13

5.4.3 Continued Bursty-TX Injection Attacks against All

Shards

In this part, we compare the performance under the con-

tinued bursty-TX injection attack of the proposed DPP Res.

Allocation with two baselines, i.e., Top-S and Longest-First

Res. Allocation. Since the other two baselines (Average and

Random Res. Allocation) have very low efﬁciency on resource

consumption, we omit their comparisons in this group of

simulation. The budgets of computing-power and network

bandwidth resources are set to 5000 CPUs and 2500 Kb/s,

respectively. The number of shards is set as 100. The param-

eter Sis ﬁxed to 50% for Top-S Res. Allocation. To simulate

the continued bursty-TX injection attack, we keep injecting

a number of TXs to each network shard with a rate 25

TXs/timeslot between the 100-th and the 150-th timeslot.

Fig. 6(a) demonstrates the performance of queue length

of three strategies under the continued bursty-TX injection

attack. We can see that the proposed DPP Res. Allocation

can quickly process the large number of injected TXs and

maintain a short queue length in the 50 timeslots under at-

tacking. In contrast, for the Top-S and Random Res. Allocation

baselines, the average length of shard’s queue has already

become extremely congested even before we launch the

continued bursty-TX injection attack at the 100-th timeslot.

In terms of throughput, Fig. 6(b) shows that the pro-

posed DPP Res. Allocation can always have the maximum

throughput comparing with the other two baselines. As

shown in Fig. 6(c) and Fig. 6(d), DPP Res. Allocation re-

quires the lowest resource consumption among the three

algorithms. The reason is described as follows. Unlike Top-S

Res. Allocation and Random Res. Allocation, the proposed al-

gorithm does not have to utilize all of the available resources

in every timeslot. When the continued bursty-TX injection

attack begins, although DPP Res. Allocation tends to utilize a

suddenly increasing resources, it can quickly enforce shard

queues to return to stable status when the attack stops at the

150-th timeslot.

5.4.4 Drastic Bursty-TX Injection Attack against A Single

Shard

Under the similar settings to that of the previous group of

simulation, we are also interested in the performance of the

three algorithm under the drastic bursty-TX injection attack

against a speciﬁed network shard. The only difference is the

implementation of the drastic injection attack. To simulate

such the drastic bursty-TX injection attack, we inject 3000

TXs to only a single network shard at the beginning of the

100-th timeslot.

Fig. 7 shows the evaluation results of the drastic bursty-

TX injection attack. In contrast with the other two baselines,

we observe the similar performance of the proposed DPP-

based algorithm, in terms of average queue length, through-

put, and the resource consumption. Comparing with the

previous group of simulations, although the increases of

both queue length and resource consumption are more

sharp, the absolute values of those metrics are very similar

to those of the continued injection attack. Importantly, the

throughput of DPP-based algorithm still demonstrates the

best among the three algorithms.

Thus, in summary, the proposed DPP Res. Allocation

algorithm can maintain the stable queue length under both

the continued and the drastic bursty-TX injection attacks,

and illustrates a more efﬁcient resource consumption than

other two baselines.

6 CONCLUSION

System stability is critical to the key performance of the

sharding-based blockchain. We study how to maintain sta-

ble queues for network shards by proposing a ﬁne-grained

resource-allocation algorithm for the PBFT-based sharded

permissioned blockchain. Based on the multi-queue analyt-

ical model, we adopt the stochastic optimization technique

to help us jointly consider both the resource consumption

and the queue stability when allocating network resources

to each blockchain shard. Through the proposed theoretical

framework, we can choose how much we emphasize on

resource-consumption or queue stability by dynamically

tuning a weight parameter V. We also rigorously analyze

the theoretical upper bounds of system objective and shard’s

queue length of the proposed DPP-based algorithm. Finally,

the numerical simulation results show that the proposed

DPP-based algorithm can effectively stabilize shard queues

while requiring a reasonable level of resource consumption.

Under two representative cases of bursty-TX injection at-

tacks, the evaluation results demonstrate that the proposed

DPP-based algorithm can well alleviate the imbalanced

TX assignments with much shorter queue length, higher

throughput, and lower resource consumption, comparing

with other baselines.

ACKNOWLEDGEMENTS

This Work is partially supported by National Key R&D

Program of China (No.2020YFB1006005), National Natural

Science Foundation of China (61902445), Guangdong Basic

and Applied Basic Research Foundation (2019A1515011798),

Guangzhou Basic and Applied Basic Research Foundation

(202102020613), Pearl River Talent Recruitment Program

(No. 2019QN01X130), CCF-Huawei Populus euphratica for-

est fund (CCF-HuaweiBC2021004), Hong Kong RGC Re-

search Impact Fund (RIF) with the Project No. R5060-

19, General Research Fund (GRF) with the Project No.

152221/19E, 152203/20E, and 152244/21E, the National

Natural Science Foundation of China (61872310), and

Shenzhen Science and Technology Innovation Commission

(R2020A045).

REFERENCES

[1] S. Nakamoto, “Bitcoin: A peer-to-peer electronic cash system,”

Manubot, Tech. Rep., 2019.

[2] T. Min, H. Wang, Y. Guo, and W. Cai, “Blockchain games: A

survey,” in IEEE Conference on Games (CoG), 2019, pp. 1–8.

[3] K. Liu, W. Chen, Z. Zheng, Z. Li, and W. Liang, “A novel debt-

credit mechanism for blockchain-based data-trading in internet of

vehicles,” IEEE Internet of Things Journal, vol. 6, no. 5, pp. 9098–

9111, 2019.

[4] H. Dai, Z. Zheng, and Y. Zhang, “Blockchain for internet of things:

A survey,” IEEE Internet of Things Journal, vol. 6, no. 5, pp. 8076–

8094, 2019.

[5] M. G. Kim, A. R. Lee, H. J. Kwon, J. W. Kim, and I. K. Kim, “Shar-

ing medical questionnaries based on blockchain,” in 2018 IEEE

International Conference on Bioinformatics and Biomedicine (BIBM),

2018, pp. 2767–2769.

14

[6] G. Yu, X. Wang, K. Yu, W. Ni, J. A. Zhang, and R. P. Liu, “Survey:

Sharding in blockchains,” IEEE Access, vol. 8, pp. 14 155–14 181,

2020.

[7] Q. Zhou, H. Huang, Z. Zheng, and J. Bian, “Solutions to scalability

of blockchain: A survey,” IEEE Access, vol. 8, pp. 16 440–16 455,

2020.

[8] L. Luu, V. Narayanan, C. Zheng, K. Baweja, S. Gilbert, and

P. Saxena, “A Secure Sharding Protocol For Open Blockchains,” in

ACM SIGSAC Conference on Computer and Communications Security

(CCS’16). ACM, 2016, pp. 17–30.

[9] M. Castro, B. Liskov et al., “Practical byzantine fault tolerance,” in

OSDI, vol. 99, no. 1999, 1999, pp. 173–186.

[10] E. Kokoris-Kogias, P. Jovanovic, L. Gasser, N. Gailly, E. Syta, and

B. Ford, “Omniledger: A secure, scale-out, decentralized ledger via

sharding,” in IEEE Symposium on Security and Privacy (SP), 2018,

pp. 583–598.

[11] M. Zamani, M. Movahedi, and M. Raykova, “RapidChain: Scaling

Blockchain via Full Sharding,” in ACM SIGSAC Conference on

Computer and Communications Security (CCS’18), 2018.

[12] J. Wang and H. Wang, “Monoxide: Scale out blockchains with

asynchronous consensus zones,” in 16th USENIX Symposium

on Networked Systems Design and Implementation (NSDI 19).

Boston, MA: USENIX Association, Feb. 2019, pp. 95–112.

[Online]. Available: https://www.usenix.org/conference/nsdi19/

presentation/wang-jiaping

[13] L. N. Nguyen, T. D. Nguyen, T. N. Dinh, and M. T. Thai,

“Optchain: optimal transactions placement for scalable blockchain

sharding,” in IEEE 39th International Conference on Distributed Com-

puting Systems (ICDCS). IEEE, 2019, pp. 525–535.

[14] T. Nguyen and M. T. Thai, “Denial-of-service vulnerability of

hash-based transaction sharding: Attacks and countermeasures,”

arXiv:2007.08600, 2020.

[15] M. J. Neely, “Stochastic network optimization with application

to communication and queueing systems,” Synthesis Lectures on

Communication Networks, vol. 3, no. 1, pp. 1–211, 2010.

[16] Q.-L. Li, J.-Y. Ma, and Y.-X. Chang, “Blockchain queue theory,” in

International Conference on Computational Social Networks. Springer,

2018, pp. 25–40.

[17] S. Ricci, E. Ferreira, D. S. Menasche, A. Ziviani, J. E. Souza, and

A. B. Vieira, “Learning blockchain delays: a queueing theory ap-

proach,” ACM SIGMETRICS Performance Evaluation Review, vol. 46,

no. 3, pp. 122–125, 2019.

[18] R. A. Memon, J. Li, J. Ahmed, A. Khan, M. I. Nazir, and M. I.

Mangrio, “Modeling of blockchain based systems using queuing

theory simulation,” in 2018 15th International Computer Conference

on Wavelet Active Media Technology and Information Processing (IC-

CWAMTIP). IEEE, 2018, pp. 107–111.

[19] Y. Kawase and S. Kasahara, “A batch-service queueing system

with general input and its application to analysis of mining

process for bitcoin blockchain,” in IEEE International Conference on

Internet of Things (iThings) and IEEE Green Computing and Commu-

nications (GreenCom) and IEEE Cyber, Physical and Social Computing

(CPSCom) and IEEE Smart Data (SmartData), 2018, pp. 1440–1447.

[20] J. Misic, V. B. Misic, X. Chang, S. G. Motlagh, and M. Z. Ali,

“Block delivery time in bitcoin distribution network,” in IEEE

International Conference on Communications (ICC), 2019, pp. 1–7.

[21] J. C. Corbett, J. Dean, M. Epstein, A. Fikes, C. Frost, J. Furman,

S. Ghemawat, A. Gubarev, C. Heiser, P. Hochschild, W. Hsieh,

S. Kanthak, E. Kogan, H. Li, A. Lloyd, S. Melnik, D. Mwaura,

D. Nagle, S. Quinlan, R. Rao, L. Rolig, Y. Saito, M. Szymaniak,

C. Taylor, R. Wang, and D. Woodford, “Spanner: Google’s

globally-distributed database,” in 10th USENIX Symposium

on Operating Systems Design and Implementation (OSDI 12).

Hollywood, CA: USENIX Association, Oct. 2012, pp. 261–264.

[Online]. Available: https://www.usenix.org/conference/osdi12/

technical-sessions/presentation/corbett

[22] M. Al-Bassam, A. Sonnino, S. Bano, D. Hrycyszyn, and G. Danezis,

“Chainspace: A sharded smart contracts platform,” in Network and

Distributed System Security Symposium, 2018.

[23] H. Dang, T. T. A. Dinh, D. Loghin, E.-C. Chang, Q. Lin, and

B. C. Ooi, “Towards scaling blockchain systems via sharding,” in

Proceedings of the 2019 international conference on management of data,

2019, pp. 123–140.

[24] Y. Jiao, P. Wang, D. Niyato, and Z. Xiong, “Social welfare maxi-

mization auction in edge computing resource allocation for mobile

blockchain,” in IEEE International Conference on Communications

(ICC), 2018, pp. 1–6.

[25] N. C. Luong, Z. Xiong, P. Wang, and D. Niyato, “Optimal auction

for edge computing resource management in mobile blockchain

networks: A deep learning approach,” in IEEE International Con-

ference on Communications (ICC), 2018, pp. 1–6.

[26] M. Fang and J. Liu, “Toward Low-Cost and Stable Blockchain

Networks,” in IEEE International Conference on Communications,

2020, pp. 1–6.

[27] H.-W. Wang, “Ethereum sharding: Overview and ﬁnality,” Ac-

cessed: Sep, vol. 8, p. 2019, 2017.

[28] D. Dasgupta, J. M. Shrein, and K. D. Gupta, “A survey of

blockchain from security perspective,” Journal of Banking and Fi-

nancial Technology, vol. 3, no. 1, pp. 1–17, 2019.

[29] H. Huang, S. Guo, W. Liang, K. Wang, and Y. Okabe, “Coﬂow-like

online data acquisition from low-earth-orbit datacenters,” IEEE

Transactions on Mobile Computing, vol. 19, no. 12, pp. 2743–2760,

2020.

[30] S. T. Maguluri and R. Srikant, “Scheduling jobs with unknown

duration in clouds,” IEEE/ACM Transactions On Networking (ToN),

vol. 22, no. 6, pp. 1938–1951, 2014.

[31] J. Koo, J. Yi, J. Kim, M. A. Hoque, and S. Choi, “Seamless dy-

namic adaptive streaming in lte/wi-ﬁ integrated network under

smartphone resource constraints,” IEEE Transactions on Mobile

Computing, vol. 18, no. 7, pp. 1647–1660, 2019.

Huawei Huang (M’16) received his Ph.D. de-

gree in Computer Science and Engineering from

the University of Aizu (Japan) in 2016. He is

currently an Associate Professor at Sun Yat-Sen

University. He has served as a Research Fellow

of JSPS, and an Assistant Professor with Kyoto

University, Japan. His research interests include

blockchain and distributed computing. He is now

serving as a guest editor for IEEE JSAC and

IEEE OJ-CS, the operation-committee chair for

the IEEE Symposium on Blockchain at IEEE

SERVICES 2021, and the TPC co-chair of GLOBECOM’2021/ICC’2022

Workshop on scalable, secure and intelligent blockchain.

Zhengyu Yue is currently a student pursuing

his master-degree at the School of Computer

Science and Engineering, Sun Yat-Sen Univer-

sity, China. His research interest mainly includes

blockchain.

Xiaowen Peng is currently a student pursuing

his master-degree at the School of Computer

Science and Engineering, Sun Yat-Sen Univer-

sity, China. His research interest mainly focuses

on blockchain.

Liuding He is currently an undergraduate stu-

dent at the School of Computer Science and

Engineering, Sun Yat-Sen University, China. His

research interest mainly focuses on blockchain.

15

Wuhui Chen received bachelor’s degree from

Northeast University, Shengyang, China, in

2008, and the master’s and Ph.D. degrees from

the University of Aizu, Aizuwakamatsu, Japan,

in 2011 and 2014, respectively. From 2014 to

2016, he was a Research Fellow with the Japan

Society for the Promotion of Science, Tokyo,

Japan. From 2016 to 2017, he was a Researcher

with the University of Aizu. He is currently an

Associate Professor with Sun Yat-sen University,

Guangzhou, China. He is a member of the IEEE.

His current research interests include edge/cloud computing, cloud

robotics, and blockchain.

Hong-Ning Dai (SM’16) is currently with the De-

partment of Computing and Decision Sciences,

Lingnan University, Hong Kong, as an associate

professor. He obtained the Ph.D. degree in Com-

puter Science and Engineering from Department

of Computer Science and Engineering at the

Chinese University of Hong Kong. His current

research interests include blockchain and the

Internet of Things. He has served as associate

editors of IEEE Transactions on Industrial Infor-

matics, IEEE Systems Journal, and IEEE Ac-

cess. He is also a senior member of the ACM.

Zibin Zheng (SM’16) received the Ph.D. degree

from the Chinese University of Hong Kong, in

2011. He is currently a professor at School of

Computer Science and Engineering with Sun

Yat-sen University, China. He published over

300 international journal and conference pa-

pers, including 9 ESI highly cited papers. His

research interests include blockchain, artiﬁcial

intelligence, and software reliability. He was a

recipient of several awards, including the Top

50 Inﬂuential Papers in Blockchain of 2018, the

ACM SIGSOFT Distinguished Paper Award at ICSE2010, the Best

Student Paper Award at ICWS2010.

Song Guo (M’02-SM’11-F’20) is a Full Professor

with the Department of Computing, Hong Kong

Polytechnic University, Hong Kong. He received

his PhD degree in computer science from Uni-

versity of Ottawa. He has authored or coau-

thored over450 papers in major conferences and

journals. His current research interests include

big data, cloud and edge computing, mobile

computing, and distributed systems. Prof. Guo

was a recipient of the 2019 TCBD Best Confer-

ence Paper Award, the 2018 IEEE TCGCC Best

Magazine Paper Award, the 2017 IEEE SYSTEMS JOURNAL Annual

Best Paper Award, and six other Best Paper Awards from IEEE/ACM

conferences. He was an IEEE Communications Society Distinguished

Lecturer. He has served as an Associate Editor of IEEE TPDS, IEEE

TCC, IEEE TETC, etc. He also served as the general and program chair

for numerous IEEE conferences. He currently serves in the Board of

Governors of the IEEE Communications Society.