The Industrial Internet of Things (IIoT) is gaining importance as most technologies and applications are integrated with the IIoT. Moreover, it consists of several tiny sensors to sense the environment and gather the information. These devices continuously monitor, collect, exchange, analyze, and transfer the captured data to nearby devices or servers using an open channel, i.e., internet. However, such centralized system based on IIoT provides more vulnerabilities to security and privacy in IIoT networks. In order to resolve these issues, we present a blockchain-based deep-learning framework that provides two levels of security and privacy. First a blockchain scheme is designed where each participating entities are registered, verified, and thereafter validated using smart contract based enhanced Proof of Work, to achieve the target of security and privacy. Second, a deep-learning scheme with a Variational AutoEncoder (VAE) technique for privacy and Bidirectional Long Short-Term Memory (BiLSTM) for intrusion detection is designed. The experimental results are based on the IoT-Botnet and ToN-IoT datasets that are publicly available. The proposed simulations results are compared with the benchmark models and it is validated that the proposed framework outperforms the existing system.