Smart contracts provide computation facilities to blockchains, enabling many application scenarios where automatic analysis and complex transactions can be performed. However, in situations where the flow of information is variable and there are time, quality, and/or cost constraints imposed, smart contracts do not usually offer enough performance. In this article, we describe an elasticity framework that enables dynamic adaptation of smart contracts with respect to used resources, analytics quality, and incurred costs in a transparent manner for both smart contract developers and users. We validate our framework in an Internet of Things and Smart City scenario where several analytics are computed using Elastic Smart Contracts that dynamically adapt the appropriate elasticity variables.