The Internet of Things (IoT) is a fast growing and popular subset of technology. One of the main features of IoT is device autonomy, the ability for the machines embedded in the devices to function without human intervention. This includes communications with other devices through Machine-to-Machine (M2M) communication. Unfortunately, M2M communications are only stored with what behaviours they have observed, without the causal relationship as to how or why they observed those behaviours. Since M2M messages can trigger more M2M messages, the provenance of issues inside an IoT system can be hidden behind a long chain of messages, so finding the root source of any problem, such as malicious or defective devices, is almost impossible to detect. To solve this problem, in this paper we introduce M2MHub, a centralized auditing system which collects M2M messages in an IoT system and stores them in a blockchain. Devices in the system can tell the hub if they wish to open, continue, or end transactions, allowing the hub to keep track of who is the provenance of the transaction and how their transaction affects other devices. A proof-of-concept simulation has been constructed, demonstrating how M2MHub may function in a real-world implementation. The current implementation is not scalable enough to be deployed to actual IoT networks, so several ideas for future work are offered.