# Towards a New Business Model for Streaming Platforms Using Blockchain Technology
## 4 Proposed Solution
### Automatic Smart Contract Generation Service
```
1:procedureBlockchain Procedure
2:contentCreatorAddress\(\leftarrow\)string
3:contentId\(\leftarrow\)string
4:applicationBinaryInterface\(\leftarrow\)array[]
5:
6:for All Application Binary Interface (ABI) from i=0 to ABI.length do
7:contract\(\leftarrow\)ABI[i]
8:endfor
9:
10:contract\(\leftarrow\)Receives the private key from the streaming platform to make payments
11:
12:functiondeploy(bytecodeContract, contentCreatorAddress)
13:
14: Get the content creator's wallet address and pass it as a parameter to the contract builder
15: Get the bytecode of the contract to deploy on the blockchain network
16:
17:functionsend(publicKeyStreamingPlatform, gasLimit, gasPrice, Value)
18:
19: Get the function parameters and send them to the blockchain network to finalize the contract deployment. 20:
21:endfunction
22:endfunction
23:
24:contract.DEPLOY(params).SEND(params)
25:endprocedure
```

**Algorithm 1** Generate smart contract. The smart contract's ABI contains all the business rules needed to manage audience metrics and payments associated with the content on the streaming platform in an automated way. Figure 3 illustrates the main functionalities described in the ABI. It emphasizes security protocols that restrict the execution of actions relevant to each user, such as content creators and streaming platforms. The contract itself exclusively triggers the payment mechanism directed at the content creator. Additionally, the contract can update and view audience metrics. It is worth noting that other requirements can be added to the ABI without impacting the functioning of the proposed architecture and services. ### Computing Technologies

We have listed all the technologies used in this section to facilitate the extension of StreamingChain and enable replication of the results presented in other studies. The project's implementation, testing, and computational experiment phases were executed using a sequence of programming languages and technologies, each serving a specific purpose in developing the proposed solution. The primary language was JavaScript ([[https://tc39.es/ecma402/--version](https://tc39.es/ecma402/--version)]([https://tc39.es/ecma402/--version](https://tc39.es/ecma402/--version)) ECMA402), used for both front-end and back-end development, followed by TypeScript ([[https://www.typescriptlang.org/docs/--version](https://www.typescriptlang.org/docs/--version)]([https://www.typescriptlang.org/docs/--version](https://www.typescriptlang.org/docs/--version)) 4.9.3), which was exclusively adopted to provide static typing and enhance code security and scalability. Node.js ([[https://nodejs.org/docs/latest/api/--version](https://nodejs.org/docs/latest/api/--version)]([https://nodejs.org/docs/latest/api/--version](https://nodejs.org/docs/latest/api/--version)) 16.4.2) was then utilized to execute back-end code outside of the browser, and React.js ([[https://react.dev/learn--version](https://react.dev/learn--version)]([https://react.dev/learn--version](https://react.dev/learn--version)) 18.1.0), a JavaScript library, was used to develop graphical user interfaces. Knex ([[https://knexjs.org/--version](https://knexjs.org/--version)]([https://knexjs.org/--version](https://knexjs.org/--version)) 2.0.0) was chosen as a tool for building SQL queries, and Postgresql ([[https://www.postgresql.org/--version](https://www.postgresql.org/--version)]([https://www.postgresql.org/--version](https://www.postgresql.org/--version)) 15.0) was adopted as the relational database management system. The smart contracts were built using Solidity ([[https://docs.solidity.org/en/v0.8.13/--version](https://docs.solidity.org/en/v0.8.13/--version)]([https://docs.solidity.org/en/v0.8.13/--version](https://docs.solidity.org/en/v0.8.13/--version)) 0.8.13), while Jest (https://jest-archive-august-20 23.netlify.app/docs/29.1/getting-started/--version 29.1.1) facilitated the execution of unit tests.