A lien is created: (1) By contract; or (2) By operation of law; but no lien arises by mere operation of law until the time at which the act to be secured thereby ought to be performed. Source: CivC 1877, §§ 1702, 1703; CL 1887, §§ 4326, 4327; RCivC 1903, §§ 2022, 2023; RC 1919, §§ 1527, 1528; SDC 1939, § 39.0103.