Smart Contracts: From Formal Specification to Blockchain Code