Data sharing plays a crucial role in the growth of robotic devices, user interactions, networking, and intelligence. The Internet of Robotic Things (IoRT) has significantly advanced in fostering the evolution of robotic devices, user interactions, networking, and intelligence. The nascent nature of IoRT presents security challenges, such as privacy breaches for users and robotic devices and the vulnerability of data sharing to tampering and forgery. In this study, we propose a privacy-preserving scheme for robotic device data sharing in IoRT based on blockchain technology. The proposed scheme utilizes cryptographic techniques to conceal users' identities, robotic devices, and robotic units participating in data sharing. The scheme utilizes Ethereum blockchain techniques to ensure data sources' reliability and protect data from malicious tampering. We implemented smart contracts to represent contractual actions when a given access condition was met. Using cryptographic techniques based on the pseudorandom function in conjunction with blockchain technology's distributed and tamper-resistant characteristics, the proposed scheme ensures secure communication, data integrity, and device authentication in an autonomous and unreliable environment, improving the security, privacy, and efficiency of IoRT systems. Through theoretical security analysis and comprehensive experimental evaluations, it is demonstrated that the scheme is resilient against privacy breaches and is capable of protecting data integrity. After analyzing the performance metrics, we found that our proposed method significantly reduced the computational time by at least 28% for system configuration, decreased authentication time by 6%, lowered peer-to-peer connection establishment by 8%, and reduced data-sharing expenses by 24% when compared to several recent and relevant schemes. Therefore, the proposed blockchain-based privacy-preserving scheme offers a robust solution for sharing data securely and privately within an IoRT environment. Using this technique, the applications of IoRT can be protected to ensure that their data remain confidential, intact, reliable against privacy leakage, forgery and data tampering.