Smart contracts and their applications