Last blockchain projects

This commit is contained in:
xalava 2022-12-20 11:39:30 +01:00 committed by Dav Hojt
parent 90a0e60450
commit d043ac37a8
6 changed files with 344 additions and 47 deletions

View File

@ -0,0 +1,43 @@
# A network dashboard and benchmarking tool
Blockchain nodes participate in a common peer-to-peer network retrieving information, executing and validating transactions and blocks. However, software clients differ in their functionalities and resource consumption. The purpose of this project is to create a tool, `benchy` that can launch, monitor and benchmark Ethereum networks.
## launch-network
At first, we will focus on deploying a private Ethereum network while monitoring the nodes. The nodes can be launched directly or within containers.
* The network should consist of five nodes named Alice, Bob, Cassandra, Driss, and Elena. The first three are validating nodes. Each node has a corresponding Ethereum address.
* Two different clients must be used, for instance, Geth and Nethermind
* The consensus mechanism must be clique.
The network should be launched with the command `benchy launch-network`. The nodes should be launched in the background and the command should return immediately.
## Infos
Using the `infos` command, Benchy should display information on each node, in the terminal or in a webpage. The information must include:
* Their latest block
* Their list of connected peers
* The number of transactions in their mempool
* Their current CPU and memory consumption (Hint: the outputs of commands such as `docker stats` or `ps` can be used)
* Their corresponding Ethereum address and its balance.
## Scenario
To analyze our network, we need to simulate some transactions. Benchy should propose the following scenarios available with the command `benchy scenario X`. Each scenario must provide feedback on its execution, including updated balances after transfers.
0. Initialise the network by letting it run for a few minutes. Validating nodes must have Eth available as reward or part of the initial configuration.
1. Alice sends every 10 seconds 0.1 ETH to Bob
2. Cassandra deploys an ERC20 smart contract with 3000 tokens BY, and gives 1000 to Driss and 1000 to Elena.
3. Cassandra tries to send 1 ETH to Driss and immediately tries to cancel it by sending a transaction with a higher fee to send it to Elena.
## temporary-failure
To study our network further, benchy can disrupt the current network by randomly stopping one node of the network. The command “temporary-failure X” stops the node X for 40 seconds and puts it back online.
## Optional
* _an option `-u [time] runs any command continuously each time in seconds, 60 by default._
* _Add the possibility to connect one node to a testnet network _
* _Infos displays information only about this node_
* _`Scenario` runs the same scenarios on different addresses_

View File

@ -0,0 +1,37 @@
## Benchmarking tool audit
#### Read the documentation
##### Does the README file contains the instructions to launch the project?
##### Are two different clients launched?
##### Is clique the consensus algorithm?
#### Launch the network with the `launch-network` and display its status with `infos`
##### Does the command launch the five nodes?
##### Does the interface display the latest block of each node?
##### Does the interface display their Ethereum address and balance?
##### Does the interface display the CPU and memory consumption of each node?
#### Launch scenario 0
##### Does Alice, Bob and Cassandra have a positive balance of ETH?
#### Launch scenario 1
##### Does the command provide feedback?
##### Does the `infos` command show the updated ETH balance?
##### Does the `infos` command displays transactions in the mempool?
#### Launch scenario 2
##### Does the command provide feedback?
##### Do Driss and Elena appear to have received 1000 BY tokens?
#### Launch scenario 3
##### Does the command provide feedback?
##### Does the `infos` command show the updated balance of Elena receiving one ETH?
#### Run `temporary-failure Alice` and launch `infos`
##### Is the node disabled in the `infos` output?
##### Does it come back online after 40 seconds?
##### Does it appear to be up to date a couple of minutes later?
### Bonus
##### Does the `-u` option allow you to launch each command with a regular update?
##### Does the tool offer the possibility of launching a node connected to one of the testnet networks?

View File

@ -0,0 +1,182 @@
# An international settlement platform
_"Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter." - Eric S. Raymond_
One of the key elements of blockchains' value proposition is providing the technology stack for the “internet of value”. For this, a combination with existing financial instruments is necessary. Several startups and experiments have been developed with this objective.
In that context, we will build a trading platform. First, we will represent a stablecoin, shares and bonds on a private blockchain network. Then a marketplace website will allow users to list, buy and sell assets.
In this project, you are free to use the blockchain, technologies, and tools that you want. However, the project must offer complete documentation.
## Private network
The network must have a minimum of 3 validating nodes. A script must facilitate the deployment of the network. You can reuse prior work.
## Financial instruments
Three categories of financial instruments can be exchanged on the platform. Functionally, each asset is a type of smart contract
* **Stablecoins**: It must be a standard fungible token (ERC20 or equivalent). It initially has 1000 units. The creator of the stablecoin can issue or remove units.
* **Shares**: Shares are a fungible token for each company. Occasionally, its issuer can do a dividend payout. In that case, the issuer sends the stablecoin to the share contract, and each owner can retrieve proportionally to its possessions.
* **Bonds: **A smart contract represents all the outstanding bonds from an issuer. Each bond has a unique serial number, a current principal, an interest rate, an issuance date, a maturity date, a current owner, and if it has been repaid. For simplicity, we assume each bond to be issued for one year, requiring only one payment.
## Populating
In order to facilitate tests and audits, we will populate those financial instruments. An interactive script is available to create several addresses and deploy smart contracts.
* A stablecoin called “triangle” with the ticker “TRG” and 4000 units available.
* Shares from “Clove Company” represented as “CLV” and “Rooibos Limited” “ROO”, with 100 shares each.
* Government bonds, “GOV”, for a principal of 200 each and an interest rate of 10%, 20 units.
Each instrument is issued by a distinct address that owns all units initially.
Additionally, the script asks for two Ethereum addresses, Aya and Beatriz.
- Aya should receive 200 TRG, 10 CLV and 2 GOV.
- Beatriz should receive 150 TRV, 20 ROO and 5 GOV.
## Marketplace
The marketplace consists of
* A web interface that allows users to visualise information and give orders.
* A server with an API and a database that stores listed assets and orders.
* A multi-signature vault smart contract that contains customer assets.
Our model is hybrid, as order execution is centralised, but assets are not in full custody of the platform.
## Web interface
The interface must consist of a homepage, an asset page, a portfolio page, and an FAQ page.
### Homepage
An introduction page to the platform that allows the user to connect a wallet
### Asset pages
A page per asset (only share and bonds) that provides on the left a curve with the price of prior trades and on the right control buttons
* The price by default is 10 TRG for a CLV and a ROO share and 200 TRG for GOV bonds. The curve is a straight line until trades are made.
* Command buttons allow users to
* Create a sell order for this asset or a buy order for this asset with an input field allowing them to select the number of units and establish a price.
* To buy or sell a certain asset at the current market price.
### Portfolio page
A portfolio page that shows to the user his possessions.
A table shows in one column the number of units available in total for each asset and another column with the amount currently stored on the platform with a button to withdraw it. Each asset name should redirect to the dedicated page.
<table>
<tr>
<td>
</td>
<td>
<p style="text-align: right">
On platform</p>
</td>
<td><p style="text-align: right">
Total available</p>
</td>
</tr>
<tr>
<td>TRG
</td>
<td><p style="text-align: right">
0</p>
</td>
<td><p style="text-align: right">
300</p>
</td>
</tr>
<tr>
<td>CLV
</td>
<td><p style="text-align: right">
19</p>
</td>
<td><p style="text-align: right">
19</p>
</td>
</tr>
<tr>
<td>ROO
</td>
<td><p style="text-align: right">
0</p>
</td>
<td><p style="text-align: right">
0</p>
</td>
</tr>
<tr>
<td>GOV
</td>
<td><p style="text-align: right">
0</p>
</td>
<td><p style="text-align: right">
5</p>
</td>
</tr>
</table>
A visualization part allows the user to have a sense of his possession in TRG. For instance, a pie chart proportional to the current price of each asset can be displayed. For instance, assuming the default prices, the table above should render this way.
![alt_text](viz.png "Vizualisation")
### FAQ page
An FAQ page that explains how to use the platform
## The server
The server serves the fronted using the database information, exposes an API for the frontend and interacts with the blockchain. Its API must offer a function to monitor deposits, triggered from the user interface, that verifies on the blockchain the transaction that sent the funds and another one to authorise withdrawals.
The database contains
* A table with the assets usable on the platform, their type, the address of their smart contract, and their price history.
* A table of the users of the platform registered after the first connection. They must provide their legal name and upload a “passport” picture. No check is made when login in, but the picture is stored for future reference
* A table of all ongoing sell and buy offers on the platform
## The vault smart contract
The vault smart contract will receive the various financial assets. In a simple form, it includes an `operateWithdrawal(user, asset, amount)` reserved to the platform issuer allows the platform to send assets to the user, after verifying that the funds were theirs and that there are no pending orders.
_Optionally, a more sophisticated security model can be proposed._
## Trade execution
If a user, Aya, wants to sell CLV shares, she will go to the dedicated CLV page. On the panel on the right, she will select a number of shares, for instance 5, among her total number of shares, and a price, for instance, 9. The shares will then be transferred to the smart contract of the platform. Her address however will be approved to retrieve. When a user, Beatriz, wants to buy 3 CLV shares at the current market price, he selects this option on the panel. The platform will select the best offers. In this example, it will retain the 3 shares of Aya as available. Then, the platform will update the balance of both users in its database.
The platform must handle all the cases where various offers must be used to fulfil a demand.
## Withdrawal
At any point, the users can ask to withdraw their funds. On their portfolio page, users can click on assets that are on the platform. The platform server verifies that the assets are not part of any pending offer and send an `operateWithdrawal()` to the vault smart contract. Once validated, the frontend updates the user information.
## Documentation
In addition to the FAQ on the website explaining functionality as mentioned in the interface section, we need a full developer documentation. It must explain
* How to launch and deploy the platform. It must contain a step-by-step guide to install dependencies and launch the project.
* Describe how to launch the populating script (see section populating)
* Describe the architecture of the project
* Specify each API function exposed from the server
* Describe in detail each smart contact function of the smart contract vault.
The README file at the root of the project must specify where to find this documentation.

View File

@ -0,0 +1,35 @@
## Trading Platform Audit
#### Read the documentation
##### Does the README file contain or redirect to the instructions to launch the project?
##### Are the instructions to install and deploy the project usable to you?
##### Does the documentation contain a description of the architecture of the project?
##### Does the documentation contain details on the API and smart contract functions?
#### Launch the project
##### Is a blockchain network running?
##### Can you display the web interface?
##### Does the homepage allow you to connect a wallet?
#### Connect a wallet
##### Were you asked to provide a name and upload a passport picture?
##### Does your wallet appear to be connected?
#### Use the provided script to populate the platform
##### Was the documentation clear enough to launch the populating script?
##### Does the website show the various digital assets?
##### Did the two accounts receive the corresponding asset looking at the portfolio page once connected?
#### As the first user, Aya, opens the CLV page and offers to sell 10 CLV at 9 TRG
##### Does the interface reflect the amount of CLV available to Aya?
##### Does the order validation trigger a transfer of funds?
#### As the second user, Beatriz, open the CLV page and buys 10 CLV at market price
##### Does the platform correctly offer to buy at 9 TRG?
##### Does the trade seem to execute?
##### Does Beatriz have 60 TRG and 10 CLV now?
##### Does Beatriz portfolio display a withdrawal button for CLV?
#### From the portfolio page, click on withdraw for CLV
##### Does the transaction execute?
##### Does Beatriz now have full possession of its assets (in the second column)?

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -1,93 +1,93 @@
### Functional
### Functional
##### Try to create a new user and login.
##### Try to create a new user and login.
###### Can you confirm that the user was created?
###### Can you confirm that the user was created?
##### Navigate to the homepage using the user you created. Try to erase products that were
##### Navigate to the homepage using the user you created. Try to erase products that were
##### not created by the user.
##### not created by the user.
###### Is it impossible to edit and delete products that were not created by your user?
###### Is it impossible to edit and delete products that were not created by your user?
##### Try to sell a product by creating an add with the user created.
##### Try to sell a product by creating an add with the user created.
###### Is it possible to create adds and sell a product using your user?
###### Is it possible to create adds and sell a product using your user?
##### Navigate to the homepage and try to edit the add that you have created.
##### Navigate to the homepage and try to edit the add that you have created.
###### Is it possible for you to edit your own add?
###### Is it possible for you to edit your own add?
##### Try to create another new user, login and create at least two new adds.
##### Try to create another new user, login and create at least two new adds.
###### Can you confirm that the new user and the adds were created?
###### Can you confirm that the new user and the adds were created?
##### Login in with the first user and check if the adds created by the second user are there.
##### Login in with the first user and check if the adds created by the second user are there.
###### Can you confirm that the adds created by the second user are present?
###### Can you confirm that the adds created by the second user are present?
##### Navigate to the homepage with a user of your choice and try to delete an add that you have created.
##### Navigate to the homepage with a user of your choice and try to delete an add that you have created.
###### Is it possible for you to delete your own add?
###### Is it possible for you to delete your own add?
##### Navigate to the homepage with any user and try to check who is selling each product.
##### Navigate to the homepage with any user and try to check who is selling each product.
###### Is it possible for you to see who is selling the products without opening the add?
###### Is it possible for you to see who is selling the products without opening the add?
##### Navigate to the homepage and try to find the cart icon.
##### Navigate to the homepage and try to find the cart icon.
###### Can you confirm that the cart icon is present in the homepage?
###### Can you confirm that the cart icon is present in the homepage?
##### Try to add one item to the cart using the first user.
##### Try to add one item to the cart using the first user.
###### Can you confirm that the item was added to the cart of the first user?
###### Can you confirm that the item was added to the cart of the first user?
###### Did the message "Added to your cart" appear on the screen when you added something to the cart?
###### Did the message "Added to your cart" appear on the screen when you added something to the cart?
###### Can you confirm that the cart icon in the homepage shows the number "1", meaning that you have one product in the cart?
###### Can you confirm that the cart icon in the homepage shows the number "1", meaning that you have one product in the cart?
##### Try to add four more items to the cart.
##### Try to add four more items to the cart.
###### Can you confirm that all the added items are present in the cart?
###### Can you confirm that all the added items are present in the cart?
###### Can you confirm that the cart icon in the homepage shows the number "5", meaning that you have five products in the cart?
###### Can you confirm that the cart icon in the homepage shows the number "5", meaning that you have five products in the cart?
##### Try to open your cart and check if you can see how much you have to pay for all the products in your cart.
##### Try to open your cart and check if you can see how much you have to pay for all the products in your cart.
###### Can you confirm that the cart displays the total of all the products in your cart?
###### Can you confirm that the cart displays the total of all the products in your cart?
##### Try to open your cart and remove one item from it.
##### Try to open your cart and remove one item from it.
###### Can you confirm that the product was removed from the cart and the message "Removed from your cart" appeared on the screen?
###### Can you confirm that the product was removed from the cart and the message "Removed from your cart" appeared on the screen?
##### Try to go to the cart and check the total.
##### Try to go to the cart and check the total.
###### Can you confirm that the total was updated accordingly when you removed the item?
###### Can you confirm that the total was updated accordingly when you removed the item?
###### Can you confirm that the cart item in the homepage was updated an shows the number "4", meaning that you have four products in the cart?
###### Can you confirm that the cart item in the homepage was updated an shows the number "4", meaning that you have four products in the cart?
##### Try to login with the second user and check if the cart is empty.
##### Try to login with the second user and check if the cart is empty.
###### Can you confirm that the cart is empty, and the cart from the first user was not carried to the second user?
###### Can you confirm that the cart is empty, and the cart from the first user was not carried to the second user?
##### Try to logout and add items in the cart without any user. Now after you add items to the cart, login to one user of your choice.
##### Try to logout and add items in the cart without any user. Now after you add items to the cart, login to one user of your choice.
###### Can you confirm that the items that you added to the cart are present in the user cart?
###### Can you confirm that the items that you added to the cart are present in the user cart?
##### Try to add some items to the cart and then push the button `Empty cart`. After the message appears, confirm that you want to empty the cart.
##### Try to add some items to the cart and then push the button `Empty cart`. After the message appears, confirm that you want to empty the cart.
###### Did the message "Are you sure?" appeared on the screen for you to confirm the action?
###### Did the message "Are you sure?" appeared on the screen for you to confirm the action?
###### After the confirmation were you redirected to the homepage?
###### After the confirmation were you redirected to the homepage?
### Bonus
### Bonus
###### +Can you confirm that the student created or added something new like a new brand or the category field?
###### +Can you confirm that the student created or added something new like a new brand or the category field?
###### +Can you add a product to the cart without opening the add?
###### +Can you add a product to the cart without opening the add?
###### +If you add four products to the cart from the same seller, can you remove just one from the cart and keep the other three?
###### +If you add four products to the cart from the same seller, can you remove just one from the cart and keep the other three?
###### +Did the student implement its own display and design?
###### +Did the student implement its own display and design?
###### +Did the student implement a payment method?
###### +Did the student implement a payment method?