Yilmaz
  • Member for 1 year, 8 months
  • Last seen this week
2 answers
20 votes
14k views
Difference between keccak256 and sha3
3 votes

Keccak and sha-3 are not the same. In 2007, U.S. National Institute of Standard and Technology (NIST) initiated a competition about SHA-3. In 2012, Keccak team won the competition. From then on, ...

View answer
3 answers
8 votes
836 views
Custom Exceptions in Solidity
1 votes

As of now you can throw an error like this. I am not sure when it was added: // SPDX-License-Identifier: MIT pragma solidity >=0.4.22 <0.9.0; /// Write custom Error! error MyCustomError(); It ...

View answer
1 answers
1 votes
37 views
Saving gas costs by combining variables?
1 votes

Think of solidity storage is an array of slots. each slot stores 32 bytes. [[],[],[],[],.......[]] If you define your variables with uint256 which is 32 bytes, first 4 slots will be reserved. But if ...

View answer
4 answers
45 votes
31k views
What is the difference between an internal/external and public/private function in solidity?
1 votes

• External: These functions are accessible from other contracts and transactions. They cannot be called internally unless the this keyword is used. • Public: By default, functions are public. They can ...

View answer
7 answers
24 votes
30k views
Smart Contract Error: Returned values aren't valid, did it run Out of Gas?
1 votes

This happened to me on my react app. I deployed to contract to Ropsten network, but metamask was using the Rinkeby account. So make sure whichever network you deployed, metamask should be using ...

View answer
2 answers
4 votes
1k views
Block header format
Accepted answer
1 votes

Parent hash: This is the Keccak 256-bit hash of the parent (previous) block's header. • Ommers hash: This is the Keccak 256-bit hash of the list of ommers (or uncles) blocks included in the block. • ...

View answer
1 answers
1 votes
488 views
Solidity Error: Cannot destructure property `interface` of 'undefined' or 'null'
1 votes

you are using old api on new version of solc. here is the implementation. const lotteryPath = path.resolve(__dirname, 'contracts', 'Lottery.sol'); const source = fs.readFileSync(lotteryPath, 'utf8')...

View answer
2 answers
1 votes
3k views
connecting to Metamask using React.js and Next.js without having to refresh the page each time
0 votes

Metamask injects web3 in old versions and ethereum in new versions. so it is easier to detect provider with @metamask/detect-provider import detectEthereumProvider from '@metamask/detect-provider' ...

View answer
2 answers
10 votes
13k views
Difference between window.ethereum and window.web3?
0 votes

web3 is an older implementation that still some clients can use. window.ethereum is new spec https://github.com/MetaMask/metamask-extension/issues/8077

View answer
2 answers
0 votes
43 views
How to properly configure web3 in a reactjs App?
0 votes

