Taxa Network 🛠Building Interactive Web3 Services on Taxa Network
ETHGlobal·Sun, Oct 9, 2022, 12:00 AM
This workshop is part of ETHNewYork 2022, a three-day in person hackathon that will feature hackers, mentors, enthusiasts, sponsors and speakers who are all gathering in New York June 24-26, 2022 to talk about the future of money, finance, the web, ownership, the way software works and the way power is distributed.
Transcript
[Applause] [Music] welcome to our workshop so i'm tf from texas network and also uh here's our team member chris so in this workshop we'll be introducing how to build what texas network does and what you know what scenarios should you use texas network and how to build a privacy preserving and computational powerful web 3 services okay so the problem that texas network is trying to solve i know you have heard a lot of uh a lot of projects that are focusing on solving the scalability of the blockchain well text and networks is an address not addressing the network performance in terms of tps but texas network is focusing to provide a stronger a more powerful version of smart contracts and we are focusing on the performance of individual smart contracts which in terms are those aspects so here's a comparison between the web 3 applications and web 2 applications in some aspects and i know this is not a very fair comparison because the main breakthrough of web 3 is is trustlessness well under performance it suffers a big disadvantage for example the time and space resources you can use an individual smart contract it's very limited because of the lim the limitation of guest fee blog sites and also the functionality are very simple and basically focus on crypto and and the very basic business logics while lacking of some rich functionalities due to the that is mainly due to the consistency requirement and also because of the uh because of the consensus mechanism we have to wait for the block confirmation and also it's very difficult to protect your privacy on the blockchain so we we have we have we have paid a very heavy price to achieve the trust and text network is aiming to solve the performance and privacy issue for the individual smart contracts and our our solution is to build a layered architecture for the the apps and by moving the your business logic from on-chain to off-chain we don't have to be restricted by the consensus mechanism of the smart contracts well while we are using the trusted execution environment technology which is a privacy computing technology we can also we can guarantee the applications trustlessness in terms of confidentiality and also integrity so in conclusion uh we put some option and so we will have a higher privacy and we can build interactive applications well by using the trust by using the te technology we can guarantee the integrity and confidentiality of your application even without the blockchain so here's a uh here's the idea of a layered architecture of the future uh envisioned by us of the future applications today you already see a lot of middleware infrastructures acting a very important role in our d-apps for example the oracles or the ipfs well uh in the vision of web three we all we are we're still lacking one very important cornerstone which is computation today they are most built on the layer ones smart on layer one blockchains well uh to support more meaningful uh to support more uh more more meaningful applications uh for example like games uh interactive games you know uh we we do need an infrastructure that can keep uh that can do some high performance computation while keeping the users data privacy and text network is uh is aiming to becoming this role so you can as you can see we put the computation from in in the middleware text network well only when you need to generate a finalized state will you need to generate a function transaction or in other words the real relationship of texas network to a blockchain is like a back end to a database you only need to write a finalized state on chain while the computation can be done completely often and protected by the privacy computing technologies and let me introduce you the t-service which is the application running on the middleware text network t-series is a short for trustline services and it's a bit different from the on-chain smart contract first is interactive based on a request response based or protocol and we also wrapped it into a restful api just like calling a web 2 service but it's trustless yeah and also due to the nature of text and network we are not a block we are not a layer 1 blockchain we are stateless and but we are we provide very convenient way of interacting with leverage blockchains third because we are opting and using the privacy technology of privacy computing technology we guarantee your data privacy universe in your applications and the privacy data during transmission during computing are private unless you the developer choose to review it so it's opt out privacy so on the on the development wise you can simply sync the t service like a type you can sync text network like a typo oracle but instead of feeding the internet data we feed you the result for your entire business logic and which will guarantee the data privacy and the computing performance in terms of in terms of the computing and the storage resources so we migrated and python interpreter environment inside the transfusion environment currently where you we're using intel sgx and you can develop the trusted applications using one of the most popular language which is python service oriented development framework and also supporting a lot of third-party libraries so as an example let me begin with our hello world example on texas network which is called the millionaire problem it's a one of the most fundamental computing privacy computing program proposed by professor yael tj and the problem is assuming there are two millionaires they want to know which of them is wealthier without revealing their actual words so in an ideal case you want a judge and both party can trust it and both party and guarantee is honestly executing the business logic and while keeping their data privacy blockchain is designed for trust however it's very difficult to implement on today's architecture due to privacy issues well in our case on texas network because by default we can guarantee the data privacy you can implement such a hello world application in a very simple architecture just like imagine imagining we're developing a centralized application so two users don't trust each other but they do trust you and they give your they send their privacy data to you to the application and the application will serve as a judge tell them the result it's very straightforward uh well uh but uh well on texas network we exclude those applications inside the secure enclave security enclave so you can guarantee three things first you can always guarantee the texan node is honestly executing your code with and secondly you can guarantee the integrity you can always guarantee the node feed you back the correct result without tempering thirdly it can guarantee the data privacy during execution and the way the way users interact with hexa network uh it is based on a interactive protocol and all the entrance of the t-service are marked by a url of m3 url just like the ipf's ipfs ipfs1 and using multihash it indicates the hash of the of your t service code just like you can you because the competitor com is compatible with ipfs you can directly serve the code on ipfs and both user will establish a secure connection with the enclave in the text node and just like you can imagine it's like an https handshake and the node the computer provider serving as a middleman he cannot although he as although he's a service provider it cannot read all the any private data submitted by user or during the computation and the code for solving the millionaire problem is very simple so in our case we have two entries first both users submit their submit their words like and the function is called submit value and you write a python function and secondly after both users have submitted their words both millionaires are uh send their words and they will call another function called the get result and we directly feed the user the result by by direct very direct business logic and all those code are running inside the security enclave which means the node will not be able to read or temper the computation and you just feed the feedback the user result and both users will be able to decrypt the result on their client side and yeah and there are several when you are developing this service there are several key concepts uh first response requested response they're in json format they're carrying both confidential and non-confidential data and there's a certain field called data which is encrypted which is contains encrypted data and uh only only the user and the secure enclave have the decryption key any any third party including the service provider will not be able to decrypt them and the app id is uh means the hash of the code is only identifier of the code so when two users are calling the same app id we can guarantee they are calling the same t-series and also uil is consistent with a text header and the code of the hash and the function and the user identity is represented by a keep ecdsa key pair and later you can find them find them on our developer documentation and also text network support a temporary storage mechanism called we keep them by default uh seven days by default and you should not rely on it it will be available during your t-series lifecycle but you should not use it for permanent storage and uh for the python develop framework we call that pexa and which in short of python plus texa that is uh uh that is a python runtime environment we migrated inside intel sgx and is is derived from python 2.7 uh and in addition to python 2.7 we have added the crypto some crypto and blockchain library support so for example you can directly generate signatures generate wallets inside the python code while we also uh and due to the nature of t-service we also removed the file system network and process access so it's pure computation and also we are keeping expanding our framework adding vertically to add some third-party libraries to support more functionalities on texas networks and uh i'll briefly introduce how you interact interact with the layer one blockchain from texas network chris will later show us the details so but the basic idea is very robust and simple the idea is generating signature so the problem we are solving is how can we trigger a transaction layer one or in other words how can we verify whether a result is generated from texas network or be or is a forged one and and the solution is we generate signatures inside the t-services inside the security enclaves and later we could verify such signatures on solidity using easy recovery function and then you can authorize transactions for example assuming there are two players want to play a poker game program is a multiplayer poker game it's not it's not very easy to be built on layer one because uh it should be interactive and also you need a certain level of privacy well uh on texas network you could just uh build in a very straightforward business logic well after the game is over the textile network could generate a signature and the winner could submit their signatures to solid smart contract and the solid smart contract can verify the signature whether it's coming out of texas network and execute the transaction for example who will take the chip on the table and yeah and we we provided a library called pixar ecdsa which can which is a compatible with solidity's easy recovery and the you and because of our privacy preserving feature the user could safely submit their private key into the t services and the t services will generate the signature for them so some ideas of building on texas network first game and mtr are always a hot topic and especially for the games you know today's games are suffering from some limitations when you're building blockchains for example you can you may easily build a chess game on blockchain but if you want to build a card game which requires interaction and requires a certain level of privacy uh is much easier to be built on texas network and also unlts uh anti-related features for example uh some developers are building are building some gamification type empty center that you know for example in the previous uh hack uh is global there were people building the prisoner dilemma game on texas network and combine that with mts yeah and also collaborate computation and uh defy privacy and also identity for example how to authenticate a user without revealing his details it's like the t-series will tell a yes or no but the user will not won't need to reveal their actual privacy data yeah and here let's begin with a demo so we have two demos first demo is about how you set up an sdk and ask you some basic text network request second demo is how you authorize layer one transactions so chris okay so uh first we connect to our uh node and to send a text a a network to send a request on texas network uh just uh you can set up the text sdk on our documentation and uh you there are three very simple steps to send a request first you import our sdk in your price local pricing code notice although it's python but it's uh running on your local locally on the sdk and the second step is uh is to generate uh your identity and we already support the function by by initiating a request object yeah and if your first time using this uh the sdk will automatically generate a key pair uh elliptic curve keypair representing the user's identity and go ahead we call the send function which have which will carry the python code with it by the way so due to the nature of text and network there is no deployment necessary for the t services and on protocol wise the user is required to carry your t service code inside the request to the node and the node will hash your code and find out the app id and the engineering wise our node will cache the will cache the code for the t services so uh so you don't actually need to submit every time but uh by by default you can just submit the prime submit the t service code as a parameter and you call the send method to send a request yeah so uh when sending the request for the first time uh the text network will do three things so it's first it's called a remote attack station that means uh your your computer will establish a uh ssl type connection with uh with the enclave in the texan node so uh after handshake they will do like a dv helmet key exchange and they'll they will uh negotiate an aes 128 key communicating directly between the user and the enclave no one else in the world have that key so yeah it's basically like as uh like a ssl handshake and all your traffic is communicated by is encrypted by aes and as you can see uh there are some debugging data but the requests contain a status and a response and also more important most importantly there is a data field and which contains the secret data in your request is in which is encrypted by aes and uh yeah and also there's a response well response will also be carried and you can process you can decrypt them and process them in your python code and next uh chris will demonstrate how to generate a signature and verify it on solidity go ahead so this contract that we just executed um what it is is basically just it's this right here it calls this ecdsa signing key dot ethsine and it generates a signature and it's signing this message up here that's just abcdefg and then here's the my private key and so the signature is returned and then it's added to the response and so if you look up here the decrypted data this is the response from the taxa server that's been decrypted and so right here is our signature and so what we're going to do is verify that this is a valid ethereum signature by we have this solidity contract that has been deployed to the test net and it's simply just um we have this is valid signature uh well down here it's uh where is it is valid signature yes so it takes two arguments uh the message the original message which is just a b c d f g and then um and then the signature which i'm gonna paste in here and then we can call it and uh the return value is true that's because the valid uh this signature is valid yeah so the key is first inside the textile t service you use the ecdsa library to gen to generate a signature and uh it it is safe for the user to submit a private key inside the key service because it is entirely running in the security enclave and uh by and after generator signature inside the t service you output the t series inside the response and uh well and uh if you want to verify the signature you you call the easy recovery in solidity and it's competing and the format is entirely compatible so the easy recovery will tell will tell you whether the message is legit generated from the textile t service so that that's the way you inter uh you you authorize a transaction on layer one okay and uh here are some useful links so for the developer documentation go to dutch.txt.network and also you can always go to our booth at first floor uh we are we're happy to answer all your questions in your development and also uh we'll be uh our engineers will be on discord to answer your questions so yeah please mark the link and happy hacking thank you guys
Automatic transcript — names and jargon may be misspelled.