Managing security access control has been becoming one of the open issues in Internet of Things (IoT) since the idea of IoT was introduced. The reasons being that the IoT system is built upon large numbers of constrained devices, with limited power, computing resources, and memory. Therefore, the access management needs to be highly distributed in order to ensure the scalability when many IoT nodes are connected in the system, and the cryptographic operation and other algorithms performed along with the access control mechanism have to be lightweight to fit the constrained device characteristics of IoT. The existing access controls proposed for IoT, such as Role-based Access Control (RBAC), Attribute-based Access Control (ABAC) and Capability-based Access Control (CapBAC) are not truly distributed. As for the resource limitation in the IoT devices, recent developments of more powerful microprocessors or System on Chip (SoC) allow advanced cryptographic implementation on the chip itself, e.g. public key cryptography, with the cost of performance degradation. Recently, blockchain technology which is based on distributed ledger system, gains a lot of attention from the industries and researchers. Coupled with the smart contract and various distributed consensus mechanisms, blockchain can be a good solution for providing distributed access control in IoT. This paper proposed an architecture and mechanism of blockchain and smart-contract based access control for IoT. A proof-of-concept is implemented to validate the proposed idea and its performance is evaluated to gain some preliminary sights for further developments.