The Internet of things (IoT) is the key enabler of the smart systems used in many areas, from agriculture to aviation, industrial automation to autonomous vehicles. Most IoT deployments employ cost-efficient lightweight devices with limited resources (e.g., bandwidth, energy, storage). Although an IoT network must be built in its simplest form, engineers include more sophisticated devices like gateways and servers to provide web-based services and benefit from cloud systems. So, although the nodes can be widely distributed geographically or topologically, the system becomes centralized, which causes bottlenecks and single-points-of-failure. Furthermore, providing data integrity, nonrepudiation, and event management becomes tricky. In most IoT scenarios, data usually flow from sensors to storage and processing units, whereas event-driven commands and triggers flow from these units to actuators, if any. Therefore, an attacker who gained access to parts of the centralized systems may leak, alter, or remove critical data and may exploit event handling features. This is where blockchain technology can be extremely useful. Using a decentralized ledger as the data storage unit provides integrity, immutability, and nonrepudiation for any IoT deployment. And a customized smart contract lets the IoT deployment benefit from decentralized and immutable (i.e. nonmanipulatable) event management features, too. Further, decentralization provides resilience against availability attacks to a large extent. With this motivation, we introduced a novel IoT architecture that incorporates an Ethereum-based private (Quorum) blockchain running a unique ad-hoc smart contract and a message queue telemetry transport (MQTT) based communication scheme between sensor and actuator nodes. The scheme, the ledger, and the smart contract have also been implemented with several nodes, a broker, and a server all on a PC using Docker containers, where the server was running a forest fire risk detection algorithm as the use case scenario. The proof-of-concept successfully validates the abovesaid functionality, scalability, and efficiency for the given IoT scenario (and some others). Moreover, performance tests showed that an instance of the system with 1000 nodes could stably process and record incoming (sensor) data up to 12.5 transactions per second (TPS) and distribute commands up to 4 TPS, whereas higher TPS is achievable depending on the network conditions and tolerance to losses. The scheme was shown to have polynomial message and time complexity.