 So, hello everyone. Welcome to this Hyperledger Sweden Meetup. My name is Roland and I am your guest for today's session. And I think today we have a really cool session because we will work on this session from the last time. And today we will use CoachTP where we will see how we can use CoachTP for our conditional statement example. And at the beginning I would like to give you a short overview of what we are doing today and I will represent the use case again so that you will understand what's going on in this example. And then we will make a short introduction, what is a state database, so that we know what we mean with this term. And it's always good to know also from the perspective of an fabric developer, of an no-chairs developer, maybe because we focus at the moment on no-chairs, on chain-con development for no-chairs. And this comes a little bit from the client side, so we can use no-chairs, of course, for the client-side development. And when we look a little bit on the server side, so this both things should work hand-in-hand, so from the client side we can only call some methods or functions which are implemented in the chain-con. And in fabric it's so that we have so-called state database and very forward and in all sessions until this session today, we have always used level DP and that's one that's the default way of storing a state of an asset. But fabric offers also a second grade and that is with CouchDB, that's a no-secret database. And this gives us some other features and more flexibility if it comes to searching and aggregation functions and something like that, more than no-secret database can do for us. So a short introduction at the beginning. And then we will see how we can enable CouchDB in our demo setup. So as long as we are working on the development, so we work on our docker-definite example so that we can implement some chain-code functions and we can start and restart the chain-code and without every time to upgrade the chain-code. So that's the reason why we use also today the docker-chain-code example which we have, which we have seen in the last previous sessions. And then we will add a new function to this example and with this method where we can query our transactions with the date range, but we will see it a little bit later. Here on in this reference section, you will find the agenda and also the previous agendas and also upcoming agendas here. And here is also the link to the support material. This is the same link which I have posted to the chat here. And on this GitHub repo, you find also all other support materials from the previous sessions. And also the materials which maybe you need for today's sessions. So when you have missed some sessions before, then it's helpful to look into this support material. Yeah, and then we have here some links, of course, to the hyperlateral documentation and then to the favorite chain-code note. In GitHub Waveboard, there you will find also some useful information and then of course CouchDB. So since today we start with CouchDB or we see a little bit from CouchDB, then it makes sense to look also into the documentation of CouchDB. Okay, so this is an overview of the last session. So, for demo development, we have created a specific use case. And in this use case, we have two organizations, a producer organization and the seller organization. And the producer pays the seller for recommendations, 1% of the revenue and 10% of the closed sale. And we have done in the last session the implementation of this chain-code in notaries. We have seen that how large this container image would be if you try to use this chain-code in the test network. And also we have seen how many transactions per second we can reach with a simple single virtual machine on digital ocean. And in the last week I have implemented the same, the same chain-code also in Golang, but we will come to this a little bit later when we compare these two things. Hello. Do you have a question? Okay. And yeah, and then here we have an asset. So this is our asset configuration. So we store the revenue, the commission, and the date of this revenue. So, today we would like to introduce a new method and with this method, get commission statement by time range. And with this method, we would like to use two parameters with the starting date and the end date and we want to see how many transactions, how many assets we have in this time range. And that's the implementation of for today's session. And then in the last session we have seen that when we use couch, when we use level to be, then we have a very simple scenario. So we have a key and the value to store in the blockchain. And the key is only is always a string. So it's a string, it's a number. It's a unique idea or whatever, but it's always a string. And it's always unique. So one single transaction has only one unique key. And to query this, it could be a little bit difficult when it comes to when you want to know how many transactions you have done in the last year or in this year or in this month or in a particular month or something like that. And that's the reason why we have also seen how we can use a so-called composite key to query to fit this requirement. And we have implemented a composite key with this structure with the year, with the month and the transaction ID. And today we would like, but with this, with this key, we cannot query a time range from start day, from a start day date to an end date. And that's the reason why we have to switch to another, to another state database. And for this, we can use this coach to be with coach to be, we can use some find this find command with a selector and with the selector, we can use integrated functions like greater than or less than. And with that, we can formalize and query to make this function working. And that's what we are going to implement today. So we use the same no chairs code from the last time, but we will implement a new function here. And to do this and to use this, we also have to see how we can implement coach to be in a fabric network. And here is just another slide. So it's summer, this slide summarize a little bit what we have done in the last session. So to give you a better overview. So here is our data model. So as we have seen in the last session, and then we have used a standard level to be database and with this technique of composite key. We have created a function get commission statement by year month. And when we have used this function, then we have to have we had the possibility that we can say okay, I want to see all the revenues from the from a year from a month are exactly one particular transaction. So, and in this, in this way. So, and with coach to be now, we have the possibility to use all this composite key queries as well. And we can extend this also with a new function. And then we can make a query with this, we have defined function and the speech special selector that we can query date to date so we can say okay this is my date string. I have my start date string and this is my end date string. And we want all transactions or revenues or all commissions here between this date. And this is one example, how you can use coach to be for an example like that. Okay, so, and here's the slide so what is a state database. So, when you start with fabric, then you have to know some little basics. And one basic is that everything what is stored in fabric is an asset. So, an asset is something can could be everything could be this transaction of the revenue could be a house could be a car could be a nun. Whatever. So, and could also be only a string, for example, could a stream or could be a data object. And in this data object, you can store other data objects and so on. So, I think every trace and structure you can compose you can store also in the value of the block of the value of this asset. And the state database is by default level DP as I have mentioned, and the state database holds also the last the last version the last status of an asset. So, and that's really a cool feature, which you in in blockchain, because when we query the last state of any key, then we are, we don't have to query the whole blockchain and the blockchain could be huge. So, we only have to query the world state, and the world state is a key value store in level to be or in couch to be and other other histories, for example, the other states of an asset will be stored in the blockchain, and this is done called the so called lecture. So, and the world state here is a database which holds all the assets in your on your channel and always the last status of this channel. And that's make fabric are also very fast to find and to query and to interact with this blockchain system. So the lecture current state that represents the latest value of all keys ever included in the chain transaction log so but the important sentence here is the current state and the latest value of an asset. No, no, no. So, and this is an term you can find only in fabric, I think, and the developers of fabric called just so called right state. And, yeah, how you can enable this now. So, that's, I think, very simple. So, the only thing what we have to do is, we have to include the new docker service. So, the fabric comes with an image, and this image is a favorite coach to be here. And we have to define in the docker compose file here in use service. And there are some, some, some points to notice here the environment. So this is important that we set and coach to be user and then coach to be password. And, yeah, and a couch to be service and the coach container name. And then we have here to formulate this is the standard part. So, this is the standard part for one coach to be service, and we have to make sure that we are in the right on the same network here. And then we have to do link this couch to be container to the corresponding PR container. So, when we have pierce zero here, then we and we use couch to be for this fear. Then we have to use and separate couch to be service. So you can say, every beer uses its own couch to be service. And you have to know that you cannot split it. So, when the beer uses couch to be, then the beer cannot. Sorry. And when the beer uses couch to be, then the beer cannot use at the same time, a level to be so, but you can have in your network. On the beer couch to be and also another beer, you can have level to be. So, when you use the example like, like today, then of course you cannot, you can only use the couch to be a curious honest on the peer, where you have also caught to be run. And to connect this, this both together. So, favorite case here to environment variables, namely call interested state database must be set to couch to be here. And then these couch to be conflict couch to be address environment variable here must must point to the service name couch to be zero and the corresponding part. And that's the name here, the service name, and the part here. And when you have a peer 123 and so on, then you have also, oops, then you have also to increase the part number, and we have to change it also here. And then you can, when you said here and couch to be user and the password, then you have also give you the first to be user and password name. And yeah, and that's it. So, and with to with this two pieces, you can use a couch to be as a state database for a particular peer in your Docker composition. That's, I think that's all what you have to know. And maybe it's important to know that when you use this couch to be there's also an user interface. And this user interface populates the exposes on this pop this pot to the public. And then you can use an browser Chrome, for example, and to browse to the peer address and to the spot. And then you have, you have a graphic user interface, like PHP my admin for my secret is, is this also and user interface for couch to be. So that's the reason why it's important to set here username and password for the root user for the admin user. Yeah. So that's what this, and then. Yeah, here is this this is the foxtone interface. Yeah, it's a web UI interface. And Joe, the telephone is calling. And yeah. So the steps to do is we have first to enable, we have to first make our network couch to be enabled for a state database. And then we can extend our chain code with this new search method. And then we have to install it instantiated. And in our case we will do it with the Docker chain code depth mode. And yeah, and then we can try it from the command line to query this CLI. This is a good reminder. So in the last so last week I received a request from from from a user and this user asked me a question. We got in this docker depth network. And he want to know how he can in our examples, we use only the CLI to interact with this test network with this development mode network. And he wanted to know how he can do is with no chairs. So, and in the next session, I think it is a good idea and a good learning to see how we can use also and no chairs client for for this docker depth mode. And then you can I think maybe a little bit easier test your chain code. Okay, so and here you see the, the, the, the, the web UI as an administrator tool, for example, and here you have to replace the local host with your IP address with your public IP address and so on. And here you see the board now. Okay, so, yeah, and then one thing what we can do also with this type of queries is we can have an order we can change the order so we can make a simple sort we can sort in two directions. And, but for this, we need an index. So, and when we create a chain code, and we installed this chain code, then we have provided in the chain code folder and index, and index is nothing more than a tracing file. And this here is the tracing file. So, so, and here we can define the index fields. So, what we want to index and to query is the revenue timestamp. And we can do this and then we here define this field, the fields we can have multiple fields, fields, which are going to be indexed. And then we have to give them a name so the index revenue time set name, it's the name of the index, and then here, this type property is chasing. So, there is only this type for the moment. And the DD doc, this DD doc property is optional. And I don't know exactly for what's going on, but maybe when you change the index I have read that if you change the index, then you have to use this one. Yeah. So that's the only important part here is that you see the structure. So, you have to, on your chain code folder in the root of your chain code folder, you have to create this folder structure with meta in state database couch to be indexes. And here you have this put in this chasing documents, and you can call it index revenue, and this is the content of this index document. So, when we install this chain code, this folder will also during the installation process, the setup will see that there's an index and will install this index in the chain code in the couch to be. And then we can make, then we have an index, and the good thing here is that fabric keeps this, this index always warm. So, this index will be updated after every transaction. And we don't take, we don't have to take care is this index actual or not. So this is part of the fabric lifecycle. So we will always have a warm index, and then we have a fast and performant system. But be carefully with indexing. So if you have too much indexes, then it can be too much. Okay, so, yeah, so that was for the introduction, that was for the introduction. And now, let's see how this is working. Okay, so I will make this a little bit larger for you. Oops. In the last sessions also showed you the possibility to use a terminal multiplexer for this. But for me, it's here a little bit easier to demonstrate it. Because of the different panels here. So, but when you make real development then you should use this multiplexer, because then you can leave the system alone, and then later you can come back and can work again, work further on your current position. So. Okay, so the first thing what we have to do is, let us look into. Yeah. So, we need to see what is our test network to repeat a little bit the configuration of this. So, we have placed this in the favorite samples folder here. And here we have created popular. We have created a folder called deaf network. And this is here our configuration. So, so if you're new to to this. Then you can look at my guitar rainbow, and they will find a meetup, how we, how you can create this setup. And, but keep it short and simple. So, this Docker deaf network. So we can do it in two ways we can use the Docker, Docker composition, or we can follow the official guide in the 2.3 favorite documentation. And in this documentation, there is the binary version, the scripted, but both both both variants options do the same. So we have one order here for testing. And I've here mapped my old files to this local folders here. So sample conflict, the membership service provider artifacts is the folder where the Genesis blocks live and the channel transaction. And lecture data. This is the place where the blockchain stores all the data for the order and also for the PM. And then here we have to folder the folder for the chain codes. But this is the same as we have seen several times here. Then the beer here. No, let's let's look to the couch to be container. So, and here we have our couch to be service. And we have seen we have defined here, the couch to be a service for this P and all serious for this P and all, and then we have a couch to be user and the couch to be a password. This idea deployed can read. So don't do this in a real scenario here use environment variables, or something like that. Don't write your credentials here in the Docker compose file, because the Docker compose I could also part of it repo for example, and then you don't want your credentials in a good way. So then the part here, this is the standard part here, and then the network definite work is the name of our network. And then we have to link this. So I have marked this here. So the only thing what we have to do is we have to put here in this foot this for environment variables. So, which state database for you so we use couch to be, then the service name here and depart. That's couch to be zero, and then depart, and then use element password. So, that's, that's the integration for these culture to be. And with that, we can start this Docker composition, and then we will have three Docker services running an order a service and peer service, and a state database and culture to be container to be a zero. So, and that is so that's the only. Yeah, that's the important part here from the network side. And yeah, so, but first, we have to. So, don't forget housekeeping. So make sure that you have cleared all your system. So, and also your clear your Docker volumes. So, that's the reason why I put this here on the first position. So when you try a lot of things then you will have some trash containers and trash volumes and so on and this could lead to some problems. And yeah, so, and we need three terminals, one to sweep the first terminal here is the terminal where the local composition is running. So, and we use the, the local system in the, we run it in the, in the photograph so we don't have access to the terminal here to see all the log messages. This is the terminal here. This is the place where the chain code is started and stopped and so on so that we can modify our chain code. And here in the third container, we will use, we will test it with the CLI commands. Okay. So to get started with this. So, we need these conflict fabric conflict path. This is the sample conflict. So fabric has to know where the configuration files are. And then we can, we have to do two steps so we are first we have to create the genesis block, and then we need the channel transaction for our channel with channel one, for example. So, so, okay, first step, the second step. And then we will have in this artifacts artifacts for our genesis block here, and here the channel transaction. And then we can start up the network with Docker compose up. You see a lot of log messages here. And we check and you see here couch to be so it seems couch to be is running. And Docker PS shows us, we have here now. These few free services one. The other one, the beer and the couch to be zero for PS zero here. So we have some questions now. Yeah. No, of course, you can you can have couch to be accessible about TLS. Yeah, but not here in the them in this docker definite work. So it's easier to use it without SSF. There's no certificates. So the history function. When you look into the favorite samples, then you can find maybe maybe in the asset transfer examples, there must be also an implementation, how you can query the history from an asset. So I have to be focused a little bit on the on the demonstration so otherwise I will make some mistakes and then we lose the red line. Okay, so now the first step is working so here we have the Docker system now running and then in the second terminal. Also now a definite work. We need also the fabric. And then we have to create the channel. These commands are always the same. So, you can find these commands in the network script, or you can find it also in the documentation. So, we have tried to change them. And the next step is that we have to install our chain code. So, and for this step in the deaf network, we need a little bit from the chain code that we can install it. So, and let's look to the second demo here in the chain code. No chairs folder here I have prepared this. So this is copy and paste from the last session. So important here. The package chasing here is important. So important to have these two dependencies here included so the fabric contract API and this is very good skin. And, yeah, and the main file must be here called index chairs file. And very important here the start command. And that's the reason that's, that's really important that you put in this start property here with this value. And this fabric chain code node is a program which comes with the fabric scheme. And that's the reason why we have to use the have to use this npm package fabric scheme. When you install this, then you will have also this fabric chain code node file and with this, you can start the chain code. Yeah, that's here the important part. And in the index file. So that's here, the same like you can see in the documentation. And And then the slip folder. Here we have the state chain code. This is the same chain code, which we have used in the last session. We have a very short we over a few of that. So, so the honor to me of such a chain code is simple. So you have here. And the contract. So, and the contract is provided through these required package here is the favorite contract API. And then the contract has to X has to be extended to a class. And then we have a constructor. And that's it. And then we have two special methods here. And this is before transaction and after transaction. And in the before transaction. This function is called like it like the name says before the transaction happened. This is good for logging. If you need to transaction ID for this particular request or something, whatever for checking for whatever you do. So, and this is also optional. So when you don't call this, then it doesn't matter, but you can use it and then this is called before the transaction happened. And the second is after the transaction here with the last one. And that's the same. And you can also, when this is called, then you can trigger an event or a log message or whatever you want. So, but this is done after the transaction is ready. And we have implemented two functions in the last session, this store. Commission statement, and this is what we have seen in the slides. So, we have two types here from revenues we have 1% and 10% 1% for and recommendation and 10% for and real revenue here. So, that's also it's only an example. But in the next sessions, we really say, okay, this is the chain code, but the smart contract is the contract between the producer and the seller. And these both companies have decided to change this rules. And then they say, okay, we need more revenue percentage from you. And then we have to change this here. And then we have to change this here. And then we have to see how we can upgrade this existing chain code in the running network with another version of this chain code. So that's the reason why I have put here. So simply numbers, then we can in a later session, we can see when the system is running and then the two parties say, okay, now we have to change this business rules, then how we can change this in the chain code. So that's the reason why we have this here in place. And here's our model was what we have seen. Here is how we have created the composite key with the layout here new amount and text and so on. So, yeah. And then we create here with this boot state here, a new asset or we update an existing asset but in this scenario, we only create an asset, we never update the state of an asset here. And important here is that we, we can we have here a property. So this is the cdx the context, and through this context parameter, we have access to this stuff interface and the stuff interface provide us different methods, and one of them is the boot step. And yeah, that's the, the line where the, the, the state is, is written and the, the, the, the value here, the key. And the value is stored into the blockchain. And here you can see that this is the key. So this key could be a number is doing whatever I am something like a composite key. And here is another method which creates this composite key here also provided with this from the stuff interface here. And then here we have the value. And the value is nothing more than a part of it. Anyway, and we can stringify this. Yeah, so we can, we have here a JavaScript no chairs is JavaScript, and then we can modify this with the chasing. So in, in to string, and then we can create here and buffer and buffer away, and this is then stored into the blockchain. And that's all here to store this transaction. And then we have this function to, to read the query. And, yeah, so, and the main function here the important part is this good state per potential composite key. And we have here the key, the layout of the key, and the keys itself are in a way, and the way must be in this in this order. And then when we have only the year, then it creates only the year, when we have here and month, then it creates year and month, and when we have also the transaction ID, then we will have the particular transaction. And this is the variability, which we have. And then we have our queries here. But when we want to try to query this by day, or for two days or for three days, then this will not. So that's the reason why we look for a better solution and the better solution here is to use a country as a state database. And then here, this is the new function. And this function, we have to implement. So, okay, but now we have this function a little bit in place, and then we have to finish our setup. And to finish our setup. First, we have to install the chain code here. And the installation of a chain code is a two step process. So the first step is that we have to package your chain code. Here with this be alive cycle chain code package command. And then we can install it. Keep this, and then we can create this and the important is that we need these package ID so every chain code package has a package ID, and we need this package ready for later for the improvement process. Okay, so now let us check this. And then we have to install it to package. So now we have a new file here created at this moment. This is impact is the set packet package, and it contains the chain code, which we have seen in previous. And then we can install it. Yeah, and if everything works right, then we should have here this chain code identifier, and we need this number and export this package ready in an environment very able package ready here. So we need this package ready here for the for the start command. And we need it also here when we approve the chain code. So, and so it's a little bit easier to handle this long number here. Okay, so, and then we can start the chain code. So we go to this chain code folder. We are here now in this chain code folder. And then we can start here with this command, the chain code, and the start command here is the same. If you use a goal for that. Yeah, the only difference here is that you have to use this favorite chain code start command here. And if everything works, then it should like this one. And now we have here the chain code running, but the chain code is not running in a container, we have manually started this chain code here. So in the wheels scenario when we install it into the test network, for example, then you will have a chain code container running as a Docker container. Okay, so this looks fine. And in the first terminal, we need the fabric path, and then we need of course the environment again. And then we have to approve process. So, but we have to do this only one. So the difference is when we, when we, when we use this in wheels scenario, we also have to do the same steps. So the difference is that we cannot close this process here and start this process again, without upgrading the chain code. So when we modify the chain code, then we have to upgrade the chain continue new version. And that includes also a new approved process and this is not so efficient for the development. So and that's the reason why we choose also this death mode here. In the first time, we have to, we have to approve this chain code power sample organization, and the steps, but the steps are the same so we have to approve it by the organization, and then we have to commit it by the organization. These are the both step, we checked the commit readiness. It's here not so important because we have only one organization. So when we have more than one organization, then every admin of the other organization has to approve this chain code and maybe this is also on another time. So, and then we don't know when the, when the administrator of this, the PR has approved this chain code, but with this command, we can check it so we can check the commit readiness of a particular chain code. Okay, so let's try this. And it's valid. So transaction is valid. And when you check this readiness, you can do it. And you see here. We have only one sample organization, and this value is true. So when we have more than one organizations, then we will see here at this time, after the first time sample organization, one true, and the second organization falls and so on. And then we can commit this chain code. And that's it. So now we have this chain code successfully installed installed approved and committed. And this this time we are ready to test and develop our chain code. And, okay, the chain code should run now. And the first is that we need some data into the chain code. So, the first thing is that we set store some data, we can do this with this. And then we have this command PR chain code invoke. So that's important a little bit. When you try to reproduce this example. So, please notice that PR chain code invoke is used for the store for storing for changing possible for creating update the ledger. And PR chain code query is used only for query the data. So, and that makes a huge difference because the invoked process goes over the order system and the PR chain code query queries only the beer, which you are connected for the moment. So in CLI, you are connected through the environment variables, and from the no cheers client, you are connected from the connection profile, which you have used to connect to the network. So, but notice here we have an invoke command for everything which changes the state, and we have a query command, which only queries the state of an asset. That's pretty cool, I think, because when we have a nice scenario, the seller could have a single note in his own data center. He has only the rights to query this data, and he don't have has to be access to our blockchain system. He only need a beer in his own data center, and then he can create this queries with a single simple no cheers application, and then he can only query his revenue cells every time he wants to do it. Okay, so let's try this is also dark thing. Okay, it looks like good. So, and here we have a key. And this is too so then let's create a little bit more data. Okay. Let us try query commands. And you see, we have here a site. So we have here Jason swing. So this works. So, and this is the state from the last session. So, we can do this by year we can do this per month. So, this is to to so. Okay, so when we do this per month here. We will receive only one line here. So, you see the difference. So, and when you create a full, the full key, then you will receive the particular transaction. Okay, so that is what we have done in the last session. And now we want to create another query. This one. So, you know, and for this one we need here. So the first one is this command here, the command is an and chasing away. And the first one is called our in this, this, this argument here has an away, and the first element in this away is always the function. So, and this is the function, which we record. And then the next parameter here, the next elements in this way. And here. So here we have one value. So this is the way zero is the element zero, this is the element one, and there's also the element zero, and this is the element one, and this is the element to here. And we can give as many options here values here as we want to their function. Okay, so, and how we, we can do this. So now we have to switch to know this is the wrong. Okay, so now let's, let's try if this is working. So now, now we want to make a little change here. So in the before transact in the before transaction. So we make a new command console log. So here. Test test. Okay. So, how we can test if this is working. So, and for for this, we use this second terminal here, and then we can stop this process with control C. The only thing what we have to do is we have to start it again. And when we started again. It's running, but with this new version of this chain code. And then we will try to pre read it. And you see here the log message test test. And in this way, you can make your modifications. And you can make your modifications and then test it. And that's an easy way to try your chain code during the development. And yeah, so that's an important step. Okay, so, and now, if this is working so we can remove this. We have to implement this function here. So, and I have prepared this here. So let me copy this. Then I will walk through this. So, this is the new function, get commission statement by time range. And here we don't, we only have one parameter, one option. And this is the CTX this context, which will, which is comes through the through the system. And there we will have a through the stuff interface, we have the possibility to get all the arguments, which we have, which we can use here. This one, all these arguments here. And that arcs means to read this away. Yeah. And then you have access to this. Yeah. Okay, I say here this is a short quaking condition. Here we have our global all results away. And the important part here is, let us split this a little bit. So, here, this is the part, which is unique to the country. So we have here a query string, and we need a selector object. And the selector. You can try this also with these. With this administrator tool, I can show you this a little bit later. And there you have a fine command. And in this fine command, you have also this selectors. We need this selector and this selector has the has the properties and when we would like to query the revenue. So our field is called revenue TS. And then we have to make here the query and the queries that we say we want all values, the greater than argument one and less than argument two. We can also give them the query string assault object assault property. And this sort for this sort of property is an array. And in this array, we can send object away and then this object away we can have different sorting elements. And we want to try to sort this ascending or descending. And so let us see what is the query string. So, and this is how you can compose a query string here. So, and a good possibility also to try this out is the test is the administrator interface, because in this administrator interface, you can test this queries against the blockchain. But then if this query is ready, then you can use it here in your in your source code. And yeah, and that's the query we are going to send. And this is done also with this command here. So get query result is also provided through this step API. So, so I think most functions are provided through this CTX stuff here. And it's also good to look into the documentation, which functions you can query, which you can use here. And that's the reason why I've put you the link to the documentation. The result of this get query result is an iterator. So that's important here. So, that's, that's important because we can loop over this through this iterator. And this is done here with this with this white block here. And as long as this result iterator has a next object and is, and this is represented through this done. So the last transition in this. Hello. Do you have a question. No. And the last, the last result, the last line is represented through this done property here. And until this is available, we will loop through this while loop. And the only thing is what we have to do here is to convert this back as a, as a string in the UDF 8 format from the buffer. And then we can compose an output as a record as a trace and string. Now, and then we push this in there all results area here, and we have a key. So then we see the key, and we see then the record data. And then the last step is that we can give the chasing string back. And that's it. So, and when we try this. So let us try this now. We can stop the chain code. Start the chain code again. And then we can try to come out here. And it works. And you see here, the output. So this is our console lock from the career stream. Okay, so now what we have seen is in the March. So let us go back one month. So we'll see a little bit more. Okay, so maybe we should create another. Okay, so now you see more sites. But we have here the 21. Here's a 20. And we have to 15. So, this is the order. So we are going to change this here. Let's say desk, stop the chain code, start the chain code again. Do the query again. Now you have the other direction. So, 15. 20. 21. So, okay, so, and so when you don't want your lock statement, you can remove it. Stop it and restart it again. You don't have the log messages here. So, um, and now we can compare this methods here as we have seen. Let us switch back to the presentation. One thing I have missed. Here. This is the index. Yeah. So here you see the folder structure. This is the chain code folder. And here we need this structure meta in state to be culturally indexes. And here we have a JSON document in this JSON document. You have here this search field. And in here we have now we have three different possibilities to query it up. So we have this traditional version with the composite key, which is also a good choice when your system doesn't need the query like this one. Or you can use this couch to be a version. And then you can use all the capacities that couch to be has and then you can query a lot more. And one example of this is this one. Yeah, yeah, so I think this is a, I think now I'm on my end. So I can show you only this, this, the interface, I can, I think I can show you this or not. I'm not sure if I can show you that. But I don't think so because this part is not enabled on this machine. Okay, so I think our main so thanks for your attention. And do you have any questions to this. Today we are a little bit shorter, I know, but I'm happy to be here today. So, because my time is a little bit limited. And so, yeah. So, is there any question to this. That's good Conrad, thank you for moderating the chat. The previous recordings and so on, all you can find on the audio recordings on the official YouTube channel. And I post tomorrow. You will receive an email from the meetup page. And in this meetup page. There is the link to this presentation and also to the to the support material and on on this on my website. There is also then the link to the YouTube video and this will be the official is recorded and published under the hyperlator channel. I have a link there and then you click on this link you will come to this link and you find all the, all the videos on this on hyperlator on the hyperlator channel. I have a question. Yes, yes, please. If you want to add the certificate authority. So this setup. We should only add the image, the code image. And the code compose file. Right. Your question is now about the fabric certified authority. And also, if you want to use this to issue identities. Yes, yes, yes, but this must be done in a separate session so favorite provides you and certified authority free. And with this certified authority, you can create all the identities. And in the test network, you can test it without is very easily. So when you look in the fabrics, fabrics documentation. We find this also in the getting started. No, it's not good. So here, and in the test network. Hi, my name is Roland. We will have. Could you mute myself please. Thanks. This is the week me this is the network script. And here I have to look for the documentation for you. Because you can start the favorite CS with a with a with a single command for this in the test network. So I have to look for the documentation for this. And then you can see how this is working. Yeah, here. So this is the test network. And then a test network. This, we have to strip network. This network script. And this is when you compare with the 1.4 version, the bigger first network example, and with this version, then this is really, really a game changer I think so only, especially for learning, because we can with this script, we can start any configuration so we can start a configuration with a level to be we can start a configuration here with couch to be and also you can start this test network, only with this option CA. And then you will have the whole crypto material generated through the test network through this script. And this is when you look into the network script a little bit deeper, then you will find how they do this. And when you do it by hand, like it was in the one in the 1.4 version, because then it's a little bit difficult to do that and when you to learn and test it, then it's much more difficult to create a test system, because you have to create, not the users only. So the admin user and the user one, for example, which interacts with the network, you have also to create the peer the order us. And for every network element in this, this fabric network, you have to create an identity. And here, in this network script, you find some scripts, where you can see how you can do this later in the session. I have plans to show you how we can do this and how we can play with the fabrics. Okay, because fabrics is also important here. Maybe we will do it earlier, because in the check the chain code has also the possibility to check the identity. And in this identities, we can have some special properties. So maybe this is called an at root, at root paste chain code. And then at root paste chain code that we can say, okay, in this set in this certificate from this user. This is this certificate belongs to the marketing department or to the finance department, for example. Every member of this finance department can call this chain code function, especially this revenue function. And that's the reason why it's important also to know as a chain code developer, how you can start and how you can modify this certificate identities, these identities. Yeah, so I think we, this is a good, it's also good for no cheat for learning the chain code part, because at root base chain code, and isn't topic also, also in for the certification. And this is the permission system. So we have to take care on the permissions, and we don't have a user name and the password here to give a particular user any access rights. Because we have an RSA, key authentication. And, but we can use, we can create a new identity with a special property, for example, so indicate in the way how we need this, and then our chain code can react on this property. And you can say if this identity has this property, then you can access this, this particular function, or this chain code even, and that's the reason why we, we have also here these before section. We can hear in this before section, we can do the logging. Okay, we can get the transaction ID to log or whatever you want. Okay, but we can also check on this position, if the user, if this not the user so we don't have a user we have an identity. So, and if this identity has the proper access rights to access this chain code, or later to access this function. And that's important to know how you can start a fabrics, see a how you can create how you can interact with this very safe. In terms that you can modify these attributes, and then you can react on the chain code directly to this properties, and the simple story the clearest example is that the revenue. Maybe all this revenue. Some, some from this revenue could only be called from the bookkeeping department, and not for the marketing or for a technical department, for example, and this is something what you can make with the train code in the combination with this certificate So, but this will definitely, definitely, definitely come in one of the next sessions. But from the chain code perspective, not so much from the administrator perspective. Can, can we use a local local version of couch TV installed locally. Okay, so, so you want to use not the Docker version of couch to be you want to use a native version. And by a hundred. If this is working. So, I haven't seen an example I have always seen the examples with with couch to be as a container, but why not. So, why not so the only thing is that we need because the Docker container. I think that the Docker container does is that the one the couch to be, and we have linked all the storage outside of this container. So, maybe this, I think I haven't tried it but I think it could be possible that you can also use couch to be in a native version, and not in the Docker version. That is the tool can we start it in development mode. Of course, I think so, I think so, I haven't tried it, but I think so, I think so. Also the, can you run a native version of it. The binary. Yes, yes, I think and there are some examples. Your favorite CA has a separate documentation, and I, and I think I can remember that there was a documentation, how you can run the physics a natively, and not with Docker container. So, but for this you have to look to the fabric. Okay documentation. And let me check. There's a user guide. I think I saw. I'm not sure, but I think I saw a version, which is used. Then, which uses the native, the physics a server in a native. I can try to figure it out and I will post this or you can post this question on the GitHub some Linux page here. I will, I will post it. Yes. Yes, please. So when you have here any discussion side, then I have a little bit time to think about that and then I can look if there is an solution for that. Okay. Thank you very much. Welcome. Any other question. Yeah, if not, query is still writing to the blockchain, isn't it query isn't writing. query is creating not writing. So, and the blockchain. The question is what is the blockchain. And the blockchain is somebody asked how we can query the history of an asset. Yes, you can do this. And the history of an asset means all the transactions of an asset. And the query goes all goes always to the world state here. Yeah. So, and the query when you use the query command from the CLI or from the, from the not just SDK, then it will query only the beer and the local the local state database, which is installed on that particular beer, which you are connected here in this test scenario, we have only one peer. So, but we can use this in the session on the last meetup. I have shown you how you can install this, this chain code. And so on the test on the official test network. And then, you can try to connect to when you try to connect to this net but you have to set the proper environment variables. So we have seen the script set global's with one, two, and three. And with this, you set the proper environment variable so that the local peer command knows to which peer you, you wants to connect, and then these state database is used to query the ledger, and there is nothing written but only a week process to this world state. And it doesn't matter if this level to be a culture to be. So, and to the blockchain query is still writing to the blockchain. Yeah, the blockchain. I don't think so. So the right term must be to the world state. Because the blockchain here is something called the ledger and the world state represents the last status of an asset. But it's a little bit difficult with the term so we have to be careful with the terms. Okay, any other question. Then, thank you for your attention. And yeah, have a nice weekend evening, morning or whatever. And we will see you next time.