  Smart contracts are regarded as one of the most promising and appealing
notions in blockchain technology. Their self-enforcing and event-driven
features make some online activities possible without a trusted third party.
Nevertheless, problems such as miscellaneous attacks, privacy leakage, and low
processing rates pre-vent them from being widely applied. Various schemes and
tools have been proposed to facilitate the construction and execution of secure
smart contracts. However, a comprehensive survey for these proposals is absent,
hindering new researchers and developers from a quick start. This paper surveys
the literature and online resources on smart contract construction and
execution over the period 2008-2020. We divide the studies into three
categories: (1) design paradigms that give examples and patterns on contract
construction, (2) design tools that facilitate the development of secure smart
contracts, and (3) extensions and alternatives that improve the privacy or
efficiency of the system. We start by grouping the relevant construction
schemes into the first two categories. We then review the execution mechanisms
in the last category and further divide the state-of-the-art solutions into
three classes: private contracts with extra tools, off-chain channels, and
extensions on core functionalities. Finally, we summarize several challenges
and identify future research directions toward developing secure,
privacy-preserving, and efficient smart contracts.
