New answers tagged

0

Your premise includes a whole bunch of odd assumptions but it isn't exactly clear what you are thinking or why you are thinking it. they will never want to use the address for searching f It's not necessarily about what a user would want to do. Contracts are about what the system must do. mappings are about internal organization so it "can do" it ...


1

Neither B nor A have storage of their own, they use the storage provided by C. I write a code similar and it works with both storage and memory. pragma solidity ^0.5.0; library A { struct S { uint256 a; } function foo(A.S memory a) internal view returns (uint256) { return a.a; } } library B { using A for A....


2

First of all, you can't really make an API call in blockchain the way you normally can in a python/java/go/other programming language. You have to make a call through an oracle like Chainlink. You can then, go ahead and make these API calls through these Chainlink oracles. You can do this for any API, and integrate it with any platform (like SAP).


1

Might sound silly, but are you sure you are not redeploying the contract on the restart? Make sure you are working on the same contract with the same state (data). If yes then you can try replacing your current validation with this one: require(bytes(hash).length > 0, "Empty hash!"); require(bytes(hashAlreadyRegistered[hash]).length == 0, &...


3

Yes the array taken is virtual in every aspect. Just assume that array is initlized with zero's. Since Storage is very expensive we don't need any zeros in it. unless explicitly defined by the user. A key/value store mapping 32-byte keys to 32-byte values will do the job nicely. An absent key is simply defined as mapping to the value zero. Because ...


Top 50 recent answers are included