Ka ekonoming ya tlhokomelo (Web 2.0), badiriši ba "kgoromeletšwa" go lefa dipeeletšo go fihlelela dikagare tše di kgethegilego (mehuta ka moka ya diteng, go akaretšwa dikagare tša batho ba bagolo), eupša ga go selo seo se netefatšago gore o hwetša mehola yeo o e lefago, e ka ba ka lebaka la gore diteng mmopi ga a tšwele pele go hlama dilo tše mpsha goba o swanetše go ingwadišetša nako ye telele ge o nyaka go lefa fela seo o se jago.
Le ge go le bjalo, Web 3.0, ekonomi ya maikemišetšo, e tliša sebaka sa gore badiriši ba lefe fela seo ba se jago, go e na le ka nako ye telele, ka ditefelo tše nnyane. Ka lehlakoreng le lengwe, e hlohleletša bahlami ba diteng go dula ba mpshafaditšwe ka tlholo ye ntši, ba amogela letseno la bona ka pela, ka ditshenyagalelo tša fase kudu, ntle le go ithekga ka dikgoro tše di tsentšwego bogareng.
Monetizado ke sethaleng sa go lefa ka ketane seo se go dumelelago go dira tšhelete ka letlakala lefe goba lefe la wepe le dikagare tše di sa fetogego (ge e ba o se na phihlelelo go backend go dira diphetogo) ka Web3.
O ka phethagatša Monetizado mafelong a ditaba, dinetweke tša leago, di-portal tša dikagare tše di kgethegilego, le tše dingwe. O ka e šomiša gape go hlohleletša badiriši go lefa le go se bone dipapatšo mafelong a gago.
Monetizado e go dumelela go:
O ka šomiša monetized go šireletša matlakala gore ke fela baabi bao ba ka e bonago, bjalo ka go:
Go aga sefala se, re ile ra diriša:
Konteraka ya rena ye bohlale ke ya motheo kudu, e go dumelela go laetša leina la dikagare tšeo di swanetšego go dirwa tšhelete, tšhelete (ka rBTC), le mešomo ye mmalwa ya go kgontšha/go šitiša dikagare, le go lefa le go amogela ditefelo, gare ga tše dingwe.
MonetizadoBokgobapuku.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library MonetizadoLibrary { struct ProtectedContent { string name; uint256 accessCost; bool isProtected; uint256 sequenceId; address creator; uint256 amountAvailable; uint256 amountCollected; mapping(address => Subscriber) subscribers; } struct Subscriber { bool paid; uint256 amount; } }
Monetizadov1.sol ya tšhelete
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./MonetizadoLibrary.sol"; contract Monetizadov1 { // Struct with info about the protected content (for paying to access) struct ProtectedContentInfo { string name; uint256 accessCost; bool isProtected; uint256 sequenceId; address creator; uint256 amountAvailable; uint256 amountCollected; } mapping(address => bool) private creators; mapping(address => bool) public hosting; mapping(address => MonetizadoLibrary.ProtectedContent[]) private paginasProtegidas; event GrantedAccess(address usuario, address creator, uint256 sequenceId); address private _owner; uint256 private _platformFeePercentage; uint256 private _platformBalance; modifier onlyOwner() { require(msg.sender == _owner, "Only the owner can call this function"); _; } constructor() { _owner = msg.sender; _platformFeePercentage = 0; _platformBalance = 0; } function addProtectedContent(string memory name, uint256 accessCost) public returns (uint256) { uint256 cantidadPaginasCreador = paginasProtegidas[msg.sender].length; MonetizadoLibrary.ProtectedContent[] storage paginas = paginasProtegidas[msg.sender]; MonetizadoLibrary.ProtectedContent storage pagina = paginas.push(); pagina.name = name; pagina.accessCost = accessCost; pagina.isProtected = true; pagina.sequenceId = cantidadPaginasCreador; pagina.creator = msg.sender; pagina.amountCollected = 0; pagina.amountAvailable = 0; creators[msg.sender] = true; return cantidadPaginasCreador; } function getProtectedContentsForCurrentUser() public view returns (ProtectedContentInfo[] memory) { uint256 cantidadPaginasPorCreador = paginasProtegidas[msg.sender].length; ProtectedContentInfo[] memory paginas = new ProtectedContentInfo[](cantidadPaginasPorCreador); for (uint256 i = 0; i < cantidadPaginasPorCreador; i++) { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[msg.sender][i]; paginas[i] = ProtectedContentInfo(pagina.name, pagina.accessCost, pagina.isProtected, pagina.sequenceId, pagina.creator, pagina.amountAvailable, pagina.amountCollected); } return paginas; } function getProtectedContentByAddressAndId(address creator, uint256 sequenceId) public view returns (ProtectedContentInfo memory) { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[creator][sequenceId]; ProtectedContentInfo memory paginas = ProtectedContentInfo(pagina.name, pagina.accessCost, pagina.isProtected, pagina.sequenceId, pagina.creator, pagina.amountAvailable, pagina.amountCollected); return paginas; } function payAccess(address creator, uint256 sequenceId) external payable { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[creator][sequenceId]; require(msg.value == pagina.accessCost, "Incorrect payment amount"); require(pagina.isProtected == true, "The page is not protected and you do not need to pay access"); MonetizadoLibrary.Subscriber storage subscriber = pagina.subscribers[msg.sender]; subscriber.paid = true; subscriber.amount = msg.value; pagina.amountCollected += msg.value; pagina.amountAvailable += msg.value; emit GrantedAccess(msg.sender, creator, sequenceId); } function currentUserHasAccess(address creator, uint256 sequenceId) public view returns(bool) { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[creator][sequenceId]; return pagina.subscribers[msg.sender].paid; } function changeAccessCost(uint256 sequenceId, uint256 newCost) external { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[msg.sender][sequenceId]; pagina.accessCost = newCost; } function unprotectContent(uint256 sequenceId) external { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[msg.sender][sequenceId]; pagina.isProtected = false; } function protectContent(uint256 sequenceId) external { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[msg.sender][sequenceId]; pagina.isProtected = true; } function changePlatformFee(uint256 feePlatform) external onlyOwner { require(feePlatform <= 100, "The fee should be between 0.01 to 1% (1 - 100 in a 10000 scale)"); _platformFeePercentage = feePlatform; } function withdrawMoneyFromContent(uint256 sequenceId,uint256 amount) external { MonetizadoLibrary.ProtectedContent storage pagina = paginasProtegidas[msg.sender][sequenceId]; require(pagina.amountAvailable >= amount, "Insufficient balance"); uint256 amountForPlatform = amount * _platformFeePercentage / 10000; _platformBalance += amountForPlatform; payable(_owner).transfer(amountForPlatform); payable(msg.sender).transfer(amount - amountForPlatform); pagina.amountAvailable -= amount; } function getPlatformFee() public view returns(uint256) { return _platformFeePercentage; } function getPlatformBalance() public view returns(uint256) { return _platformBalance; } function withdrawMoneyPlatform(uint256 amount) external onlyOwner { require(_platformBalance >= amount, "Insufficient balance"); payable(msg.sender).transfer(amount); _platformBalance -= amount; } }
Go tlaleletša, re hlotše SDK ya Javascript yeo e dumelelago tšhomišo ya konteraka ye bohlale go ralala le diwepesaete, kudukudu go badiriši bao ba nyakago go lefa go fihlelela diteng tše itšego.
<script src="https://cdn.jsdelivr.net/npm/web3@latest/dist/web3.min.js"></script> <script src="https://cdn.ethers.io/lib/ethers-5.2.umd.min.js" type="application/javascript"></script>
<script src="./monetizado.js"></script>
Oketša tag ya kgokagano hlogong ya khoutu ya HTML ya letlakala la gago, ka seka sa "rel" ka boleng bja "monetized" gomme ka href e latela sebopego se se latelago:
Mohlala:
<link rel="monetizado" href="rootstock:testnet://0xda3ec0b8bddd2e8bdedede3333fbaf938fcc18c5/0" />
Mohlala wa peleng o bolela gore dikagare di šireleditšwe (ka Id 0), ke mmopi (0xda3ec0b8bddd2e8bdedede3333fbaf938fcc18c5 mohlala), le gore motswako ke tefo yeo e swanetšego go dirwa go e notlolla.
Protšeke ye e šetše e tsentšwe go Rootstock testnet, gomme o ka hlahloba dikgokagano tše di fapafapanego ka mo tlase, go akaretšwa mafelo a polokelo le demo:
Ka go lebanya bakeng sa kgopolo ye, re ipeela tlhohlo ya go kgona go dira tšhelete ka diforamo tša Web 2.0 re diriša Web3, ntle le khuetšo e kgolo go bobedi mmopi wa diteng le modiriši.
Ka fao, re ile ra swanelwa ke go hlama SDK ka Javascript yeo e bego e tla dumelela go dira tšhelete ka dikagare ka diphetogo tše mmalwa go weposaete, ka ge go na le kgonagalo ye kgolo ya gore bontši bja bahlami ba diteng ba be ba tla ba le mathata a go rulaganya diwepesaete tša bona (goba ba šomiša diforamo tša ka ntle moo ba se nago sekgoba se segolo go rulaganya).
Ka tharollo yeo, ka morago re ile ra swanelwa ke go bona kamoo re ka hlaolago diteng tšeo di bego di dirwa tšhelete, gomme moo re ile ra diriša mohola wa leswao la kgokagano ya HTML go laetša diteng tšeo, gomme SDK e be e tla lemoga tšhelete yeo ka rBTC, ge e ba mosediriši a šetše a lefile gomme o be a na le phihlelelo, goba a swanelwa ke go lefa.
Rootstock e emela monyetla o mogolo ka go BitcoinFi, e diriša bokgoni bja yona le go tia bjalo ka netweke yeo e arotšwego. Ka seemo se, go dira ditefelo tše nnyane le go e kgokaganya le ekonomi ya tlholo.
Mohlala wo, Monetized, o bontšha go ba bonolo ga go šomiša Web3 go diforamo tša Web2, moo go nago le sekgoba se segolo sa mehuta ka moka ya badiriši, go fokotša kgohlano go kopanya theknolotši ye.