<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ethan Rouimi on Medium]]></title>
        <description><![CDATA[Stories by Ethan Rouimi on Medium]]></description>
        <link>https://medium.com/@ethan-rouimi?source=rss-30495c549669------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TL8DSD566EW3HBG1dMOgsQ.jpeg</url>
            <title>Stories by Ethan Rouimi on Medium</title>
            <link>https://medium.com/@ethan-rouimi?source=rss-30495c549669------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:25:10 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ethan-rouimi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Paypal USD et les horreurs des CBDCs]]></title>
            <link>https://medium.com/@ethan-rouimi/paypal-usd-et-les-horreurs-des-cbdcs-861f2339304b?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/861f2339304b</guid>
            <category><![CDATA[french]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[stablecoin-cryptocurrency]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Fri, 08 Sep 2023 13:02:02 GMT</pubDate>
            <atom:updated>2023-09-08T13:02:02.523Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uxKjbmrvkB5nayqQ" /><figcaption>Photo by <a href="https://unsplash.com/@tabrez_syed?utm_source=medium&amp;utm_medium=referral">Tabrez Syed</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Depuis l’existence de la monnaie, les banques ont fourni des services et émis des représentations de valeur. Elles ont commencé par garder de l’or et donner en échange un IOU (I owe you), un papier représentant l’équivalent du montant de l’or déposé. La plupart du temps, les gens faisaient confiance aux banques et utilisaient leurs IOUs comme moyen d’échange, mais parfois, un banquier malhonnête émettait des faux IOUs sans prévoir réserve. Quand les gens essayaient de récupérer leur or, la banque n’en avait pas, entraînant une crise financière et une perte de confiance dans l’argent. Cela pouvait régresser des décennies, voire des siècles, de progrès financier. Lorsque les gens cessent de croire en l’argent, ils n’échangent pas, sans échanges, les sociétés ne progressent pas, et sans progrès, les empires s’effondrent.</p><p>L’Empire romain d’Occident est tombé environ 100 à 150 ans après que les gens ont commencé à rogner les pièces pour en créer de nouvelles. Le Venezuela est passé d’être l’un des pays les plus riches du monde à l’un des plus pauvres après dix ans de politique monétaire qui a dévalué sa monnaie.</p><p>Cependant, chaque fois que les gens ne pouvaient pas récupérer leur or, ils surmontaient le problème. Les banquiers étaient traduits en justice et remplacés par des personnes dignes de confiance. Il y a toujours eu un mécanisme pour rendre les systèmes justes. Cependant, avec la fin de l’étalon-or et la digitalisation de l’argent, notre perception de l’argent est devenue plus abstraite. Nous nous dirigeons vers une ère complètement numérique, et quand ce sera le cas, comment saurons-nous que notre argent a de la valeur? Comment saurons-nous que cette banque ou ce gouvernement ne joue pas avec notre argent? Après tout, il y a la <a href="https://fr.wikipedia.org/wiki/Loi_d&#39;airain_de_l&#39;oligarchie"><em>Loi de fer</em></a>.</p><p>Le premier signe de nombreux désastres économiques est lorsque quelques individus contrôlent le flux ou la production d’argent. Ils établissent des politiques qui les avantagent au détriment du peuple. Le principal problème est la confiance. Vous devez faire confiance à ceux qui gèrent la monnaie. Et si nous pouvions avoir un système où nous n’avions pas besoin de faire confiance à quelqu’un?</p><p>C’est le monde que les cryptomonnaies pourraient apporter; une preuve vérifiable des fonds. Nous n’aurions plus besoin de faire confiance aux institutions financières. J’aime ce que dit Sergey Nazarov, fondateur de Chainlink. Il parle toujours de preuves cryptographiques vérifiables, cette preuve est presque impossible à falsifier, il serait plus facile d’effectuer l’action de manière légitime que de la falsifier. Si cette idée est mise en œuvre, elle pourrait injecter des milliards dans l’écosystème et prévenir des milliers d’escroqueries. Bien que cet avenir soit proche, il doit encore être accepté et certaines personnes n’ont pas encore adhéré à cette vision. Elles poussent les entreprises à créer des services centralisés que peu de personnes peuvent contrôler.</p><h3>CBDCs et stablecoins centralisés</h3><p>Le concept de CBDC (Monnaie Digitale de Banque Centrale) a été proposé il y a peu de temps. Il y a de nombreuses propositions aux États-Unis et dans l’UE, et certains, comme la Chine avec son yuan numérique, sont déjà en train de le mettre en œuvre. C’est une idée brillante et la prochaine étape pour l’humanité. L’argent programmable peut offrir de nombreux avantages: simplifier les abonnements, les salaires automatisés, etc. Réduire notre dépendance envers les banques et leurs services. C’est ce qu’Ethereum propose et offre: une communauté open-source où les gens décident. Ce n’est pas ce que proposent les banques centrales avec des systèmes fermés où seul le banquier central peut approuver les transactions. Et ils peuvent bloquer des individus s’ils le souhaitent.</p><p>Certains voient le potentiel de danger que cela pourrait causer dans des pays comme la Chine avec son système de Crédit Social et son système de camera avancé avec reconnaissance faciale. Avoir un contrôle total sur le système monétaire avec de l’argent programmable est une combinaison dangereuse.</p><p>Vous pourriez être un journaliste qui publie quelque chose que le Parti communiste chinois n’aime pas, et le lendemain, votre crédit social est si bas que vous ne pouvez pas utiliser les transports publics ou faire des transactions avec vos yuans. Pour ne pas avoir été “loyal” à la République Populaire, ils redistribuent ces fonds à des “causes méritantes”.</p><p>Prenons l’exemple d’une stablecoin terrible pour un système décentralisé. Examinons le contrat intelligent de PaypalUSD. Le code est <a href="https://etherscan.io/token/0x6c3ea9036406852006290770bedfcaba0e23a0e8#code">ici</a> si vous voulez vérifier par vous-même.</p><p>Tout d’abord, nous voyons qu’il s’agit d’un contrat proxy, ce qui est bien. C’est une bonne pratique en cas de bug dans le code, on peux changer l’adresse d’implémentation pour une autre, pour changer le code qui s’exécute, tant que vous faites confiance à l’administrateur, car il pourrait changer le code pour ce qu’il veut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*s6ead16zjhmf5g_3ABoo_Q.png" /><figcaption>fonctions pour changer límplementation</figcaption></figure><p>Dans le cas de PaypalUSD, l’administrateur est un portefeuille multi-signatures avec six propriétaires et le seuil de trois signatures est nécessaire pour approuver les transactions. C’est relativement centralisé, mais poursuivons.</p><p>La deuxième alarme est qu’il utilise une ancienne version de Solidity. De nombreux bugs ont été corrigés dans les versions plus récentes de Solidity, et ce contrat pourrait être vulnérable. Voici la liste des <a href="https://docs.soliditylang.org/en/v0.8.21/bugs.html">bugs</a>.</p><p>Parlons de l’administration des fonds. J’ai trouvé cette fonction <strong><em>reclaimPYUSD</em></strong> qui permet au propriétaire du contrat de transférer le solde de PYUSD du contrat à son adresse :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*wK_-ATUjZeAoGjtkdcgTVw.png" /><figcaption>fonction reclaimPYUSD</figcaption></figure><p>Pas très bien.</p><p>Il y a aussi une fonction qui augmente l’offre totale et l’envoie au <strong><em>SupplyControler</em></strong> :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*7SP6RfGI_AhdZRRNCQ5jig.png" /><figcaption>fonction pur augmenter l’offre de PYUSD</figcaption></figure><p>Nous ne savons pas qui est cette entité. Je pense qu’il devrait s’agir d’un type de serveur ou de programme qui crée automatiquement l’offre pour la donner à une personne, s’il a créé le jeton dans l’application PayPal, mais pourquoi ne pas avoir un second paramètre, une adresse, pour envoyer les jetons directement ? Cela semble étrange.</p><p>Deux fonctions qui pourraient être controversées sont les fonctions <strong><em>freeze</em></strong> et <strong><em>wipeFrozenAddress</em></strong>. Elles font ce que vous pensez qu’elles feraient : elle gèle un compte empêchant toute transaction, et l’adresse ne peut ni envoyer ni recevoir de jetons PYUSD et efface les jetons d’une adresse. Ceci peut être utile si, par exemple, il y a une attaque et des millions de PYUSD sont volés ; ils peuvent geler les comptes des attaquants. Mais nous parlons de PayPal, une entreprise qui a bloqué de nombreuses personnes sans aucune activité suspecte ou pour avoir des opinions politiques différentes. Nous devrons voir comment ils gèrent ce jeton.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*pRBCtTCjTb-eJS5SMtCZBg.png" /><figcaption>fonctions freeze et wipeFrozenAddress</figcaption></figure><p>Mais pour être honnête, ces fonctions sont également présentes dans d’autres stablecoins comme USDC pour se conformer à la réglementation. C’est l’une des raisons pour lesquelles je ne suis pas très fan des solutions centralisées. Ces types de services devraient être sans permission pour que tout le monde puisse les utiliser. Sinon, quelqu’un pourrait en abuser, restreignant d’autres des services. Si nous voulons un avenir prospère, nous devons collaborer avec tout le monde pour améliorer le monde.</p><p>Des solutions comme DAI avec MakerDAO sont un exemple parfait. N’importe qui peut émettre du DAI s’il a les fonds pour garantir ses positions. Une manière décentralisée de créer quelque chose sans avoir besoin de faire confiance, car tout le monde peut vérifier les fonds dans la blockchain.</p><p>J’espère que les institutions s’abstiendront de pousser pour les CBDC. Elles peuvent causer plus de tort que de bien entre de mauvaises mains. Voler le droit à la vie privée pourrait signifier prendre vos économies. Si vous ne pensez pas que votre gouvernement pourrait changer le système pour avoir plus de contrôle sur votre argent, réfléchissez encore : en 2008 en Grèce, les gens ordinaires ne pouvaient retirer plus de 60 euros par jour, 420 euros par semaine, une mesure imposée par le gouvernement grec pour “empêcher les banques de s’effondrer”.</p><p>Espérons un meilleur avenir où les technologies décentralisées et sans permission sont la norme, un monde où les gens décident. Ces technologies peuvent apporter la démocratie et redonner le pouvoir à chacun d’entre nous, construisons cet avenir.</p><p>Merci à tous ceux qui ont lu cet article. Je vous invite à jeter un coup d’œil à mes autres articles pour en savoir plus sur les tenants et aboutissants d’Ethereum et des protocoles.</p><p>Si vous souhaitez me contacter, vous pouvez le faire à cette adresse e-mail : <a href="/service/mailto:contact@ethan-rouimi.com">contact@ethan-rouimi.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=861f2339304b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paypal USD y los horrores de las CBDCs]]></title>
            <link>https://medium.com/@ethan-rouimi/paypal-usd-y-los-horrores-de-las-cbdcs-f180fb38c3c2?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/f180fb38c3c2</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[paypal]]></category>
            <category><![CDATA[español]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 17:49:07 GMT</pubDate>
            <atom:updated>2023-08-30T18:06:22.628Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bOiJRwfiAWV35lRcqleH7A@2x.jpeg" /><figcaption>Photo by Mika Baumeister on Unsplash</figcaption></figure><p>Desde la existencia del dinero, los bancos han ofrecido servicios y emitido representaciones de valor. Empezaron guardando oro y entregando un IOU (I owe you), un papel que representaba en una relación 1 a 1 con el oro depositado. La mayoría de las veces, la gente confiaba en los bancos y usaban sus IOUs como medio de cambio, pero en ocasiones, algún banquero fraudulento emitía IOUs sin respaldo. Cuando la gente intentaba recuperar su oro, el banco no lo tenía, lo que desencadenaba una crisis financiera y una pérdida de confianza en el dinero. Esto podía llevar a retroceder décadas o incluso siglos en cuanto a progreso financiero. Cuando la gente deja de confiar en el dinero, no comercia, sin comercio, las sociedades no avanzan, y sin progreso, los imperios caen.</p><p>El Imperio Romano de Occidente cayó unos 100–150 años después de que la gente comenzó a recortar el borde de las monedas para hacer monedas nuevas. Venezuela pasó de ser uno de los países más ricos del mundo a uno de los más pobres después de diez años de una política monetaria que dejó su moneda sin valor.</p><p>Sin embargo, siempre que la gente no pudo recuperar su oro, lo superó. Los banqueros eran llevados a juicio y reemplazados por personas de confianza. Siempre ha habido un mecanismo para mantener los sistemas justos. Sin embargo, con la eliminación del patrón oro y la digitalización del dinero, nuestra percepción del dinero se ha vuelto más abstracta. Estamos dirigiéndonos hacia una era completamente digital, y cuando llegue, ¿cómo sabremos que nuestro dinero tiene valor? ¿Cómo sabremos que este banco o gobierno no está jugando con nuestro dinero? Después de todo, está la <a href="https://es.wikipedia.org/wiki/Ley_de_hierro_de_la_oligarqu%C3%ADa"><em>Ley de hierro</em></a>.</p><p>El primer indicador de muchos desastres económicos es cuando unas pocas personas controlan el flujo o la producción de dinero. Establecen políticas que les benefician a expensas del pueblo. El problema principal es la confianza. Necesitas confiar en quienes manejan la moneda. ¿Qué pasaría si pudiéramos tener un sistema donde no tuviéramos que confiar en nadie?</p><p>Ese es el mundo que las criptomonedas podrían traer; una prueba verificable de fondos. Ya no necesitaríamos confiar en instituciones financieras. Me gusta lo que dice Sergey Nazarov, fundador de Chainlink. Siempre habla de pruebas criptográficas verificables, sistemas casi imposibles de falsificar. Si esta idea se lleva a cabo, podría atraer miles de millones en el ecosistema y prevenir miles de estafas. Aunque este futuro está cerca, aún tiene que ser aceptado, y algunas personas todavía no han comprado esta visión. Obliga a las empresas a crear servicios centralizados que pocas personas pueden controlar.</p><h3>CBDCs y stablecoins centralizados</h3><p>El concepto de CBDC (Moneda Digital de Banco Central) fue propuesto hace poco. Hay muchas propuestas en lugares como EE.UU. y la UE, y algunos ya lo están implementando, como el yuan digital en China. Es una idea brillante y el siguiente paso para la humanidad. El dinero programable puede tener muchos beneficios: facilitar suscripciones, nóminas automatizadas, etc. Reducir nuestra dependencia de los bancos y sus servicios. Es lo que Ethereum propone y ofrece: una comunidad de código abierto donde la gente decide. No es lo que proponen los bancos centrales con sistemas cerrados donde solo el banco central puede aprobar transacciones. Y pueden bloquear personas si lo desean.</p><p>Algunos ven el potencial daño que esto podría causar en países como China con su sistema de Crédito Social y su avanzado sistema de cámaras de reconocimiento facial. Combinar control total sobre el sistema monetario con dinero programable es una combinación peligrosa.</p><p>Puedes ser un periodista que haya publicado algo que al Partido Comunista Chino no le agrada, y al día siguiente, tu crédito social es tan bajo que no puedes usar el transporte público o hacer transacciones con tus Yuanes. Por no haber sido “leal” a la República Popular, redistribuyen esos fondos a “causas dignas”.</p><p>Consideremos un ejemplo de una stablecoin terrible para un sistema descentralizado. Examinemos el contrato inteligente de PaypalUSD. El código está en este <a href="https://etherscan.io/token/0x6c3ea9036406852006290770bedfcaba0e23a0e8#code">enlace</a> por si quieres verificarlo tú mismo.</p><p>Primero, vemos que es un contrato proxy, lo cual está bien. Es una buena práctica por si hay un error en tu código, puedes cambiar la dirección de implementación a otro, para cambiar el código que se ejecuta, siempre y cuando confíes en el administrador, ya que podrían cambiar el código al que quieran.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*s6ead16zjhmf5g_3ABoo_Q.png" /><figcaption>funciones para cambiar la implementación</figcaption></figure><p>En el caso de PaypalUSD, el administrador es una billetera multi-firma con seis dueños y se necesita el umbral de tres firmas para aprobar transacciones. Es bastante centralizado, pero sigamos.</p><p>La segunda señal de alarma es que usa una versión antigua de Solidity. Se han corregido muchos errores en las versiones más recientes de Solidity, y este contrato podría ser vulnerable. Aquí está la <a href="https://docs.soliditylang.org/en/v0.8.21/bugs.html">lista de errores</a>.</p><p>Hablemos de la gestión de fondos. Encontré esta función <strong><em>reclaimPYUSD</em></strong> que permite al dueño del contrato transferir el saldo de PYUSD del contrato a su dirección:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*wK_-ATUjZeAoGjtkdcgTVw.png" /><figcaption>función reclaimPYUSD</figcaption></figure><p>No me gusta esto.</p><p>También hay una función que incrementa el suministro total y lo envía al <strong><em>SupplyControler</em></strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*7SP6RfGI_AhdZRRNCQ5jig.png" /><figcaption>función para crear más suministro de tokens</figcaption></figure><p>No sabemos quién es este ente. Supongo que es algún tipo de servidor o programa que automáticamente genera suministro para entregárselo a alguien que haya creado el token en la aplicación de PayPal, pero ¿por qué no tener un segundo parámetro, una dirección, para enviar los tokens directamente? Es sospechoso.</p><p>Dos funciones que pueden ser polémicas son <strong><em>freeze</em></strong> y <strong><em>wipeFrozenAddress</em></strong>. La primera congela una cuenta impidiendo que realice transacciones, la dirección al ser ‘congelada’ no puede enviar, ni recibir tokens PYUSD. La segunda función elimina los tokens de una dirección congelada. Estas funciones pueden ser útiles, por ejemplo, si ocurre un ataque y se roban millones de PYUSD; podrían congelar las cuentas de los atacantes. Sin embargo, estamos hablando de PayPal, una corporación con numerosos casos de bloqueo a personas sin ninguna actividad sospechosa o por tener opiniones políticas diferentes. Habrá que ver cómo gestionan este token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*pRBCtTCjTb-eJS5SMtCZBg.png" /><figcaption>funciones freeze y wipeFrozenAddress</figcaption></figure><p>Pero para ser justos, estas funciones también están presentes en otras stablecoins como USDC para cumplir con las regulaciones. Es una de las razones por las que no me agradan mucho las soluciones centralizadas. Estos tipos de servicios deberían ser sin permisos para que cualquiera los use. Si no es así, alguien podría explotarlo, restringiendo a otros de los servicios. Si queremos un futuro próspero, debemos colaborar con todos para mejorar el mundo.</p><p>Soluciones como DAI con MakerDAO son un ejemplo perfecto. Cualquiera puede acuñar DAI si tiene los fondos para colateralizar sus posiciones. Una forma descentralizada de crear algo en lo que no hay necesidad de confiar, ya que todos pueden verificar los fondos en la cadena de bloques.</p><p>Espero que las instituciones se abstengan de impulsar las CBDCs. Estas pueden causar más daño que bien en manos equivocadas. Robar el derecho a la privacidad puede ser quitar tus derechos a los ahorros. Si piensas que tu gobierno no cambiaría el sistema para tener más control sobre tu dinero, piénsalo de nuevo: en 2008 en Grecia, la gente común no podía retirar más de 60 Euros al día, 420 Euros a la semana, una medida impuesta por el gobierno griego para “prevenir el colapso de los bancos”.</p><p>Esperemos un futuro mejor donde las tecnologías descentralizadas y sin permisos sean la norma, un mundo donde la gente decida. Estas tecnologías pueden traer democracia y devolver el poder a todos nosotros, construyamos ese futuro.</p><p>Gracias a todos los que han leído este artículo. Les invito a echar un vistazo a más de mis artículos para aprender más sobre los entresijos de Ethereum y sus protocolos.</p><p>Si desean ponerse en contacto conmigo, pueden hacerlo a través de este correo electrónico: <a href="/service/mailto:contact@ethan-rouimi.com">contact@ethan-rouimi.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f180fb38c3c2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Paypal USD and the horrors of CBDCs]]></title>
            <link>https://coinsbench.com/paypal-usd-and-the-horrors-of-cbdcs-2c3b86ed75a1?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c3b86ed75a1</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[stable-coin]]></category>
            <category><![CDATA[paypal]]></category>
            <category><![CDATA[stablecoin-cryptocurrency]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Tue, 29 Aug 2023 19:13:07 GMT</pubDate>
            <atom:updated>2023-09-02T11:16:59.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*s3sX-I3F6hVzVNBk" /><figcaption>Photo by <a href="https://unsplash.com/@etiennemartin?utm_source=medium&amp;utm_medium=referral">Etienne Martin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Since the dawn of times when money existed, banks offered their services and issued securities; they started by securing gold in banks and then giving you an IOU (I owe you) in your gold, a paper that acted as a 1-to-1 equivalent. Most of the time, people trusted banks; they did their work, and we started using their IOUs as a means of exchange, but sometimes, a corrupt banker would issue fake IOUs. People tried to take back their money; the bank ran out, creating a crisis where people didn’t trust money anymore, driving decades or centuries of progress behind. When people don’t trust money, people don’t trade, if people don’t trade, societies don’t progress, when societies don’t advance, Empires fall.</p><p>The Occidental Roman Empire collapsed around 100–150 years after people started to take metal from the borders of coins to make new ones. Venezuela was one of the wealthiest countries in the world after ten years of monetary policy that made their currency worthless and became one of the poorest.</p><p>But the thing is that people always recovered when people didn’t have their gold back. Individuals judged bankers, and bankers were replaced with trusted individuals; there has always been a natural mechanism to keep systems fair, but these mechanisms have been more and more challenging to implement. The detachment of the gold pattern and the digitalization of money made our concept of it more abstract. We are going to an era where everything will be digitalized, and when that time arrives, when will we know our money is worth something? How will we know this bank or government is not tricking us with our cash? After all, there’s the <a href="https://en.wikipedia.org/wiki/Iron_law_of_oligarchy"><em>Iron law</em></a>.</p><p>The first problem of various economic disasters is when a few people control the flow or the production of money. They make policies that benefit only themselves at the expense of the people, and the main problem is trust. You need to trust the individuals that administrate the currency. What if we can have a system without the need to trust anyone?</p><p>That’s the world that crypto can bring us; it can bring verifiable proof of funds to the table, and there would be no need to trust financial institutions anymore. I like the speech of Chainlink founder Sergey Nazarov. He is always talking about this idea of verifiable cryptographic proofs; if this concept is applied, it could bring billions to the ecosystem and prevent thousands of scams. Although this future is not far away, it has yet to arrive, and some people still need to embrace this vision. It is forcing enterprises and corporations to create centralized services that few people can control.</p><h3>CBDCs and centralized stablecoins</h3><p>CBDC’s (Central Bank Digital Currency) concept was conceived not long ago. There are many proposals in places like the United States and the EU, and some are making it mainstream, being already implemented in China with the digital Yuan. It is a good idea and the next step for humanity. Having programable money can bring multiple benefits easier for subscriptions, automated payrolls, etc. Reduce our dependence on Banks and their services. That’s the ecosystem Ethereum proposes and offers: an open-sourced democratic community where people decide. Not at all what Central Banks propose, closed-sourced systems where only the Central Bank can approve transactions. And block people if they like.</p><p>Some people can see the potential damage that can bring in countries like China with the Social Credit system and complex system of face recognition cameras. Adding total control to the monetary system with programable money makes a dangerous combination.</p><p>You may be a reporter and publish something that the CCP does not like, and the next day, you have such low Social Credit you can not use public transport nor make transactions with your yuans. Because you can not use those funds for not being “loyal” to the People’s Republic, they redistribute those funds for “worthy causes.”</p><p>Let’s see one example of a stablecoin horrible for a decentralized system. We are going to analyze the PaypalUSD Smart Contract. The code can be found at this <a href="https://etherscan.io/token/0x6c3ea9036406852006290770bedfcaba0e23a0e8#code">link</a> if you want to check it out yourself.</p><p>We first see that it is a proxy contract; this is okay. It is a good practice if your code has a bug; you can change the implementation address to another Smart Contract to path it. As long as the administrator is trustworthy as the administrator could change the code to whatever they want, in the case of the PaypalUSD Proxy, the administrator is a multi-sig wallet with six owners and a threshold of three signatures to approve transactions. It is pretty centralized, but let’s follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*s6ead16zjhmf5g_3ABoo_Q.png" /></figure><p>The second red flag is that the Solidity version is ancient; numerous known bugs were fixed in later versions of Solidity, and this contract can be affected. Here’s the list of known <a href="https://docs.soliditylang.org/en/v0.8.21/bugs.html">bugs</a>.</p><p>Let’s talk about fund administration. I found this function <strong><em>reclaimPYUSD</em></strong>, which lets the contract owner transfer the balance of PYUSD of the contract to his address:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*wK_-ATUjZeAoGjtkdcgTVw.png" /></figure><p>Not very good.</p><p>Also, there’s a function that increases the total supply and sends it to the <strong><em>SupplyControler</em></strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*7SP6RfGI_AhdZRRNCQ5jig.png" /></figure><p>We don’t know who is this entity. I think it should be a type of server or program that automatically creates the supply to give it to a person if they “minted” the token in the PayPal app, but why not have a second parameter, an address, to send the tokens directly? It seems strange.</p><p>Two functions standout, that can be controversial are the <strong><em>freeze </em></strong>and<strong><em> wipeFrozenAddress</em></strong> functions. It does what you would think it would: it freezes an account from making any transactions, and the address can not send nor receive any PYUSD tokens and wipes the tokens of an address. This one can be useful if, for example, there’s a hack and millions of PYUSD are stolen; they can freeze the accounts of the exploiters. But we are talking about PayPal, a corporation that has many cases of blocking people without any suspicious activity or for having different political views. We will need to see how they administrate the token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*pRBCtTCjTb-eJS5SMtCZBg.png" /><figcaption>Freeze and Wipe functions</figcaption></figure><p>But to be fair, these functions are also present in other stablecoins like USDC to comply with regulations. That’s one of the reasons I’m not too fond of centralized solutions. These types of services should be permissionless for anyone to use. If not, somebody can exploit it, restricting others from services. If we want a prosperous future, we must collaborate with everyone to improve the world.</p><p>Solutions like DAI with the MakerDAO is a perfect example. Anyone can mint DAI if they have the funds to collateralize their positions. A decentralized way to create something that there is no need to trust, as everyone can verify the funds in the blockchain.</p><p>I hope institutions refrain from pushing for CBDCs. These can bring more harm than good in the wrong hands. Stealing the right to privacy may be taking your rights to savings. If you do not think your government would change the system to have more control over your money, think again: in 2008 in Greece, ordinary people could not withdraw more than 60 Euros per day, 420 Euros a week, a measure imposed by the Greek government to “prevent banks from collapsing.”</p><p>Let’s hope for a better future where permissionless, decentralized technologies are the norm, one world where people decide. These technologies can bring democracy and bring back power to all of us, let’s build that future.</p><p>Thanks to everyone who has read this article. I invite you to glimpse more of my articles to learn more about the ins and outs of Ethereum and protocols.</p><p>If you would like to contact me, you can do so with this email: <strong>contact@ethan-rouimi.com</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c3b86ed75a1" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/paypal-usd-and-the-horrors-of-cbdcs-2c3b86ed75a1">Paypal USD and the horrors of CBDCs</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CCIP the Internet of Blockchains]]></title>
            <link>https://coinsbench.com/ccip-the-internet-of-blockchains-399f3bfa94ac?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/399f3bfa94ac</guid>
            <category><![CDATA[chain-link]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[evm]]></category>
            <category><![CDATA[solidity]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Sun, 23 Jul 2023 17:55:44 GMT</pubDate>
            <atom:updated>2023-08-11T15:33:37.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UupQK1HwWXqQ6jiVhWx2UQ.jpeg" /></figure><p>Developers have always wanted to communicate between chains, but the ways that these blockchains were created, this native implementation was not possible, having difficulties in communicating between nodes of different chains to coordinate them is a work of titans, and for that reason, we haven’t seen many solutions.</p><p>This has been a big problem for the last couple of years, developers and liquidity were restricted to one chain, and if they wanted to create the same protocol in another chain that talks with the original, they had to create a complicated in-house solution and have dedicated servers to track states in the contracts of the chains, this is not the best solution as is it there’s no consensus when building these types of systems, resulting in difficult auditing and possible distrust in the community for these centralized solutions.</p><p>Chainlink changed the game eliminating the need to create in-house solutions.</p><p>Three days ago, Chainlink released a new product that could revolutionize how we build web3 systems, the Cross Chain Interoperability Protocol (CCIP) lets you easily send data to another blockchain, and in a decentralized way with different safe mechanisms.</p><p>In this article, we will explore what CCIP brings to the table and how it works.</p><h3>CCIP What is it?</h3><p>You can think of CCIP as a Layer 0 blockchain, you have your typical L1 (Ethereum) and you have your L2 (Polygon) that is built on top of the L1, the L2s can talk to their respective “base” chain, so we can think of L0’s as a protocol that unifies other L1’s, a similar structure to Polkadot you have your side-chains and your “base” chain Polkadot that unifies them.</p><p>CCIP is a protocol that will try to bring us communications to all chains, approaching us more to the concept of the “omnichain”, for now, we have CCIP available in some EVM chains and their testnets but is not crazy to think in a couple of years with this protocol if someone sends funds to an address in the Bitcoin chain you could mint an NFT in Polygon in response.</p><h3>How does it work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7J5_-6lRgu225gf_bvl2VQ.png" /></figure><p>It Works with multiple components, one essential in each chain the Router, the purpose of the Router is to send the data to the OnRamp contract that sends data to CCIP, then it arrives at the destination chain the transaction is received by the OffRamp, the path that the data transact Chainlink calls them “lanes”, these lanes are unidirectional if you are transacting in Ethereum, there’s a different lane for each chain, (Polygon, Sepolia, Polygon Mumbai,…) for instance;</p><p>Ethereum ⇒ Polygon, and Polygon ⇒ Ethereum, are two different lanes.</p><p>Then when CCIP receives the data, sends a transaction to the OffRamp contract and directs the data to its respective Router and the Router is responsible to transmit to the Recipient</p><p>All of these processes are secured by two systems;</p><ul><li>ARM network (Active Risk Management)</li><li>and the DON (Decentralized Oracle Network)</li></ul><h3>The ARM Network</h3><p>The Active Risk Management (ARM) network is built using off-chain and on-chain components:</p><ul><li><a href="https://docs.chain.link/ccip/concepts#off-chain-arm-node"><strong>Off-chain</strong></a><strong>:</strong> Several ARM nodes continually monitor all supported chains against abnormal activities</li><li><a href="https://docs.chain.link/ccip/concepts#on-chain-arm-contract"><strong>On-chain</strong></a><strong>:</strong> One ARM contract per supported CCIP chain</li></ul><h3>Off-chain (ARM node)</h3><p>The ARM network is a secondary validation service parallel to the primary CCIP system. It doesn’t run the same codebase as the <a href="https://docs.chain.link/ccip/concepts#decentralized-oracle-network-don">DON</a> to mitigate against security vulnerabilities that might affect the DON’s codebase. The ARM network has two main modes of operation:</p><ul><li><strong>Blessing:</strong> Each ARM node monitors all Merkle roots of messages committed on each destination chain. The Committing DON. The ARM node independently reconstructs the Merkle tree by fetching all messages on the source chain. It checks for a match between the tw,. If both Merkle roots match, the ARM node blesses the root to the ARM contract on the destination chain. The ARM contract tracks the votes. When a quorum is met, the ARM contract dubs the Merkle root <strong>blessed</strong>.</li><li><strong>Cursing:</strong> If an ARM node detects an anomaly, the ARM node will curse the CCIP system. The ARM contract dubs the CCIP system <strong>cursed</strong>. CCIP will automatically pause on that chain and wait until the contract owner assesses the situation before potentially lifting the curse. There are two cases where ARM nodes pause CCIP:</li><li><strong>Finality violation:</strong> A deep reorganization which violates the safety parameters set by the ARM configuration occurs on a CCIP chain.</li><li><strong>Execution safety violation:</strong> A message is executed on the destination chain without any matching transaction being on the source chain. Double executions fall into this category since the executing DON can only execute a message once.</li></ul><h3>On-chain (ARM contract)</h3><p>There is one ARM contract for each supported destination chain. The ARM contract maintains a group of nodes authorized to participate in the ARM blessing/cursing. Each ARM node has five components: an address for voting to curse, an address for voting to bless, an address for withdrawing a vote to curse, a curse weight, and a blessing weight. There are two different voting logics depending on the mode:</p><ul><li><strong>Blessing voting procedure:</strong> every time an ARM node blesses a Merkle root, the ARM contract adds the blessing weight for that node. If the sum exceeds the blessing threshold, the ARM contract considers the contract <em>blessed</em>.</li><li><strong>Cursing voting procedure:</strong> an ARM node that sends a vote to curse assigns the vote a random 32-byte ID. The node may have multiple active votes to curse at any time. However, if there is at least one active z ok cursing vote, the ARM contract considers the node to have voted to curse. The ARM contract adds the cursing weight for that node. If the sum of the weights of votes to curse exceeds the curse threshold, the ARM contract considers the contract <em>cursed</em>.</li></ul><h3>The DON</h3><p>The DON is a series o Chainlink nodes that run <a href="https://docs.chain.link/architecture-overview/off-chain-reporting">Chainlink OCR2</a>, a P2P network capable to aggregate data for reporting data off-chain.</p><p>The DON is built using off-chain components, the Committing and Executing DON, and each one has a different function, the Committing DON receives the transaction, it waits for finality in the source chain, when finality is reached it bundles the necessary data, and adds it to the Merkle Root of the contract Commit Store, then it comes to the Executing DON, it waits for an event in the OnRamp contract, it makes sure that the data was committed to Commit Store and wait for the blessing of ARM, if it’s all good, it would execute the necessary actions to trigger the Router in the destination chain, and we can receive the data we want and do whatever we want with it.</p><p>And with all that said,</p><h3>What can we do with it?</h3><ul><li>Native support for Cross-Chain Tokens and NFTs</li><li>Cross-Chain messaging to outsource cheaper execution of transactions</li><li>Liquidity efficiency, the movent of liquidity to other protocols in other chains for better yields</li><li>Simple and Efficient Cross-Chain applications</li><li>A new generation of dApps</li></ul><p>This is a true revolution that we are witnessing, intercommunication between chains was not thought possible without complex infrastructure, but now it’s within the reach of any developer with a simple interface, If you want to learn more, check out the <a href="https://docs.chain.link/ccip">official documentation</a></p><p>I hope that you’ve enjoyed this article about CCIP, in the coming days I will explore more this technology and make a series of technical implementations for any developer interested.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=399f3bfa94ac" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/ccip-the-internet-of-blockchains-399f3bfa94ac">CCIP the Internet of Blockchains</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Uniswap v4, What’s new?]]></title>
            <link>https://coinsbench.com/uniswap-whats-new-5e41307c97a2?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e41307c97a2</guid>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[uniswap-v4]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[uniswap]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Thu, 29 Jun 2023 11:08:43 GMT</pubDate>
            <atom:updated>2023-07-28T18:05:53.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YwKmtuNmHrw5FVVU" /><figcaption>Photo by <a href="https://unsplash.com/@hoffman11?utm_source=medium&amp;utm_medium=referral">Paul Bill</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article, we will delve into the highly anticipated update of Uniswap, the leading decentralized finance (DeFi) protocol on the Ethereum blockchain. 🦄 Uniswap v4, brings forth a range of significant changes that enhance customizability, gas efficiency, and overall user experience. With these updates, Uniswap continues to solidify its position as a trailblazer in the world of decentralized exchanges. Let’s explore the key features and improvements offered by Uniswap v4.</p><p>Let’s dive into what’s new in this update:</p><h4>Hooks:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*pEJCt-L4d30iJzSL" /><figcaption>Photo by <a href="https://unsplash.com/de/@polarmermaid?utm_source=medium&amp;utm_medium=referral">Anne Nygård</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Uniswap v4 introduces a powerful feature called “Hooks”, which is determined when creating a new pool. Hooks are externally deployed contracts that execute developer-defined logic at specific points in a pool’s execution, this implementation opens a world of unlimited possibilities, changing the pool’s fees in a moment of volatility or incentivizing the trade of the pair, and also gives the capabilities of limit orders on-chain, and independent custom oracles, and more. These are the current callbacks that are called in the hook contract:</p><ul><li>Before / After initialization of the pool</li><li>Before / After a change of position</li><li>Before / After a swap</li><li>Before / After a donate() (a new function, we will talk about this later)</li></ul><h4>Singleton Model:</h4><p>Uniswap v4 adopts a singleton model, meaning that all the logic of the protocol is within one smart contract, departing from the model v3 that worked with a factory model. It worked in the way that each time someone wanted to create a token pair, it had to create a separate smart contract. In this version, there’s no need! all LP’s balances are managed by a single contract, the Uniswap-v4 core contract. This architectural shift simplifies the process operations 💫 with multiple LPs and greatly helps in gas savings for developers and users.</p><h4>Flash Accounting: Efficient and Solvent Pools:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wlnH9WUYr3BhgpUj" /><figcaption>Photo by <a href="https://unsplash.com/@veato?utm_source=medium&amp;utm_medium=referral">Philip Veater</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Flash accounting is a critical feature introduced in Uniswap v4 that significantly enhances the efficiency and cost-effectiveness of pool operations. In previous versions of the Uniswap Protocol, each operation, such as swapping or adding liquidity 🌊 to a pool, involved the direct transfer of tokens. However, Uniswap v4 introduces a new approach called flash accounting, which revolutionizes the way these operations are handled.</p><p>In Uniswap v4, instead of immediately transferring tokens, each operation updates an internal net balance known as a delta. This means that during the operation, the tokens are not immediately moved between accounts. Instead, the changes are recorded in the internal balance of the pool. The actual token transfers only occur at the end of the operation, known as the lock. This unique approach ensures that no tokens are owed to the pool manager or the caller by the end of the transaction, thus enforcing the pool’s solvency.</p><p>Flash accounting simplifies complex pool operations, including atomic swapping and adding liquidity 💰. By deferring the actual token transfers until the end of the operation, the protocol reduces the number of external transactions required, resulting in improved efficiency and reduced gas costs. This is particularly advantageous when combined with the singleton design pattern, which manages all pools with a single contract.</p><p>It is important to note that while flash accounting brings significant benefits, there are certain considerations. In the current execution environment, flash accounting can be costly due to the requirement of storage updates at every balance change. 🔒⚙️ Although the contract ensures that internal accounting data is not serialized to storage, users may still incur these costs once the storage refund cap is exceeded. However, in balancing this trade-off, Uniswap v4 leverages transient storage, as specified by EIP-1153 (which refunds the gas if storage slots are set to their original value before the end of the transaction), to implement efficient accounting for balances, ensuring that the balances are set to zero by the end of the transaction.</p><h4>Native ETH Support:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9T1fLckVOLIpSPZG" /><figcaption>Photo by <a href="https://unsplash.com/ko/@michael_f?utm_source=medium&amp;utm_medium=referral">Michael Förtsch</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Uniswap v4 goes to it’s roots! 🌱 bringing back support of Native Ether in its pairs, unlike v1 which supported only native Ether, and v2 which supported exclusively wrapped Ether. This version facilitates the option of having both ETH and WETH pairs, no more unnecessary transactions to wrap tokens! 🙌</p><h4>Other Notable Features:</h4><p>Uniswap v4 introduces additional notable features to enhance the overall protocol:</p><ul><li>ERC1155 Accounting: Uniswap v4 supports the minting and burning of singleton-implemented ERC-1155 tokens for improved token accounting. This feature benefits frequent swappers and liquidity providers who continually use the same tokens across multiple blocks or transactions. 🔄💼</li><li>Governance Updates: Uniswap v4 introduces separate governance fee mechanisms for swap fees and withdrawal fees. Governance can now elect to take a capped percentage of swap fees and, if enabled by hooks, a capped percentage of withdrawal fees. 👥🗳️</li><li>Gas Reductions: Uniswap v4 implements gas optimizations through flash accounting, the singleton model, and native ETH support. The need for the protocol-enshrined price oracle, present in previous versions, is eliminated, resulting in potential gas savings on the first swap in each block, and making a pool deployment 99% cheaper. ⛽📉</li><li>donate(): The introduction of the donate() function enables users, integrators, and hooks to directly compensate liquidity providers in either or both tokens of the pool. This functionality expands the possibilities for new fee systems and tipping liquidity providers. 💰🎁</li></ul><p>Uniswap is paving the way for a brighter future in decentralized exchanges, where innovation knows no bounds. As the DeFi landscape evolves, Uniswap remains a shining star, driving progress and shaping the future of decentralized trading. ✨</p><p>In the coming days, we’ll dive into the intricate details of Uniswap v4’s technical implementation. Get ready to geek out with us as we uncover the inner workings of this groundbreaking protocol. ⚙️</p><p>Exciting times lie ahead as we uncover the technical intricacies of 🦄 Uniswap v4. Join us as we embark on this journey to unlock the full potential of decentralized finance through one of its pioneering protocols. Let’s delve into the inner workings and unleash the power of DeFi together! 💪🔓</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e41307c97a2" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/uniswap-whats-new-5e41307c97a2">Uniswap v4, What’s new?</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Re-entrancy Attack a 50+ million dollar exploit]]></title>
            <link>https://coinsbench.com/re-entrancy-attack-a-50-million-dollar-exploit-aac3f92d19e7?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/aac3f92d19e7</guid>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[ethereum-blockchain]]></category>
            <category><![CDATA[ethereum]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Wed, 21 Jun 2023 19:57:57 GMT</pubDate>
            <atom:updated>2023-06-23T14:40:02.664Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GayMjErEPwFQ5UZQ" /><figcaption>Photo by <a href="https://unsplash.com/@towfiqu999999?utm_source=medium&amp;utm_medium=referral">Towfiqu barbhuiya</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>These are the 5 lines of code that a Hacker used to get out of “The DAO” contract of nearly 50 million dollars of Ether and resulted in philosophical questions about the future of the Ethereum Chain and a division of the community.</p><p>And all of this could have been prevented by changing 3 lines of code.</p><pre>Transfer(msg.sender, 0, balances[msg.sender]);<br>withdrawRewardFor(msg.sender);<br>totalSupply -= balances[msg.sender]; <br>balances[msg.sender] = 0; <br>paidOut[msg.sender] = 0;</pre><p>Today We will learn about a very important topic, that is essential for Smart Contract development, understanding the order of execution of code and fallback functions but before, a bit of History:</p><h3>The DAO Hack</h3><p>(More detailed article about the exploit: <a href="https://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/">https://hackingdistributed.com/2016/06/18/analysis-of-the-dao-exploit/</a>)</p><p>The DAO was a ‘DAO’ (Decentralized Autonomous Organization) very famous in the Ethereum ecosystem in 2016, that suffer a huge exploit, what it will later be called a Re-entrancy attack that the Ethereum Foundation raised a question about what to do about it, The hacker couldn’t get out all the funds, a group of white-hats saw what was happening and conducted the same attack to give the funds to their respective owners later on. At the moment the funds that were retracted from the contract were ~5% of all the Ether in the ecosystem, the Ethereum Foundation proposed to make a hard-fork and ‘erase’ the transactions that were made by the hacker.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2JWDgLezbc7zYRV6t9-3YA.png" /></figure><p>These ideas raised some people’s fear in the long term of the project, the idea of an immutable blockchain that couldn’t be modified was banished, 85% of the nodes agreed to pursue the fork, creating Ethereum as we all know it today, and the nodes that didn’t, that stayed with the same values that we call today as the ‘Purist’ who think that ‘the code is law’ created Ethereum Classic the ‘real’ Ethereum.</p><p>And all could have been prevented by reordering the code:</p><pre>totalSupply -= balances[msg.sender]; <br>balances[msg.sender] = 0; <br>paidOut[msg.sender] = 0;<br><br>Transfer(msg.sender, 0, balances[msg.sender]);<br>withdrawRewardFor(msg.sender);<br>// totalSupply -= balances[msg.sender]; <br>// balances[msg.sender] = 0; <br>// paidOut[msg.sender] = 0;</pre><p>Let’s learn why this could have worked and how to protect us from these attacks in our Smarts Contracts:</p><p>When creating any logic of sending Ether we can’t assume that the recipient can only be an EOA (a regular wallet), we HAVE to assume that also other Smart Contracts will call our functions and think accordingly, there’s the concept of fallbacks functions in smart contracts, which are the receive() and fallback(), this is a diagram of when these functions are called:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lN8X6jvESGhXpPUQX_BngA.png" /></figure><p>This is useful when there’s some code that you didn’t implement, like if the user calls a function that doesn’t exist and sends 10 Ether, the fallback could be programmed to send back these funds to msg.sender to not cause any problem, and this is the problem with these functions, you can code anything that you want and it can be malicious.</p><h3>The Re-entrancy attack</h3><p>Let’s have an example, of vulnerable code, this code was taken from <a href="https://ethernaut.openzeppelin.com/">https://ethernaut.openzeppelin.com</a> the re-entrancy challenge:</p><pre>function withdraw(uint _amount) public {<br>    if(balances[msg.sender] &gt;= _amount) {<br>      (bool result,) = msg.sender.call{value:_amount}(&quot;&quot;);<br>      if(result) {<br>        _amount;<br>      }<br>      balances[msg.sender] -= _amount;<br>    }<br>}</pre><p>The order of execution of this function withdraw() is the following:</p><p>If the caller was a regular EOA (a wallet):</p><ol><li>The if statement checks if the balance of the sender in the contract is equal to or greater than the amount that he wants to withdraw.</li><li>Execute a low lever function call to send Ether.</li><li>Checks if the transfer of funds was successful, if true:</li><li>Update the sender’s balance in the contract</li></ol><p>If the caller was a Contract with a Fallback function:</p><ol><li>The if statement checks if the balance of the sender in the contract is equal to or greater than the amount that he wants to withdraw.</li><li>Execute a low lever function call to send Ether.</li></ol><ul><li>This is the interesting part, the function doesn’t follow execution, because of this transfer of Ether to the contract the fallback function will be called, and let’s analyze the situation:</li></ul><p>At this stage, the contract has received the Ether that we wanted, but the contract with the vulnerability hasn’t updated our balance yet, and the contract will call the fallback() that we custom coded to execute the withdraw().</p><p>This will create a loop, calling withdraw every time we receive Ether:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*niOg5DmtfKElZzxH_Fq23w.png" /></figure><p>And whenever we decided to stop we just let the fallback function finish and will let the withdraw’s functions end the execution, by the end of all, we will have all the Ether that was in the victim contract.</p><h3>So how can we solve this?</h3><p>in this example changing the place of one line:</p><pre>function withdraw(uint _amount) public {<br>   if(balances[msg.sender] &gt;= _amount) {<br><br>     // We change first the balance<br>     balances[msg.sender] -= _amount;<br><br>     (bool result,) = msg.sender.call{value:_amount}(&quot;&quot;);<br><br>     // requiring that the transaction is succesful, if not, reverse<br>     require(result, &quot;A problem ocurred&quot;)<br><br>     // if(result) {<br>     //   _amount;<br>     // }<br>     // balances[msg.sender] -= _amount;<br>   }<br>}</pre><p>In this way, if there was an attacker that would try to do this attack, by the time that he’s Smart Contract exploit the balance will the reduced, and he won’t be able to conduct the attack.</p><p>This is not the only solution, I would recommend using other more secure techniques:</p><p><a href="https://docs.openzeppelin.com/contracts/2.x/api/utils#ReentrancyGuard">ReentrancyGuard</a>: a solution made for Re-entrancy.</p><p><a href="https://docs.openzeppelin.com/contracts/2.x/api/payment#PullPayment">PullPayment</a>: a solution that doesn’t interact with the recipient account, this last one is considered the best practice when it comes to sending Ether, security-wise. It prevents recipients from blocking execution, and eliminates re-entrancy concerns.</p><p>I hope that you learn something today, don’t hesitate to ask a question we are all here to learn :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aac3f92d19e7" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/re-entrancy-attack-a-50-million-dollar-exploit-aac3f92d19e7">Re-entrancy Attack a 50+ million dollar exploit</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is this Address a contract??]]></title>
            <link>https://coinsbench.com/is-this-address-a-contract-5640be8e529?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/5640be8e529</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[smart-contracts]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[solidity-tutorial]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Tue, 20 Jun 2023 14:35:59 GMT</pubDate>
            <atom:updated>2023-06-23T14:40:11.175Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KqkRvqJkvp8T-_Mb" /><figcaption>Photo made by Mari Helin</figcaption></figure><p>There are two types of accounts in Ethereum:</p><ul><li>Externally Owned Account (EOA)</li><li>Contract Account</li></ul><p>We will discuss the differences between the two in a future article.</p><p>But which of the two is this address? :</p><pre>&quot;0xc65074464f2Bb5d5fa1181FbabE0517e2892158B&quot;</pre><p>Maybe you want to implement special logic to your Smart Contract restricting others from using Smart Contracts to call your code or for whatever other reason.</p><p>With a simple eye view, we can’t tell the difference in the address, in fact, Solidity can’t tell the difference either, but there is still a way, using scary assembly!</p><p>Here are some snippets to check if an <strong>existing address</strong> is a contract:</p><pre>function isContract(address _addr) public view returns (bool) {<br>  uint32 size;<br>  assembly {<br>    size := extcodesize(_addr)<br>  }<br>  return (size &gt; 0);<br>}<br><br>modifier isNotContract(_addr) {<br>  uint32 size;<br>  assembly {<br>    size := extcodesize(_addr)<br>  }<br>  require(size == 0, &quot;You are not a real person!!&quot;);<br>}</pre><p>Be careful with this code, see the keywords that I used, “<strong><em>already existing</em></strong>”, if your goal is not to let any Smart Contract call your functions, depending on the code that you have in place this may work for you or not, there’s a way to “hack” and bypass this, if the attacker decides to call your function in the constructor(), the function extcodesize(msg.sender) will return 0 because the contract hasn’t finished deploying is still in process within the constructor.</p><p>You could consider using alternatives such as using <strong>tx.origin</strong> instead of <strong>msg.sender</strong> but it depends on each project you need to be careful implementing this functionality, the more complex the codebase more vulnerabilities can be, is different so we can&#39;t have one solution for every case this time.</p><p>I hope this could help you, see you next time!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5640be8e529" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/is-this-address-a-contract-5640be8e529">Is this Address a contract??</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Constants in Solidity]]></title>
            <link>https://coinsbench.com/constants-in-solidity-180de71ab2af?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/180de71ab2af</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[gas]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Tue, 13 Jun 2023 15:42:29 GMT</pubDate>
            <atom:updated>2023-06-23T14:39:51.946Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*QD-QHJliwqDKAjnOM_6k7w.png" /><figcaption>Smart Contract example</figcaption></figure><h4>Which contract you think will consume less gas?</h4><p>It may seem foreign to people new to Solidity that both of these contracts, in a higher lever are doing the same logic, but behind the scenes the compiler is doing two different actions.</p><p>This is a lesson about Gas Optimization, and using constants or immutables whenever you can in your code.</p><p>To know what’s happening here, we have to know what happens in the EVM level</p><pre>contract notConstant {<br><br>  address ethAddress;<br><br>  constructor(address _ethAdress) {<br>    ethAddress = _ethAdress;<br>  }<br>}</pre><p>When compiling the first contract the compiler is going to see this variable ethAddress, it is a global variable that is going to be saved in <em>storage </em>(which is expensive), somewhere that we can change the value of the variable, the compiler doesn’t know that we don’t want to change the value.</p><pre>contract Constant {<br><br>  address immutable ethAddress;<br><br>  constructor(address _ethAdress) {<br>    ethAddress = _ethAdress;<br>  }<br>}</pre><p>But when compiling the second contract, the compiler is going to notice the immutable variable, the compiler knows that the variable cannot be changed once is declared, so instead of saving the variable in <em>storage</em>, it saves this variable in the <em>code</em> of the smart contract, saving us <strong>~ 50%</strong> in gas!! for just using a keyword.</p><p>The take away from this, check your code and think if you are able to change any of your variables to constants or immutables to be able to save a bit of fuel!</p><p>For recap, in the world of blockchain, where every gas unit counts, mastering gas optimization techniques, such as utilizing constants, becomes essential. By adopting best practices and considering gas consumption from the early stages of contract development, you can ensure leaner, more cost-effective, and highly efficient smart contracts</p><p>Article written by <a href="https://medium.com/u/30495c549669">Ethan Rouimi</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=180de71ab2af" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/constants-in-solidity-180de71ab2af">Constants in Solidity</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of data storage in the EVM]]></title>
            <link>https://coinsbench.com/types-of-data-storage-in-the-evm-cd8f45896173?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd8f45896173</guid>
            <category><![CDATA[software]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Mon, 12 Jun 2023 17:25:14 GMT</pubDate>
            <atom:updated>2023-06-23T14:39:56.031Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fj6Q5DmNuPsTytDldbe-Aw@2x.jpeg" /><figcaption>Photo by frank mckenna on Unsplash</figcaption></figure><p>In the Ethereum Virtual Machine (EVM), there are different types of storage available for smart contracts. These storage options determine how and where data is stored within a contract. Here are the main types of storage in the EVM:</p><ol><li>Contract Storage: Each smart contract has its own dedicated storage space. This is your hard-drive, it would persist for ever, we can write, read and delete variables</li><li>Memory: Is a temporary storage space used during contract execution, when declaring a variable within a function it will default to this storage type we can manipulate this as we would with storage, but be careful, after each function call the values in memory will be erased, is not persistent.</li><li>Stack: The stack is a temporary storage area used during contract execution to hold intermediate values and execute operations. It follows a Last-In-First-Out (LIFO) data structure, where the most recently added item is the first to be removed.</li><li>Calldata: Is a read-only space that contains the input data passed to a contract during an external function call, is used to access function arguments and other data sent from outside the contract. like memory this data is not persistent after each function call.</li><li>Event Logs: Event logs are very useful if you want a trace of some data but you don’t want to save the data to storage, a Smart Contract is able to emit events but it can’t access this information directly, but is easily accessible off-chain.</li></ol><p>The only “memories” we can access (with Solidity) are Storage (read and write), Memory (read and write), Calldata (read), using other tools like assembly can let us access other parts that we couldn’t with Solidity but is not recommended as it can be dangerous.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd8f45896173" width="1" height="1" alt=""><hr><p><a href="https://coinsbench.com/types-of-data-storage-in-the-evm-cd8f45896173">Types of data storage in the EVM</a> was originally published in <a href="https://coinsbench.com/">CoinsBench</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Comprendiendo los modificadores en Solidity: Una Guía para Desarrolladores de Python ]]></title>
            <link>https://medium.com/@ethan-rouimi/comprendiendo-los-modificadores-en-solidity-una-gu%C3%ADa-para-desarrolladores-de-python-8fe5e96d48bc?source=rss-30495c549669------2</link>
            <guid isPermaLink="false">https://medium.com/p/8fe5e96d48bc</guid>
            <category><![CDATA[solidity-tutorial]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[solidity]]></category>
            <category><![CDATA[español]]></category>
            <category><![CDATA[spanish]]></category>
            <dc:creator><![CDATA[Ethan Rouimi]]></dc:creator>
            <pubDate>Wed, 24 May 2023 14:11:17 GMT</pubDate>
            <atom:updated>2023-05-25T07:01:06.969Z</atom:updated>
            <content:encoded><![CDATA[<p>Escrito por <a href="https://medium.com/u/30495c549669">Ethan Rouimi</a> desarrollador en tecnología blockchain.</p><p><em>si no lo has hecho aún lee el </em><a href="https://ethan-rouimi.medium.com/comprendiendo-los-tipos-de-datos-en-solidity-una-gu%C3%ADa-para-desarrolladores-de-python-7e947aaf1835"><em>artículo anterior</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mAjiI_Hkd3LgKZxD" /><figcaption>Photo by <a href="https://unsplash.com/@tbonz?utm_source=medium&amp;utm_medium=referral">Emmanuel Edward</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Si estás leyendo esto y solo conoces Python, esto te puede parecer un concepto nuevo, pero no hay que inquietarse, existe un concepto parecido, los decoradores, funciones que extiende su comportamiento sin cambiar explícitamente su código fuente.</p><p>Me gusta clasificar estos modificadores en distintos grupos:</p><ul><li><strong>Visibilidad: </strong>modifican la visibilidad a una variable.</li><li><strong>Accesibilidad y otros: </strong>restringen el acceso a una función y referencias a la modificación de los datos.</li><li><strong>Personalizados:</strong> somos capaces de crear nuestros propios modificadores para funciones. (muy útil para no repetir código)</li></ul><h3>Visibilidad.</h3><p>Este tipo de modificadores ya lo hemos visto en anteriores artículos, estos cambian o restringen información.</p><pre>contract Example {<br><br>  []uint public numbers; // accesible por todo el mundo<br>  []uint internal internalNumbers; // accesible a través de este Smart Contract y contratos que hereden de este <br>  []uint private privateNumbers; // solo accesible por este contrato<br><br>}</pre><p>La que vemos primero es <em>public</em>, como puede darse a entender, esta información es accesible por todo el mundo, ya sean usuarios como otros Smart Contracts, la información es pública.</p><p>El modificador <em>internal</em> es especial, los datos de este tipo no son en sí visibles como los <em>public</em>, estos datos son accesibles en el Smart Contract como también solo “hijos” de este Contrato (el concepto de herencia y <a href="https://en.wikipedia.org/wiki/Object-oriented_programming">Object-oriented programmin</a>g), y este es el valor predeterminado, hay que tener esto en cuenta a la hora de desarrollar nuestro Software.</p><p><em>private </em>este hace solo capaz a la instancia del Smart Contract de acceder a los datos otros Smart Contracts no pueden modificarlos, este no se puede transmitir a la hora de heredar, pero CUIDADO que todo no es como parece, esto no hace los datos privados, cualquier persona fuera de la blockchain puede ver esa información, NO pongas información sensible en tus Smart Contracts en Ethereum, hay otras soluciones como <a href="https://scrt.network/">Secret Network</a> que pueden ayudar a ese fin si es tu objetivo.</p><h3>Accesibilidad y otros</h3><p>Estos se utilizan en funciones para decidir quién puede acceder y ejecutar la función, se utilizan los mismos que los que hemos visto en visibilidad, <em>public, internal, private </em>teniendo las mismas características pero en vez de acceder a la información, sería en este caso ejecutar una función.</p><p>Pero no hay solo estos hay otros que no hemos visto, como <em>external </em>que restringe la función a solo puede ser llamada desde fuera del contrato, nunca desde dentro, si quisiéramos que nuestra función pueda llamarse desde fuera y dentro del contrato, tenemos <em>public </em>para ese caso.</p><p>Y los modificadores que me refería en “otros”, son los modificadores que hacen referencia a si la función cambia datos o no en la blockchain, estos modificadores son <em>view </em>y <em>pure</em>, estos son muy interesantes ya que señalan al compiler que no modifican la blockchain, y por lo tanto, no pagas gas fees para llamar la función.</p><p>view y pure son distintos de uno de otro, view ya de por sí es restrictivo de por sí limitándonos a solo poder leer datos y no escribir, pero pure lo es más aún, una función pure no puede escribir NI leer información de la blockchain, vamos a ver unos ejemplos;</p><pre>contract Example {<br>  <br>  uint public value;<br><br>  constructor(_value) {<br>    value = _value;<br>  }<br><br>  function exampleView() public view returns(uint) {<br>    // esta función está bien, solo está &quot;leyendo&quot; datos y no está cambiando<br>    // ningún valor, por lo cual podemos beneficiarnos de 0 gas al llamarla<br>    return value;<br>  }<br><br>  function invalidView(_value) public view {<br>    // al intentar compilar este contrato no nos dejará, esta función es inválida, <br>    // ya que esta función intenta cambiar datos del Smart Contract, para poder compilar <br>    // tendriamos que quitar el modificador view<br>    value = _value;<br>  }<br><br>  function examplePure() public pure returns(uint) {<br>    // este es un ejemplo de un pure function no cambia ni lee nada dentro de la blockchain<br>    // solo hace un cálculo, o operación<br>    return 2 + 4;<br>  }<br><br>  function invalidPure() public pure returns(uint) {<br>    // esta función no nos dejaría compilarla ya que está leyendo el valor de &quot;value&quot;<br>    // no podríamos utilizar el modificador pure, pero si podriamos utilizar view.<br>    return value + 4;<br>  }<br>  <br><br>}</pre><h3>Personalizados.</h3><p>Estos modificadores son muy útiles a la hora de no repetir la misma lógica en distintas partes de nuestro contrato, tiene un syntax similar a las funciones, y para poder utilizarlos, los usamos al final de las funciones;</p><pre>contract Example {<br>  <br>  uint public value1;<br>  <br>  <br>  modifier onlyOne() {<br>    // require es un built-in function dentro de solidity, es muy simple como funciona,<br>    // le das un statement, si es verdadera sigue ejecutando el código, pero si ve que el<br>    // statement es falso, devuelve un error, y puedes pasar un string para aclarar el error<br>    <br>    require(value1 == 1, &quot;El valor no es 1, cambialo para poder ejecutar&quot;);<br><br>    // esta barra baja es importante, si no la ponemos la función nunca se ejecutaría<br>    // esto le dice a la EVM; &quot;ejecuta lo que hay después de mi&quot;<br><br>    // ten en cuenta que puedes poner varios underscores, pero normalmente y lo que se ve<br>    // en el mundo solo utilizan uno por lo general<br>    _;<br><br>  }<br><br>  function sumOne() public onlyOne {<br>    // al llamar esta función primero la EVM lee la función y cuando ve un modificador de este tipo<br>    // primero ejecuta el código dentro del modificador, si no hay ningún problema<br>    // ejecuta el código de esta función<br><br>    value1 += 1;<br>  }<br>  <br>  ...<br>}</pre><p>También podemos crear modificadores con parámetros, y los usamos así:</p><pre>contract Example {<br>  <br>  uint public number;<br><br>  modifier different(_newNumber) {<br>    require(number != _newNumber, &quot;The new number is the same as the old one, DON&#39;T WASTE GAS!!&quot;);<br>  }<br><br>  function changeNumber(_number) public different(_number) {<br>    number = _number;<br>  }<br><br>}</pre><p>Y Ahora que hemos visto todos los modificadores veamos un ejemplo de un contrato mezclando los distintos modificadores;</p><p><em>Aquí utilizaremos un modificador de OpenZeppelin, </em><a href="https://docs.openzeppelin.com/contracts/4.x/api/access#Ownable-onlyOwner--"><em>onlyOwner()</em></a><em>, que nos ayuda a verificar si la persona que llama a la función es el propietario del contrato!</em></p><p><em>Después de leer este artículo te recomiendo curiosear </em><a href="https://www.openzeppelin.com/"><em>OpenZeppelin</em></a><em> para familiarizarte con el código, además su código está revisado por miles de personas, ellos son el estándar en la industria.</em></p><pre>contract Example {<br><br>  uint public number;<br>  uint public specialNumber;<br>  address public owner;<br><br>  // constructor es una función especial, es la función con la que &quot;creamos&quot; el contrato<br>  // solo se llama cuando ponemos el contrato &quot;en la red&quot; en una blockchain, solo lo podemos llamar<br>  // una sola vez<br>  constructor() {<br>    owner = msg.sender;<br>  }<br><br>  modifier onlyOwner() {<br>    // msg es un built-in variable es como una variable de envirioment, en este caso<br>    // msg.sender se refiere a la persona o contrato que a realizado la transacción en la que <br>    // llamó este modificador<br>    require(msg.sender == owner, &quot;You are not the owner&quot;)<br>    _;<br>  }<br>  <br>  function changeNumber(_number) public {<br>    // esta función puede ser llamada por cualquier persona o contrato (incluyendo este contrato)<br>    number = _number;<br>  }<br><br>  function changeSpecialNumber(_number) public onlyOwner {<br>    // esta función puede ser llamada por el propietario del contrato<br>    number = _number;<br>  }<br><br>  function changeNumberInternal(_number) internal {<br>    // esta función puede ser llamada por ESTE contrato y sus &quot;hijos&quot;<br>    number = _number;<br>  }<br><br>  function changeNumberPrivate(_number) private {<br>    // esta función solo puede ser llamada por ESTA instancia del contrato<br>    number = _number;<br>  }<br><br>  function seeNumber() public view returns(uint) {<br>    // toda persona o contrato puede llamarla sin pagar gas!<br>    return number;<br>  }<br><br>  function halfNumber(_number) internal view returns(uint) {<br>    // solo este contrato (e hijos de este) puede llamr esta función sin pagar gas! <br>    return _number / 2 <br>  }<br>}</pre><p>Y ya que hemos visto los modificadores ya hemos aprendido todas las piezas para montar nuestro primer Smart Contract! , en el siguiente artículo crearemos un Smart Contract.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8fe5e96d48bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>