Clinical trials (CTs) are essential for the advancement of medical research, paving the way for the development and adoption of new treatments, and contributing to the evolution of healthcare. An essential factor for the success of a CT is the appropriate management of its participants and their personal data. According to the current regulations, collecting and using personal data from participants must comply with rigorous standards. Therefore, healthcare institutes need to obtain freely given, specific, informed, and unambiguous consent before being able to collect the data. Some of the major limitations of the current technological solutions are the lack of control over the granularity of consent grants, as well as the difficulty of handling dynamic changes of consent over time. In this paper, we present SCoDES, an approach for trusted and decentralized management of dynamic consent in clinical trials, based on blockchain technology (BCT). The usage of blockchain provides a set of features that allow maintaining consent information with trust guarantees while avoiding the need for a dedicated or centralized third trusted party. We provide a full implementation of SCoDES, made available as a self-contained infrastructure, with the possibility to interact with external services, and using hyperledger as a blockchain framework.