IoTChain: A blockchain security architecture for the Internet of Things