Yilmaz
  • Member for 1 year, 9 months
  • Last seen this week
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
What does it really mean to burn tokens?
1 votes

Burning a token means removing it from circulation, which reduces the number of coins in use. This mechanism is used to bootstrap a new currency or introduce scarcity, which results in the increased ...

View answer
What is DeFi decentralized finance?
1 votes

DEFI is a decentralized financial system that is more efficient, faster, and fairer. DeFi is a smart contract platform. dApps are a critical DeFi ingredient. dApps are like traditional software ...

View answer
Delete all elements from an array?
1 votes

you can assign the array to a new empty array paidPlayers=new address[](0);

View answer
Ethereum raw transaction structure
1 votes

0x // https://eth.wiki/fundamentals/rlp for more on f8 // 0xf8-0xf7=1byte=2 chars which tells you next 2 chars is the length of the paylaod f8 // length of payload. 0x69=105bytes=210 chars. 69 // ...

View answer
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
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
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
What is calldata?
1 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
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
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
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
Brownie cannot locate deploy.py script
0 votes

It happens to me when I type fast, I leave blank brownie run scripts /fileName.py It should be brownie run scripts/fileName.py

View answer
web3.js not working with React JS
0 votes

This is related to webpack setting. if you are using create-react-app, I posted an answer here: https://stackoverflow.com/questions/70472965/web3-issue-react-application-not-compiling/70512623#...

View answer
raise ValueError("Explorer API not set for this network") ValueError: Explorer API not set for this network
0 votes

It is not something related to your contract code, otherwise, it would not compile. If your brownie-config.yaml setting names did not match you would get an error. then only thing it might be is ...

View answer
Transaction malleability
0 votes

Transaction malleability is a Bitcoin attack that was seen due to a bug in the Bitcoin implementation. Due to this bug, it became possible for an adversary to change the transaction ID of a ...

View answer
How do flash loans work?
0 votes

As its name says, a flash loan is an instantaneous loan paid back within the same transaction. It is similar to an overnight loan in traditional finance but with a crucial difference: repayment is ...

View answer
Can we use "artifacts.require()" in react.js files?
0 votes

you can use in truffle artifacts.require() because in truffle.config.js, you already told truffle where to look for those artifacts. Artifacts are JSON files of the contracts. // truffle.config.js ...

View answer
Uncaught Error: Callback was already called in mocha
0 votes

the only issue I see is, the callback for it should be async describe('SimpleStorage', ()=> { it('deploy a contract', async ()=>{ console.log(simpleStorage); }); });

View answer
How to test if a TransactionHash is valid using web3?
0 votes

const search = async hash => { const re = /[0-9A-Fa-f]{6}/g; // 0x + 64 bytes if(hash && hash.length === 66 && re.test(hash)) { const item = await contract.methods....

View answer
What is Whisper and what is it used for?
0 votes

Whisper provides decentralized peer-to-peer messaging capabilities to the Ethereum network. It is an identity based messaging system It is a communication protocol that DApps use to communicate with ...

View answer
Estimate Gas cost for a function call in solidity (on-chain)
0 votes

After you successfully load the contract, you call the function, and calling the function will return an object. const result = await contract.methods .purchase(...args) .send({ from: ...

View answer
Can transaction hash be used to get v, r, s parameters using web3js?
0 votes

if you use the raw tx hash from etherscan you can get the v,r,s. for this raw tx example: ...

View answer
What are artifacts in truffle?
0 votes

Artifacts are simply the JSON files of the contracts. the meaning of artifact in software is anything that is created so a piece of software can be developed.

View answer
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
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
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
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
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
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