{"id":22331,"date":"2024-08-19T08:39:32","date_gmt":"2024-08-19T08:39:32","guid":{"rendered":"https:\/\/www.crossjoin.pt\/?p=22331"},"modified":"2026-06-29T12:48:15","modified_gmt":"2026-06-29T12:48:15","slug":"crossapp-from-cefi-to-defi","status":"publish","type":"post","link":"https:\/\/www.mockup.crossjoin.com\/pt\/crossapp-from-cefi-to-defi\/","title":{"rendered":"CrossApp: From CeFi To DeFi"},"content":{"rendered":"<h1 class=\"wp-block-heading\">Turning challenges into opportunities is what we do every day.<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Proactivity brings Innovation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In early November 2021, Crossjoin released a partnership with a nearby restaurant to provide high quality food with a 50% discount for employees (a.k.a, Crossers). The high adherence to this benefit created a bottleneck on a single Crosser who had to collect restaurant receipts from other Crossers and insert the information in a spreadsheet to settle how much Crossjoin had to pay that day to the restaurant. When I heard about this problem, the first thing that came to my mind was &#8220;Blockchain&#8221;.<sup><\/sup><sup><\/sup><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On December 3rd, 2021, my interest in distributed systems l<sup><\/sup>ed me to write an email to the CEO with a proposal to solve the problem by creating a payment system over a blockchain. I proceeded to inquire other Crossers about this idea, and this wa<sup><\/sup>s when I met one colleague who had a similar idea. At the time, I had more free time than him because I was waiting for a project to begin, so in the beginning, I had to step in and push this piece of innovation forward.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Using the right tool for the job<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Every engineer knows that choosing the right technology is crucial and can impact the project\u2019s efficiency, scalability, and success. We invested a lot of time in this part. Blockchains are relatively new. However, the variety of flavours is overwhelming.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have blockchains that are privately managed by an organisation (permissioned), like Hyperledger Fabric and Sawtooth. On the other hand, we have public blockchains, and everyone can build Defi apps and scrutinise every transaction being committed, like Bitcoin, Ethereum, and Algorand.<sup><\/sup><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In the pursuit of the best tool for the job, we decided not to go with a permissioned blockchain because every participant would have to run a node to be part of <sup><\/sup>the protocol and have guarantees that there isn\u2019t a Byzantine participant changing the transactions in their favour.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We chose <strong>Algorand<\/strong>, a permissionless blockchain, because it offers everything we need, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Fungible tokens and non-fungible tokens are treated as first-class citizens.<\/li>\n\n\n\n<li>Fast block finality, around 3.3 seconds.<\/li>\n\n\n\n<li>Low transaction fees.<\/li>\n\n\n\n<li>Written in Golang, making the blockchain code straightforward to analyse.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">For the front-end, we had another tough decision to make between writing the apps in their native language platform, maintaining different source codes, or choosing <strong>Flutter with Dart<\/strong> as a single source code that would compile for the various platforms (Android and iOS). We decided to go with the latter because we were only two developers and couldn\u2019t afford the extra time to develop the same thing twice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Challenges<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Web3 was a greenfield for us. In my thesis, I had changed code in blockchains to integrate threshold signatures, but I never had the opportunity to write a smart contract to solve a real problem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The first challenge appeared when we started developing the smart contract purely in TEAL (stack machine language). Our first solution was simple to write but hard to maintain, so we adopted PyTEAL as our abstraction over TEAL.<sup><\/sup><sup><\/sup><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This led to our second challenge: the rapid pace of evolution of Algorand and other Web3 technologies is astonishing. Things we initially had designed and couldn\u2019t implement became possible after just some weeks. We had to revise our solution 2 or 3 times to use the best approach to the problem. At the time of this writing, there<sup><\/sup> are new ab<sup><\/sup>stractions over TEAL and unit testing frameworks that we could adopt.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">One of our last challenges was to guarantee that there would be no security problems in the smart contract. We solved this problem by analysing different execution paths and simulating Byzantine transactions.<sup><\/sup><sup><\/sup><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Where to go from here?<sup><\/sup><sup><\/sup><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The first Crossapp concept had a simple objective: allow Crossers to pay for their lunch making use of a company copayment benefit. In my opinion, this was a success;<sup><\/sup> however, there is room for improvement and the addition of new features to the app.<sup><\/sup><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, we could add loyalty points or fitness point<sup><\/sup>s to add some gamification to the day-to-day tasks. To sum up, this app offers numerous opportunities that we can still explore, and I encourage all Crossers to drive innovation forward, helping us to make our Crossapp even better or promoting new initiatives just like I did.<sup><\/sup><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">by: <strong>Jorge Pereira<\/strong> Consultant<\/p>","protected":false},"excerpt":{"rendered":"<p>Turning challenges into opportunities is what we do every day. Proactivity brings Innovation In early November 2021, Crossjoin released a partnership with a nearby restaurant to<span class=\"excerpt-hellip\"> [\u2026]<\/span><\/p>\n","protected":false},"author":2,"featured_media":22342,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"rs_blank_template":"","rs_page_bg_color":"","slide_template_v7":"","footnotes":""},"categories":[74],"tags":[],"class_list":["post-22331","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-articles"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/posts\/22331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/comments?post=22331"}],"version-history":[{"count":1,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/posts\/22331\/revisions"}],"predecessor-version":[{"id":27373,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/posts\/22331\/revisions\/27373"}],"wp:attachment":[{"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/media?parent=22331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/categories?post=22331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mockup.crossjoin.com\/pt\/wp-json\/wp\/v2\/tags?post=22331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}