Research Article

SESCon: Secure Ethereum Smart Contracts by Vulnerable Patterns’ Detection

Algorithm 1

Detecting vulnerabilities in the smart contract using SESCon.
(1)Read the smart contract
(2)Extract the abstract syntax tree
(3)Convert AST to XML path using XPath queries
(4)Store locations of each statement which L1, L2, … Ln
(5)Get control flow graphs (cf1, cf2)
(6)Get dependency graph, dg1, dg2
(7)Get local variable (lv1, lv2)
(8)Get state variable (sv1, sv2, \enleadertwodots svn)
(9)Get payable function (pf1, pf2)
(10)Get nonpayable function (npf1, npf2, …\enleadertwodots npfn)
(11)Load standard patterns of vulnerabilities , , …,
(12)for each (pi) compare dgi in given smart contract do
(13)if foundPattern then
(14)  detectVulList.add (pi)
(15)  locationsList.add (Li)
(16)end if
(17)end for
(18)Generate report