Research Article

To Delay Instantiation of a Smart Contract to Save Calculation Resources in IoT

Algorithm 1. Smart contract invocation by a variable.

1: Define smart contract SCA
2: …
3: End Define
4:
5: Define smart contract SCB
6: …
7: End Define
8:
9: Define smart contract SCC
10: //scope begin {
11: // create an instance (new process) of SCA
12: Variable sca = new Variable(”SCA”);
13: invoking method of sca
14: …
15: // create an instance (new process) of SCB
16: Variable scb = new Variable(”SCB”);
17: invoking method of scb
18: //scope end } - sca and scb are ready to terminate (condition a), and those two smart contract instances terminate after their states have been confirmed in blockchain (condition b)
19: End Define
Algorithm 1. Smart contract invocation by a variable.