On legal contracts, imperative and declarative smart contracts, and blockchain systems