upperwal / OpenComplaintNetwork

OCN is a public redressal system and open police complaint filing system on Blockchain.
MIT License
22 stars 7 forks source link

Issue i have created UI but my UI code is not integrating woth solidity Smart contract #2

Open shantanu49 opened 6 years ago

shantanu49 commented 6 years ago

My solidity smart contract is not integrating with UI that inhave created with your code

upperwal commented 6 years ago

@shantanu49 Could you please elaborate? What do you mean not integrating?

shantanu49 commented 6 years ago

Actually, I am new to blockchain so I found your project interesting so, I was trying that, but I am unable to get the result. can you pls provide me steps or correct me.

  1. start ganache server using truffle.
  2. then npm start.

now my question is in this project have you used Metamask? and in your code in the file register.js their is no any calling of function getaccounts() but in your youtube video, they are showing under dropdown so we should add it by our own? or something else

I am also having some issue with my web3 version I think I am using 0.20.7 and your code is of 1.0.0 beta

I have a request to you can you please send me the step by step process to this mail is shantanu4994@gmail.com . Thank You !!

shantanu49 commented 6 years ago

Can you please help me out Sir

upperwal commented 6 years ago

@shantanu49

start ganache server using truffle.

This project does not use Ganache. Truffle is directly linked using Web3.providers.HttpProvider as given below

now my question is in this project have you used Metamask?

No, we haven't. Transactions are directly submitted to truffle using web3 API.

https://github.com/upperwal/OpenComplaintNetwork/blob/bf661e361b310b2bc5e7d361b3bf65dcce67a3a6/src/App.js#L29-L36

All the transactions are submitted directly using web3 to truffle. As there is only one contract it is initiated in App itself. You truffle should be running on port 9545 or change the above code accordingly.

in your code in the file register.js their is no any calling of function getaccounts() but in your youtube video, they are showing under dropdown so we should add it by our own?

Each component has a getAccounts method which uses web3.eth.getAccounts()

https://github.com/upperwal/OpenComplaintNetwork/blob/bf661e361b310b2bc5e7d361b3bf65dcce67a3a6/src/Components/Pages/View/view.js#L173-L179

I am also having some issue with my web3 version I think I am using 0.20.7 and your code is of 1.0.0 beta

yes, this project uses 1.0.0 beta but npm install should install all the dependencies.

It would be better to follow the instructions given in the README.md to run it successfully.

shantanu49 commented 6 years ago

Thank you so much sir Your reply was very helpfull to me. but this time I am getting error in the register.js file whenever i am clicking on the submit button to register a complain after filling the form on the register page then after clicking on submit button , the page is coming with an error and saying that this function is not defined. pls help me Abhishek Sir

shantanu49 commented 6 years ago

I am attaching pic of my Error please help me out abhishek Sir 20181021_142052

upperwal commented 6 years ago

this should be this.complainContract.methods.registerComplain, you are missing methods. It would be better if you first go through the docs. Web3 Contracts would be a good starting point.