paint-brush
Tsela ya go Aga Protocol ya go Lefa ka go Lefa ka Ketane go Rootstockka@nescampos
376 dipuku tša go balwa
376 dipuku tša go balwa

Tsela ya go Aga Protocol ya go Lefa ka go Lefa ka Ketane go Rootstock

ka Néstor Campos9m2024/11/30
Read on Terminal Reader

Nako e telele kudu; Go bala

Monetizado ke ka ketane lefa-ka-pono protocol. E go dumelela go dira tšhelete ka letlakala lefe goba lefe la wepe le diteng tše di sa fetogego ka Web3.0. E ka šomišwa go šireletša matlakala gore ke fela bao ba ngwadišitšego bao ba ka e bonago.
featured image - Tsela ya go Aga Protocol ya go Lefa ka go Lefa ka Ketane go Rootstock
Néstor Campos HackerNoon profile picture

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, Protocol ya go Lefa ka Ketane

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.

Dibopego

Monetizado e go dumelela go:

  • Laetša diteng tše di šireleditšwego ka tšhelete ye e itšego yeo badiriši ba swanetšego go e lefa go fihlelela.
  • Boeletša diteng tše di šireleditšwego tšeo o di hlotšego.
  • Go balatedi/badiriši ba gago, lefa go bona diteng tša gago.
  • Lekola ge eba modiriši a na le phihlelelo go diteng tša gago.
  • Fetoša ditshenyagalelo tša phihlelelo ya diteng ge go nyakega.
  • Unprotect diteng (ge o nyaka go di lokolla go bohle ka nako ye nngwe).
  • Goga tšhelete yeo e kgobokeditšwego bakeng sa diteng tša gago.

Diriša Taba

O ka šomiša monetized go šireletša matlakala gore ke fela baabi bao ba ka e bonago, bjalo ka go:

  • Dikgoro tša ditaba.
  • Dibidio.
  • Di-audio.
  • Difaele
  • Diboloko.
  • Dinetweke tša leago.
  • Le tše dingwe tše dintši.

Mokgobo wa Tlhabollo

Go aga sefala se, re ile ra diriša:


  • Solidity, bakeng sa konteraka bohlale
  • Remix, go tsenya tirišong konteraka ye bohlale
  • Rootstock testnet , e le marangrang bakeng sa porojeke e ne
  • Javascript, go hlama SDK le go kopanya le diwepesaete.


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.

Tsela ya go Diriša

  1. Letlakaleng leo o nyakago go dira tšhelete, tsenya Web3.JS le Ethers.JS. O ka e dira go tšwa go CDN, mohlala:
 <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>


  1. Download le go tsenya tšhelete monetizadov1.js
 <script src="./monetizado.js"></script>
  1. Hlama diteng tše di šireleditšwego o šomiša konteraka ye bohlale goba ka go Molaodi .


  2. 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:


  • netweke: Ke netweke moo diteng di šireleditšwego.


  • creator_address: Ke aterese (0x..) ya mmopi wa dikagare. E ka ba aterese ya gago ge e ba o le mmopi.


  • sequence_id: Ke ID yeo konteraka e ilego ya fedišwa ge o be o laetša diteng tše mpsha tše di šireleditšwego (e thoma go tloga go 0 go ya pele, ke ya dipalo).


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.


  1. Diriša thepa ya window.monetizado ( ditaelo mo ).


Go Sepela ga Protšeke

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:

  1. Ditaelo tša konteraka ya bohlale: https://github.com/Monetizado/Dikonteraka
  2. SDK ya Javascript: . https://github.com/Monetizado/monetizadojs ya go dira tšhelete
  3. Monetizado Proxy SDK (go dumelela go dira tšhelete ka matlakala a feletšego ka go šomiša letlakala la magareng go lefa le go netefatša): https://github.com/Monetizado/moemedi wa tšhelete
  4. Molaodi wa Monetizado (go laola dikagare tša gago, go kgoboketša tšhelete, le tše dingwe ntle le go dirišana le konteraka ye bohlale): https://monetizado.github.io/molaodi/ .
  5. Demo ka Rootstock: . <https://monetizado.github.io/demosmonetizado/demo_modu.html ] (https://monetizado.github.io/demosmonetizado/demo_modu.html)
  6. Demo ya bidio:


Ditlhohlo le Ditharollo

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.

Mafetšo

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.


L O A D I N G
. . . comments & more!

About Author

Néstor Campos HackerNoon profile picture
Néstor Campos@nescampos
I am a computer engineer and entrepreneur working with Web3 technologies.

HANG TAGS YA GO FEGA

ARTICLE YE E HLAHILWE KA...