/land

land registry based on blockchain

Primary LanguagePython

ethereum land registry

land registry based on blockchain using ethereum network

Getting Started

These instructions will get you a copy of the project up and running on your local machine

Prerequisites

  • Nodejs - The web framework used
  • Ganache - Simulates an ethereum network for local development
  • Truffle - development environment for ethereum. Can be installed with $ npm install -g truffle

Installing

A step by step series of examples that tell you how to get a development env running

Clone this repo

$ git clone https://github.com/I-am-Dishon/land.git

Install dependencies

$ npm install

Change into truffle/ directory

$ cd truffle

Make sure ganache is running get the port it is running on in localhost and make sure is same as the one in truffle.js file. Compile contracts and deploy to the ganache network.

$ truffle compile
$ truffle deploy --reset --network ganache
Running migration: 2_vote.js
  Replacing Propertyf...
  ... 0x301d03eafc4f6bc13b26ca5771a6b6e783f47f710b2ed5bbad8288d7a2646a6e
  vote: 0x4610b7b59920b760d1164406a6f13f09043b6af3
Saving artifacts...

Get the vote contract string in this case 0x4610b7b59920b760d1164406a6f13f09043b6af3 and replace the contract variable in the event.js file this string will change evrytime you do a truffle deploy.

Go one directory up and run the index.js file to get node running

$ node event.js

If no errors show up you can do GET and POST requests to cast and retrieve votes. There are only two candidates

GET Vote count for candidate 1

$ curl -X GET http://localhost:8080/count/1

"0"

To cast vote you'll need the address of an account on the ganche network.

$ curl -X GET http://localhost:8080/count/1

"1"

Once the address of an account has been used to vote it cannot be used again. When we try to add property

$ curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "candidate=2&account=0x25660625C2919b6998c5dD7300ACE7a03db89855" http://localhost:8080/vote 

"Property has been transferred"