Edge Computing represents the activities of IoT (Internet of Things) devices at the border or limit of the network connected to the remote Cloud. The latest research in this field has intended to demonstrate that Edge Computing architectures are the optimal solution to minimising latency, improving privacy and reducing bandwidth costs in IoT-based scenarios. This article is a review of the Edge Computing technology and its reference architectures proposed by the Edge Computing Consortium, Intel-SAP, the FAR-Edge Project and the Industrial Internet Consortium for Industry 4.0. Moreover, this article presents a proposal for a tiered architecture with a modular approach that allows to manage the complexity of solutions not only for Industry 4.0 environments but also for other scenarios such as smart cities, smart energy, healthcare or precision agrotechnology. The main contributions of the proposed architecture reside in the security and privacy provided by blockchain technologies. Finally, the proposed reference architecture is tested by building an IoT platform in a smart agroindustry scenario to reduce bandwidth costs between the Edge and the Cloud.