Design patterns are an effective technique to develop software. However, a lack of suitable documents often reduces traceability, and advantages remain unclear in source lines of code (SLOC). Design patterns have proved to be reliable solutions to a number of frequent problems in object-oriented software design. The detection of design patterns in a software system contributes to maintainability and re-engineering and facilitates the understanding of codes. Furthermore, different implementations of a design pattern impede the detection of code pattern instances. A design pattern is a set of roles played by the code classes. Roles are the main details and determinants in patterns. A pattern can be detected in its defined role since it is an instance of a role. It is also of great importance in system documentation. The proposed method exploits blockchain-based approaches in order to identify code links, inter-code relationships, and pattern similarities to the code. The results demonstrate that the blockchain is effective and efficient in extracting the connections of features from source codes and adapting to design patterns with precision 97%.