Toward trustless internet of things: a blockchain-based approach