1

I am developing a voting application using blockchain (ganache). So basically i am registering the candidates by a web form and storing the data in phpmyadmin database. Now i want to access this data in my smart contract(written using solidity) to give a drop down of the candidates contesting for the elections. I need a way to access my database tables in my smart contract written in solidity

0

You can't directly access any resources outside the blockchain. All the data your contract wants to use has to be input into the blockchain.

So you just have to have some functionality in your backend to send a transaction to the contract with all the candidate names.

| improve this answer | |
0

If you need to access data outside the blockchain, you can use an oracle. Here is a tutorial walk-through of how to do it: https://www.toptal.com/ethereum/ethereum-oracle-contracts-tutorial-pt1

The other possibility is to store the candidate information on the blockchain and updating the blockchain from your app.

| improve this answer | |
  • Strictly speaking your "the other possibility" is the same as the first one. Oracles are not miracle workers, they just input the data into the blockchain for you. – Lauri Peltonen Mar 11 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.