Because of the rising population density, relationships are necessary to raise living standards through sending and receiving a wide range of services. Because of this, many means of object communication-regardless of their nature-are necessary to meet our daily needs. IoT is a network of physical things integrated with sensors, and software to communicate with each other. To establish a good connection, every object considered to be an associate of another object should meet certain requirements including scalability, interoperability, and trustworthiness. IoT security is a challenging task to protect the hardware and networks in the IoT system and a significant constraint to the deployment and realization of IoT. IoT security may include data confidentiality, authentication, access control, anonymity, and trust among services and products. Exchanging trust information is critical for assessing an entity's trustworthiness. Therefore, trust information must be shared and stored securely to ensure reliability, honesty, and safety. We propose a secure trust management scheme built on blockchain technologies to secure the entire system in transparency, traceability, and material integrity. We implement a blockchain-based trust management architecture for smart buildings that collect node trust proof. It assigns a trust score to each node, securely stores them in an array, then the threshold value is computed using the ID3 Algorithm. IoT threshold value is broadcasted into the blockchain network and stored in the trusted list. According to the findings, our approach encompasses security measures such as tamper-proofing, attack resistance, reliability, and low functionality for IoT in smart buildings.