Digital transformation has increased its proportion in the last few years and the Internet-on-Things (IoT) domain is not an exception, with more and more devices or sensors being connected to the Internet and transmitting different types of data. Usually, being part of more complex IT systems, it must be ensured that the IoT devices transmitting the data are authenticated components of the system before sending the data to a storage server. However, usually, IoT devices have limited computing power, therefore all of the work that they are doing should not be too expensive in terms of computations. This is the case for the authentication mechanism, too. Having this context, in this paper, we propose an authentication mechanism for IoT devices based on elliptic curves, which are known as having a low computational cost compared to other techniques used in cryptography that provide the same level of security. The proposed system includes a blockchain network that will verify the identity of the device which tries to connect within the system to send the data to the storage server, a process that will be made together with the storage server. Once the identity is valid, the blockchain records the transaction and the storage server initiates the data transmission process. Besides including a lightweight authentication mechanism, the proposed method has several other important properties due to it using the blockchain network. Compared to the related work that we analyzed, we show that the proposed authentication mechanism is secure against common attacks designed for IoT devices. The performance analysis shows that the authentication query made by the IoT device takes place in less than a second on both a MSP430F1611 microcontroller and a MICAz sensor.