Skip to content

A blockchain DApp based implementation of Vehicular Ad-hoc Netwoks to provide a decentralized approach to the prevalent VANET solution, making things faster, reliable and less prone to security breaches and cyber attacks.

Notifications You must be signed in to change notification settings

snigdha-dobhal/VANET-In-Blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

VANET-In-Blockchain

A blockchain DApp based implementation of Vehicular Ad-hoc Netwoks to provide a decentralized approach to the prevalent VANET solution, making things faster, reliable and less prone to security breaches and cyber attacks.

Steps to run the application

  1. Install ethereum testrpc (ganache-cli) in your machine. For linux terminal, use the command: testrpc to start the ethereum testrpc server. By default testrpc gives you 10 accounts, indexed from 0 to 9. These are to be used as account addresses for the Dapp users.

  2. Open Remix IDE in a web browser: https://remix.ethereum.org/ This IDE will be used for compiling the solidity code and deploying and running the transactions.

    Add the solidity files from the code base to the Remix IDE under the contracts folder. On the left most vertical strip on the IDE, you will see certain icons representing the IDE plugins. Select the Solidity Compiler. If you do not see an icon for the solidity compiler, you can enable this tool from the IDE plugins manager.

    The first line of the solidty code mentions the compiler version ^0.4.18 In the Solidity compiler, select the exactly same version from the compiler drop-down menu and compile the codes.

  3. Once the solidity smart contract compiles successfully, select the Deploy and Run Transactions plugin from the left most vertical strip of the Remix IDE.

    From the Environments drop-down, select Web3Provider and enter the apt Web3 Provider Endpoint. This is the host:port socket on which your testrpc is running. By default, this will be- http://127.0.0.1:8545

    Remix will pop up an error/warning message if your testrpc is not running. So make sure that testrpc is up and running before selecting the Web3Provider option.

    Once you have selected the Web3 Provider option, you will notice that in the accounts drop-down, you get a list of the same 10 accounts which the testrpc server provided you. Select any one of these accounts from the drop-down.

  4. Save the HTML and CSS files in your local. Make sure they are saved in the same folder. Open the HTML files in a code editor and locate the following statements-

         web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
    

    This statement correponds to the socket on which your testrpc server is running. Update the port number if it is not the default 8545.

         web3.eth.defaultAccount = web3.eth.accounts[0];
    

    You need to update the index according to the account you selected in Remix IDE. For eg, if you selected the fourth account, index will be 3 (zero-based indexing) and the statement would become-

         web3.eth.defaultAccount = web3.eth.accounts[3];
    

    Go to the deploy and run transaction section of the Remix IDE and locate the sub-section: Deployed contracts. For each deployed contract you will find the a statement similar to:

         MESSAGE AT 0X64C...D5685(BLOCKCHAIN)
    

    This is the address at which the smart contract has been deployed. Copy this address to clipboard and locate the following statement in the HTML file:

         var MESSAGE=MESSAGEContract.at('some address');
    

    Replace the address with the address you copied from Remix IDE.

    Update these statements in both the HTML files, save them and open the HTML files in a web browser.

  5. Go back to the Remix IDE and hit Deploy. Your DApp is now ready to function! You can interact with it using the web UI as well as the Remix IDE Deployed contracts section. You can deploy multiple contracts and can test it with multiple accounts.

    A VANET simulation can be performed using Sumo or NS3 and the data can be fed to the DApp.

About

A blockchain DApp based implementation of Vehicular Ad-hoc Netwoks to provide a decentralized approach to the prevalent VANET solution, making things faster, reliable and less prone to security breaches and cyber attacks.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published