IONChain: Optimizing the Internet of things