Hot answers tagged

4

If I understand correctly your want to upload a file from the client machine to the web application using the standard HTML tag <input type="file"> and then hash the content of the file. Your code is actually hashing the full path of the file. If you want to read the content of a file, I recommend to use FileReader like this: HTML: <div> &...


2

You should not specify the types of parameters when you pass them in a function-call: users[userID] = kullanicilar(string name, string surname, age); Change it to: users[userID] = kullanicilar(name, surname, age);


2

The order of arguments is always the same, though their names may vary. Also, you are supplying your own ABI file, so you most likely use argument names given in that ABI file. The EVM/Solidity wire protocol hashes only argument types, not their names, so the actual name is irrelevant in the raw blockchain data. A lot of tokens were deployed before ERC-20 ...


2

Solidity variable values can only be set from the contract. So you will definitely need some sort of setter functionality for the variable to be set to different values. Furthermore there is no functionality to "watch" a variable's value or something similar. You simply have to do the monitoring yourself. So when you implement functionality to set the ...


1

I'm going to suggest a more ethereum-like approach. You can probably do that with the experimental ABI encoder. As well as stability concerns, there is a serious problem with overall approach. The gas cost of the operation will increase with the size of the array. That will make it impractical or impossible to use if the array grows too large. In most ...


1

As mentioned by @goodvibration, you do not need to specify the types of the struct members when you declare a new struct "instance" ( new struct instance = new variable of type struct). Because the type is already specified in your initial struct definition This is why the compiler returns an error message : Basically, the Solidity compiler expects a ...


1

heyyy I found my answer guys :) thanks for the contribution the answer is just chance the mapping and forget the getUser function. code is : pragma solidity >=0.4.0 <0.7.0; contract NewHello{ struct user{ string name; string surname; uint age; } event infoChanged( string name, string surname, uint age ); uint newUser; ...


1

You can refer to this link to solve your doubts. Listen to events using web.js


1

Since all of the eventinloop events will be emitted in a single transaction, you will see the list of all events in the single calc() transaction. There is no way to react to the first event in the loop, before the second loop is executed (as transactions are atomic, so all events are emitted in a single transaction).


1

None of the above. revert() will ensure no event is emitted. This, because revert "reverts" state changes and events are, indeed, state changes. Ergo, any events are reverted so you won't get the diagnostic outputs you are looking for. Use revert() with reason, revert("<reason>"); or require() with reason, require(<exp>, "<reason>");. ...


Only top voted, non community-wiki answers of a minimum length are eligible