## 3 Proposed Methodology
### RSChain
#### 3.4.2 Module Design of RSChain  
Sponsorship and token withdrawal transactions are controlled by the same smart contract, which records the total historical sponsorship amount of an OI or a sponsor and the remaining amount not withdrawn by a developer. Through \(<DevPu_{k},linkID>\), the sponsorship tokens can be deposited into the sponsorship contract. Sponsored developers can withdraw their own tokens from the contract. For the sponsorship transaction, the pre-verification is the same as the rating transaction in the CFChain. Then, the contract verifies whether various variables exceed the numerical range. The withdrawal transaction only needs to be verified when the remaining amount of the user is greater than 0. Any user can query multiple sponsorship mappings recorded in the contract. The decentralized sponsorship process is completely transparent. Once sponsored, only the sponsored user can withdraw it. There were some studies on code rewards using blockchain. However, there were few simple and practical methods to solve the problems of tampering, plagiarism, insufficient automation, etc. With the assistance of OIChain, RSChain provided a decentralized way for OS rewards that can prevent malicious competitors and murky operations without complex cryptography technology. The schematic process is shown in Figure 7.  
The demander generates a reward smart contract according to the provided template. Then, it is submitted to the RSChain with the code requirements, test requirements, deadline and reward tokens. Creating a smart contract is also a trans  
Figure 7: The process of open-source reward. verified to confirm if it conforms to the template and if the identity of the demander is not null. Reward tokens are locked into the contract before the deadline. The demander can upload the contract address to the community for promotion. Each developer interested in it uploads the solution to the code warehouse and then submits relevant OI to the OICChain. Before completing the solution, the developer does not need to declare their intention to join and the development progress will not be exposed. Therefore, even if it is copied by malicious competitors later, the timestamp submitted to the warehouse will have been recorded in the OICChain and can be regarded as the development completion time within a strict chronological judgment. In addition, OICChain records can prevent codes from being tampered with. Before submitting the solution (\(linkID\) and timestamp recorded in the OICChain) and test report link to the reward contract in the CFChain, each developer needs to use Travis CI or other tools for testing in the code warehouse according to requirements. The solution submission transaction in the CFChain needs to be pre-verified for the correctness of the OI and its author. Then, the reward contract will request the oracle to verify the test report link, including whether it corresponds to the \(linkID\) and whether the test scheme is consistent with the requirements and passes. The result is returned by the callback function. Users can submit a solution or add reward tokens to motivate developers before the deadline. After the deadline, anyone can call the finality function. The reward contract chooses the solution with the earliest timestamp that passes the tests as the winner and pays the reward to the developer. If no solution passes the tests, the reward is withdrawn according to the source of the tokens. Users can query the reward amount, the number of solutions that have passed tests, whether their solution has passed the tests and the winning solution. Demanders and developers only need to pay attention to their own reward content or development content; other processes are coordinated automatically. In this decentralized OS reward, the development process is not open, but the flow of tokens and the competition process are transparent. The pseudo code of the reward smart contract template is shown in Algorithm 6.