-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from 1M4nt0/Develop
v0.0.1
- Loading branch information
Showing
18 changed files
with
711 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,29 @@ | ||
# Instructions | ||
# Vehicle Registration Token (VRT) - Interface | ||
|
||
## Endpoints HTTP | ||
An interface for Vehicle Registration Token Project, a protocol for trace vehicle's property and their history in Ethereum blockchain. | ||
|
||
Graph: http://127.0.0.1:8000/subgraphs/name/example/graphql | ||
## Prerequisites: | ||
|
||
IPFS: http://localhost:5001/ | ||
- [Docker](https://www.docker.com/get-started/) | ||
- [NodeJS](https://nodejs.org/it/) | ||
- Before starting interface you need to run [Vehicle Registration Token (VRT) - Core](https://github.com/1M4nt0/tesi-uniud-2022-core). | ||
|
||
## Launch application | ||
## Starting interface | ||
|
||
### Start Dev Server | ||
### Clone repository | ||
|
||
1. Run docker (docker compose up) | ||
2. npm run dev | ||
``` | ||
git clone https://github.com/1M4nt0/tesi-uniud-2022-interface | ||
### Gen Dev Files | ||
cd tesi-uniud-2022-interface | ||
1. npm run build-contract-abi | ||
2. npm run genContractType | ||
npm install | ||
``` | ||
|
||
### Migrate contracts to ganache | ||
### Start docker container | ||
|
||
1. truffle migrate | ||
``` | ||
cd tesi-uniud-2022-interface/docker | ||
### Create new subgraph | ||
|
||
1. npm run codegen | ||
2. npm run create-local | ||
3. npm run deploy-local | ||
|
||
### Upload files to ipfs | ||
|
||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\metadata1.json http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\metadata2.json http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\1_immatricolazione.json http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\1_immatricolazione.pdf http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\2_incidente.pdf http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\2_incidente.json http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\3_meccanico.pdf http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\3_meccanico.json http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\4_revisione.pdf http://localhost:5001/api/v0/add | ||
curl -X POST -F file=@%cd%\test\VehicleMeta\JSON\4_revisione.json http://localhost:5001/api/v0/add | ||
|
||
### Access contracts and create tokens | ||
|
||
truffle console | ||
const VRT = await VehicleRegistrationToken.deployed(); | ||
await VRT.mintToken("http://127.0.0.1:8080/QmPvVh4of1B8VdGgAZafDCK5g5DeLRa6sCbfVoGJ92M2v9", {from:accounts[0]}); | ||
await VRT.mintToken("http://127.0.0.1:8080/QmUZxpzDj3v8xifQX6Lqv6wNdPTDkNWuskMRuiN68N9MbG", {from:accounts[0]}); | ||
await VRT.addCertification(1,1,"http://127.0.0.1:8080/QmPERK8NK6ssaNCPMoQa1Qencka4bMrqi3y2xx9JFTdsnC", {from:accounts[0]}); | ||
await VRT.addCertification(1,2,"http://127.0.0.1:8080/QmSndp3U5QwC56xcssjL19gmS1tTQHe42xyDZukJZgYCEB", {from:accounts[0]}); | ||
await VRT.addCertification(1,3,"http://127.0.0.1:8080/QmUz8HTHPRWHapsvoDyE2hvdmshHE3UXoqEgkTToWvG1La", {from:accounts[0]}); | ||
await VRT.addCertification(1,6,"http://127.0.0.1:8080/QmYkz2tVdiSbws2GCEk71cVrGEneSWhZsPbj6KiyanfLMB", {from:accounts[0]}); | ||
const VMP = await VehicleMarketplace.deployed(); | ||
await VMP.placeNftOnSale(1,20000); | ||
docker compose up | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
version: '3.8' | ||
|
||
services: | ||
app: | ||
image: im4nt0/vrt-interface | ||
container_name: vrt-interface | ||
restart: always | ||
build: | ||
context: .. | ||
dockerfile: Dockerfile | ||
args: | ||
DOMAIN: host.docker.internal | ||
NETWORK_ID: 5777 | ||
CHAIN_ID: 1337 | ||
TESTNET_RPC: http://host.docker.internal:8545 | ||
TESTNET_EXPLORER_URL: http://host.docker.internal:4000 | ||
IPFS_GATEWAY_URL: http://host.docker.internal:8080 | ||
IPFS_API_URL: http://host.docker.internal:5001 | ||
GRAPH_QUERY_BASE_URL: http://host.docker.internal:8000 | ||
SUBGRAPH_NAME: vrtproject | ||
extra_hosts: | ||
- host.docker.internal:host-gateway | ||
ports: | ||
- "3000:3000" | ||
networks: | ||
- vrt-project-network-proxy | ||
|
||
networks: | ||
vrt-project-network-proxy: | ||
external: | ||
name: vrtproject |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.