8

As of version 0.5.12, Solidity includes an assembly function chainid() that provides access to the new CHAINID opcode: function getChainID() external view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } To use it, ensure you set the compiler's EVM version to Istanbul with the --evm-version istanbul flag. ...


5

The whole purpose of building smart contracts is so that your contracts can execute without having to rely on any single centralized company, individual, or entity. You want to have your smart contracts be as secure as possible, so no individuals are harmed, and people don't have to worry about whether or not they can trust the application. Adding a ...


4

I think it is 43 GB as of December 26. (but don't nail me on that) If you buy a VPS you should definitely buy one that exceeds this number with easy. (or upgrade capacity later on)


4

why the user should hash the transaction before he sends it? A transaction is a data structure just like a .json file. Therefore if senders wouldn't hash this data structure, it could become inconsistent, e.g. sometimes having more fields, sometimes not. Hashing it before, turns data to a consistent shape, resulting ALWAYS in hexadecimal of x bit (depending ...


4

What are the chances that 2 people get the same set of those 12 or 24-word mnemonic? Mnemonic phrases are generated from 128 bits (12 words) to 256 bits (24 words) of entropy. The probability to guess a mnemonic phrase is 2^-128 to 2^-256, which is very small. The longer the mnemonic phrase, the smaller the chance to guess it though. Is it possible to ...


3

This is not yet good enough to be the "answer" but this should get you much closer than the existing answers. It's not pretty, but will upload a small directory. It also doesn't work with filenames/dirs that have spaces. I'll update this answer if I am able to improve it. Is this example we use ipfs.infura.io cd /your/chosen/path FILES=$(find * -type f | ...


3

Just adding a bit of nuance to Rob's answer. All Ethereum testnets started with a blank slate and have never and will never sync the balances with mainnet. Don't mistake them for hard spoons, which are blockchains that cloned the balances of another blockchain, but remain independent in all other regards.


3

In case of invalid opcode, use a local variable of type address payable as workaround: address payable self = address(this); uint256 balance = self.balance; In solidity 0.5.14, I get an invalid opcode, debugging showed me, that it is exactly here: address(this).balance Test result: Error: Returned error: VM Exception while ...


3

In https://blog.ethereum.org/2015/11/15/merkling-in-ethereum Vitalik Buterin gave an example of using the different trees (transactions, receipt, state trees). Has this transaction been included in a particular block? Tell me all instances of an event of type X (eg. a crowdfunding contract reaching its goal) emitted by this address in the past 30 days What ...


3

I found some information from a couple years back, they got a three year grant so maybe an update will be coming soon: A research project funded and co-run by NASA is looking to leverage the Ethereum blockchain’s smart contracts technology to automate spacecraft maneuvering while avoiding space debris. In developments that could potentially have ...


2

"fast" is the default value for --syncmode key It means, that there are no different to use --syncmode fast or do not use it. The information from https://github.com/ethereum/go-ethereum/wiki/command-line-options --syncmode value Blockchain sync mode ("fast", "full", or "light") (default: fast)


2

The fact that it gives the error Note: The constructor should be payable if you send value. is a bug. It obviously shouldn't give that error since you're not even executing a constructor when calling transferOwnership. Misc extra info: Prior to the Byzantium hard fork, there was no REVERT opcode. If a require failed, it would always consume all the gas.


2

No. That would be like money you printed at home rising to the level of actual cash. There is no path where that happens. Hope it helps.


2

The linked answer at https://stackoverflow.com/questions/47450007/where-does-ipfs-store-all-the-data should answer the technical part of the question. IPFS itself is only a protocol so it only defines how the files should be shared but it does not offer ways to give someone incentive to host somebody's files. So if you use the basic IPFS you can't trust ...


2

Those who request files are caching them for a while. Those who are interested to make those files constantly available, can pin them on their IPFS server, and that server will keep files available.


2

If you've heard about the ethers js library, it provides a fantastic function named parseTransaction, I found it after a very long search as it wasn't mentioned in any online forums and I'm still learning a lot about this stuff. But I found it to be the best for decoding any sort of contract and associated function call. const ethers = require('ethers')...


2

Change this: this.abi = require('../assets/abi/CertificateList.json') To this: this.abi = require('../assets/abi/CertificateList.json').abi And this: this.contract.methods.hello().send() To this: this.contract.methods.hello().call()


2

Your understanding is intuitive but the actual situation calls for inverting the conceptualization of tokens. First, ETH is a special case since it's the native currency OF the network. Tokens are contracts that run ON the network. They have commonality because they, generally, adhere to the ERC20 standard. Your contract will know when it has received ...


2

Looking into it quickly I noticed you did not import the library Address and this is probably why your using Address as address doesn't work. Hope this helps.


2

When one speaks about 50%+1 attack, this usually has nothing to do with majority of nodes. Actually, it is quite cheap to control the majority of nodes, but this will not give any advantage to the one who controls it. 50%+1 attack is about controlling the majority of mining hash power in blockchains based on proof-of-work consensus alogithms. Well known ...


2

Here is the Transfer event prototype on each standard: ERC20: event Transfer(address, address indexed _to, uint256 _value) ERC721: event Transfer(address, address indexed _to, uint256 indexed _tokenId) These two signatures are indeed the same when you hash them for the purpose of locating Transfer events in the ledger using (for example): receipt.topics[0]...


2

Syncing the Ethereum blockchain with Geth in --fast mode has two phases running in parallel: block sync and state trie download. Both phases need to be done in order to have a full node and switch to full mode where every transaction is executed and verified. The block sync downloads all the block information (header, transactions). This phase uses a lot of ...


2

For approach #2, sending a transaction without signing it first is supported only if you unlock your account on the node that you're communicating with beforehand (for example, when you run your tests on Ganache). On public nodes, this is obviously not feasible (neither would you want it to be, of course). You'll need to sign the transaction first, and ...


2

The expression add(bys, 32): Returns a pointer to the actual data, which starts after the first 32 bytes in the bys array (those first 32 bytes contain the length of the bys array). The expression mload(x): Loads the data pointed to by x, so you can just as well use mload(add(bys, 32)), because there is no added value in doing x + 0. The expression addr :...


2

You may meet the following code in many projects: contract A { event Log(address addr); function() external { emit Log(bytesToAddress(msg.data)); } function bytesToAddress(bytes memory source) public pure returns(address addr) { assembly { addr := mload(add(source, 0x14)) } } } Actually source when ...


2

They allow you to perform dynamic invocation (instead of static invocation) of a contract function. This is similar to reflection in Java, where you execute a function using the function name string. It is also similar to how you can call a function in interpreted languages like Python or Javascript. For example: def func(x): return x * 2 y = eval("...


2

Solidity does not have any built-in protection from over/underflow. This means that if you hit the min or the max of a value (0 or 2^256-1 = 115792089237316195423570985008687907853269984665640564039457584007913129639935) then the value will "wrap" around and keep counting. Put the following code in Remix to test it out. pragma solidity ^0.5.16; contract ...


2

I did a lot of research then finally I found answer to my question. Answer is: Blockchain upgrades are of two types: 1. Updates without breaking changes 2. Updates with breaking changes The updates which will not break anything allows users to update their nodes at their pace, and its the choice of node holders to upgrade or not. But in case of ...


2

You have basically three options. 1. Truffle-flattener You can use truffle-flattener to create a file that contains all the imported contract's source codes. The result can be used to easily verify a contract on Etherscan. 2. truffle-plugin-verify You may also try truffle-plugin-verify if you are using Truffle. You'll need an API key from Etherscan for ...


2

If your research is purely into consensus algorithms and you want to customize or write your own, PyEVM allows pluggable consensus algorithms. You can find more information in this old discussion. If you want to implement your own blockchain for research purposes you can take any of open source implementations of current Ethereum nodes and use them as a ...


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