Based on your current set up, call this inside componentDidMount to get the provider: componentDidMount(){ const loadProvider = async () => { let provider; if (window.ethereum) { ...

View answer
2 answers
2 votes
268 views
How does NONCE prevent a replay attack in case of knowing NONCE value?
0 votes

The transaction gets RLP encoded and gets signed. Transaction includes "r,s,v" keys. If the attacker changes the nonce in order, "r,s,v" values will be invalid, so attacker has to ...

View answer
5 answers
8 votes
3k views
web3.eth.getStorageAt for mapping
0 votes

As of now, in order to retrieve mapping from storage, // . symbols that hash together. do not put . between hashValue= keccak256(key . slot) // hashed together in your contract, mapping is ...

View answer
2 answers
5 votes
622 views
What is the beneficiary in block header?
0 votes

The beneficiary field contains the 160-bit address of the recipient that will receive the mining reward once the block is successfully mined.

View answer
2 answers
0 votes
73 views
Accessing to a contract's public array from javascript
0 votes

You cannot retrieve whole array from solidity. You have to choose the index, that is why it is expecting 1 argument. If you want to get whole array elements in javascript, in solidity define a ...

View answer
2 answers
1 votes
66 views
What is a machine state in Ethereum?
0 votes

The machine state is maintained internally and updated after each execution cycle of the EVM. An "iterator function" runs in the EVM, which outputs the results of a single cycle of the state ...

View answer
3 answers
19 votes
9k views
What is calldata?
0 votes

The Calldata is a read-only byte-addressable space where the data parameter of a transaction or call is held. Unlike the Stack, to use this data you have to specify an exact byte offset and number of ...

View answer
2 answers
2 votes
176 views
Ethereum Bytecode
0 votes

You can write a smart contract in many languages, Solidity, Vyper, Yul, Mutan, Serpent etc. They all have different syntaxes. That is why source code is interpreted into the same standard bytecode for ...

View answer
3 answers
14 votes
799 views
Why does Ethereum have gas?
0 votes

If there was no fee, you could call a function infinitely and that would crash the smart contract. since you are paying money to call a function, no bad user will call any function infinitely. From ...

View answer
2 answers
2 votes
2k views
How does Ethash work?
0 votes

Ethash is the name of the PoW algorithm used in Ethereum. Originally, this was proposed as the Dagger-Hashimoto algorithm, but much has changed since the first implementation, and the PoW algorithm ...

View answer
2 answers
3 votes
208 views
RLP Rationale Question
0 votes

RLP is an encoding scheme developed by Ethereum developers. It is a specially developed encoding scheme that is used in Ethereum to serialize binary data for storage or transmission over the network ...

View answer
1 answers
1 votes
422 views
Can't send Ether to smart contract using Ethers.js
0 votes

here is the error: <input onChange={e => setWager(e.target.value)} placeholder="Send your ETH"/> there is no "value" prop. you should have <input value={wager} ...

View answer
1 answers
2 votes
37 views
Cannot call method with mocha
0 votes

For the version that you are using you should be adding a constructor to your contract: contract Inbox { string public message; constructor(string memory initialMessage) public { ...

View answer
3 answers
3 votes
3k views
TypeError: Type contract InsuranceClaim is not implicitly convertible to expected type address
0 votes

function createInsuranceClaim () public { // type is InsuranceClaim InsuranceClaim newInsuranceClaim = new InsuranceClaim(msg.sender); // push the address ...

View answer
2 answers
2 votes
3k views
using mappings inside structs
0 votes

Just keep the mapping outside the struct. you do not have to keep inside the struct mapping(uint => address) poolUserList;

View answer
3 answers
1 votes
77 views
Confusion with Memory vs. Storage
0 votes

contract Jacob { // this is placed into Storage string text; function doStuff() public view returns (string memory) { // you are making copy from Storage-to-Memory string ...

View answer
3 answers
11 votes
5k views
Multiple Inheritance and Linearization
0 votes

In multi-inheritance, the order of base contracts is very important. When a contract inherits from multiple contracts, there will be only one contract created. Solidity copies code from all inherited ...

View answer
6 answers
7 votes
10k views
Error : Could not connect to your Ethereum client with the following parameters:
0 votes

My project was using port "8545" on my old machine but when I switched to a new machine, Ganache was running on port "7545" and config file was set to be "8545". SO ...

View answer
3 answers
31 votes
29k views
How does Mapping in solidity work?
0 votes

mapping(uint256 => CampaignData) campaigns; Above mapping says, keys will be "uint" and the values will be "CampaignData" struct and label the variable with "campaigns&...

View answer
1 answers
0 votes
139 views
RuntimeError: abort([object Object]). Build with -s ASSERTIONS=1 for more info
Accepted answer
0 votes

I wrote the deploy() in try/catch block: const deploy = async () => { try { const accounts = await web3.eth.getAccounts(); console.log("Attempting to deploy from account", ...

View answer
2 answers
2 votes
844 views
Solc complier error "TypeError: Cannot read property 'TestToken.sol' of undefined"
0 votes

let contractSource = fs.readFileSync('/root/TestToken/TestToken.sol', 'utf-8') I believe you get the error here. this directory is valid in posix systems. If you are using non-posix os this will not ...

View answer