- André Reis - fc58192
- Daniel Nunes - fc58257
- Gonçalo Pinto - fc58178 Group 18
Faculdade: https://ciencias.ulisboa.pt/
The project is a deterministic wallet-like service that manages coins based on the UTXO (Unspent Transaction Output) model introduced in Bitcoin and NFTs (Non-Fungible Tokens) that can be transacted using the coins. In this model, each object (coin) represents a certain amount of currency a user possesses. This means a transaction consumes a given number of input objects to produce one or two output objects.
In the picture, there is an example of the project in runtime.
The system keeps track of two types of tokens and their ownership. These tokens contain the following information:
- ID: an integer (int) with the coin ID (no two coins can have the same id)
- Owner: an integer (int) with the id of the client owning the coin
- Value: a real number (float) with the value of the coin
- ID: an integer (int) with the NFT id (no two NFTs can have the same id)
- Owner: an integer (int) with the id of the client owning the NFT
- Name: the name (a String) of the NFT
- URI: the URI (a String, typically a URL) of the NFT
- Value: a real number (float) with the value of the NFT
- MY_COINS(): Get the IDs and values of the coins associated with this user.
- MINT(value): Require the value of the coin to create for the issuer. The issuer needs permission to execute this operation, as defined during system initialization. The operation returns the ID of the newly created coin.
- SPEND(coins, receiver, value): Requires an array with the IDs of the coins that will be used as input, the ID of the user that will receive the transfer (receiver), and the value to be transferred. If the indicated coins provide enough funds to execute the transaction (sum(coins) >= value), the operation consumes the coins and generates two coins, one for the receiver with the value it received and another for the issuer (who invoked the operation) with the remaining value (sum(coins) - value). The operation returns either the ID of the coin created for the issuer with the remaining value, 0 in case no coin was created (due to no remaining), or -1 if the operation failed.
- MY_NFTS(): List the ID, name, URI, and value of the NFTs the issuer possesses.
- MINT_NFT(name, uri, value): Create an NFT for the issuer with the name and uri specified. There cannot be two NFTs with the same name. Returns the id of the newly created NFT.
- SET_NFT_PRICE(nft, value): Change the price of a given NFT owned by the issuer to a new value.
- SEARCH_NFT(text): List the id, name, URI, and value of the NFTs whose name contains the provided text (ignores case).
- BUY_NFT(nft, coins): Requires an array with the IDs of the coins that will be used as input and the ID of the NFT to be bought. If the indicated coins provide enough funds to execute the transaction (sum(coins) >= nft.value), the operation changes the NFT owner field to the buyer ID, deletes the provided coins, and generates two coins, one for the NFT owner with the value it received and another for the issuer (who invoked the operation) with the remaining value (sum(coins) - value). The operation returns either the ID of the coin created for the issuer with the remaining value, 0 in case no coin was created (due to no remain), or -1 if the operation failed.
Improvements on the ease of use of the application, making the user use less commands or be more with those that it uses. Improvements on the User Interface instead of using pure simple terminal. Give more feedback on the user's actions such as confirmations or erros. (Improvements on the security of the accounts.)
All the required functionalities for the project are working. It is necessary to write the command name exactly as shown without spaces neither before nor after the command name
To build the project, run the following command: Linux:
./gradlew installDistWindows cmd:
gradlew installDistTo enable read-only operations, open the file build/install/library/config/system.config and change the option in the last line to true.
To start the server, run the following command: Linux:
cd build/install/library && ./smartrun.sh bftsmart.intol.bftTokens.BFTTokenServer <server id>Windows cmd:
cd build/install/library && smartrun.cmd bftsmart.intol.bftTokens.BFTTokenServer <server id>To start the client, run the following command: Linux:
cd build/install/library && ./smartrun.sh bftsmart.intol.bftTokens.BFTTokenInteractiveClient <client id>Windows cmd:
cd build/install/library && smartrun.cmd bftsmart.intol.bftTokens.BFTTokenInteractiveClient <client id>