0

I wanted to know what kind of transaction validation miners would do for the code written below. The code below is simple creating a student logs. So when i say the transaction will be validated by miners before making a block then what exactly is the expectation as in this transaction no ether is involved ?

I understand that the EVM is verifying the transaction(may be they check the address it came from is valid , the signature and all that stuff) and expects required gas to process the below code. My question is in context of bitcoins, in bitcoins the coins are tracked and each minor verify the contains of the transaction not just the signature. It also verify where the account trying to send bitcoins is actually owning it to transfer and all that kind of stuff. Now when my smart contract is just creating a student record as in below code, how minor can verify what the code is trying to push in block is valid. Now when we try to modify the record that time also it will get updated to new value. I can read all logs to see the vales but when we call is immutable and needs network consensus to modify anything then how it works with Ethereum. May be I am seriously missing some concepts here but if any one can guide me to some document to refer …. it will be great help.

function createStudents(string fname, string year, string hash, uint256 _ipfsHash) public {
Student memory student = Student(fname, year, hash);   
students.push(student);
studentInfo(fname, year, hash);
ipfsHash.push(_ipfsHash);
}
0

Your function doesn't make sense to me. You're emitting events, which is a change to the blockchain, in a getter function. Why not using a return value?

Back to your question:

So when i say the transaction will be validated by miners before making a block then what exactly is the expectation as in this transaction no ether is involved.

Every function called via an Ethereum transaction, will be run by the miners through the EVM based on the current state. If the execution is ok from the point view of the EVM, miners will include this transaction into the chain. Moreover, transactions have to be well-formed and they need a correct signature. And finally, the sender of the transaction has to have enough ether in his account for paying for the execution (-> gas usage).

  • Thank you. I have updated my question. Please check. I have also modified my example to make it more aligned with my question. – SSS Oct 5 '18 at 13:00

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.