# Updating the UI
At this point, we have a functioning blockchain. Now, we can add a UI to upload file hashes from our browser.
First, start by navigating to localhost:8080
, which hosts our vue applicaton.
# Creating a new Component
In order to make it easier for users to upload a hash to the blockchain, we will create a new component that lets someone drag and drop a file into the UI. The component will calculate the file hash, and the user will have the option to upload this proof as a claim.
We can create a new folder and file called vue/src/components/DropZone.vue
with following content:
# vue/src/components/DropZone.vue
Import and add our new component DragZone
into our vue/src/views/Index.vue
file within <script></script>
tags:
# Index.vue
Now, we should see our UI update whenever we add something to our component.
# Component layout
Next, let's add some elements to create the layout for our component.
We will be reusing a few components from the @tendermint/vue
component library, as well as creating our own drop zone.
# vue/src/components/DropZone.vue
Back to vue/src/views/Index.vue
, add the following JavaScript code right after previous section added in <script></script>
tags:
# Implementing our hash functionality
As mentioned earlier, we want to be able to upload a file to the browser, calculate its hash, and submitting our hash to the blockchain.
First, we will add the js-sha256
package. Let's install it via npm
, and make sure we're in the vue/
directory when we run the following command.
Once installed, we can add the import
and hash(e){}
functionality for creating the hash:
And now we can add our submit(){}
function, which will dispatch actions to the cosmos
store for submitting and fetching things from our blockchain.
Voilà! We can now log in using the mnemonic provided when running the starport serve
command, and start uploading proof of files as claims to the blockchain!
Congratulations, your app is complete!