## 2 Backgrounds and Related Works
### Special Smart Contracts in Dual Sidechains  
In this section, we shall explain how HMBS uses dual sidechains. For this purpose, let us assume that there is a transaction, \(t\), which is broadcast to be recorded in a SC segment \(\mathbb{S}_{\sigma}^{[n]}\) in a shard, say, \(\mathcal{S}_{\sigma}\). We first consider the case that \(t\) is the transaction that creates UCs \(x_{1}\) and \(x_{2}\) by spending a UC \(x_{0}\) (See (12)). In this case, \(x_{0}\) must be in \(\mathcal{S}_{\sigma}\), but \(x_{1}\) and \(x_{2}\) can be in any other shards. If \(x_{1}\in\mathcal{S}_{\sigma}\) and \(x_{2}\in\mathcal{S}_{\sigma}\), then \(x_{2}\) is immediately spendable after an SC block \(b_{\sigma}^{[n,j]}\) containing \(t\) is mined, but \(x_{1}\) can be spent only after the segment \(\mathbb{S}_{\sigma}^{[n]}\) is connected to MC block \(B^{[n_{i+1}]}\). However, any UCs created in the segment \(\mathbb{S}_{\sigma}^{[n]}\) are spendable in their own shards after \(\mathbb{S}_{\sigma}^{[n]}\) ends. We now consider that the transaction \(t\) is used to create a smart contract, \(sc\). If \(sc\) is stateless, then, like a newly created UC, it is executable in \(\mathcal{S}_{\sigma}\) immediately after the SC block \(b_{\sigma}^{[n,j]}\) containing \(t\) is mined, but only in the whole HMBS network after the segment \(\mathbb{S}_{\sigma}^{[n]}\) is connected to MC block \(B^{[n_{i+1}]}\). Any stateless smart contracts created in the segment \(\mathbb{S}_{\sigma}^{[n]}\) are only executable after the MC block \(B^{[n_{i+1}]}\) is mined. In the case when \(sc\) is state-dependent stateful, \(sc\) is only executable in MC and only after the MC block \(B^{[n_{i+1}]}\) is mined. In the case when \(sc\) is state-independent stateful, however, \(sc\) is not executable in an HMBS network, even after the MC block \(B^{[n_{i+1}]}\) is mined. This is because, as a state-independent stateful smart contract, \(sc\) needs its contract account CA\({}_{sc}\) in AC. In other words, users in the HMBS network, including users in the shard \(\mathcal{S}_{\sigma}\), need to wait for CA\({}_{sc}\) to be created in AC to execute \(sc\). In HMBS, the transaction that creates a state-independent stateful smart contract is the request signal to AC miners to create the corresponding contract account. To be specific, an AC miner create CA\({}_{sc}\), with \(loc_{\text{CA}}\) defined by  
\[loc_{\text{CA}}=ix_{t}||h^{[n_{t+1}]}, \tag{29}\]  
where \(ix_{t}\) is the collection of indices \(\sigma\) (SC), \(n\) (segment), \(j\) (block) and \(k\) (transaction) that identifies the location of the transaction \(t\) that creates \(sc\) in HMBS and \(h^{[n_{t+1}]}\) is the hash value of the MC block \(B^{[n_{t+1}]}\). Therefore, the creation of the contract account CA of the smart contract \(sc\) can only start after the MC block \(B^{[n_{t+1}]}\) is mined. In other words, \(sc\) is not immediately executable after the MC block \(B^{[n_{t+1}]}\) is mined. HMBS requires that the state-independent stateful smart contract \(sc\) is only executable in the SC segment \(\mathbb{S}_{\sigma}^{[n]}\) if the contract account CA\({}_{sc}\) was in AC when \(\mathbb{S}_{\sigma}^{[n]}\) started. We now consider the case that transaction \(t\) is used to execute a state-independent stateful smart contract \(sc\) whose contract account CA\({}_{sc}\) was in AC when the SC segment \(\mathbb{S}_{\sigma}^{[n]}\) started. See (14). In this case, the UC \(x_{1}\) created by the address \(addr_{1}\) used to receive the predetermined change \(v-\theta-\epsilon\) is spendable after the SC block \(b_{\sigma}^{[n,j]}\) containing \(t\) is mined if \(x_{1}\in\mathcal{S}_{\sigma}\) or after the SC segment \(\mathbb{S}_{\sigma}^{[n]}\) ends if \(x_{1}\
otin\mathcal{S}_{\sigma}\). The UC created by the address \(addr_{2}\) is used to receive the change from the contract account CA\({}_{sc}\), and is only spendable in MC. We are now ready to explain the objective of dual sidechains.