Can a Smart Contract be upgraded/modified? Is CPU mining even worth the Ether? The Top questions answered here…

In this article I’m solving several of the most important questions people are having when it comes to understanding Ethereum. Most of them come from ethereum.stackexchange.com. And the purpose of this article is to have a nice, organized list that you can always reference to fulfill your Ethereum curiosity.

Feel free to let me know any other questions you have and I’ll add them to the list to help each other out. Let’s get to it.

Here’s the list of questions. Just go to the question number by scrolling down:

1. How can I check if an Ethereum address is valid?
2. Is CPU mining even worth the Ether?
3. Where does the consumed ether/gas go?
4. How do I buy Ethereum with USD?
5. What is the difference between a transaction and a call?
6. Can a Smart Contract be upgraded/modified?
7. I sent ETH ether to an ETC address, can I recover the ether?
8. What’s the difference between proof of stake and proof of work?
9. Why does Ethereum plan to move to Proof of Stake?
10. What number of confirmations is considered secure in Ethereum?
Bonus: How to create a Dapp from scratch on Ethereum?

1. How can I check if an Ethereum address is valid?

A valid Ethereum address has the following properties:
- It must have 42 characters including the initial “0x”.
- It must only contain the following letters: a, b, c, d, e and f. Which means that an Ethereum address with an “h” letter is invalid.
- It can have any number from 0 to 9.
- If it has all those properties and it’s all small caps or all all caps, then it’s a valid address.
- Otherwise, if the address has a combination of capital letters and lowercase letters, you have to check the checksum of that address. You can do that with web3.js 1.0. Simply execute web3.utils.isAddress("Your-address-here") and it will return true or false if it’s invalid.

Now if you only want to check if an address is valid without caring about how it works, you can do so here: https://tokenmarket.net/ethereum-address-validator

2. Is CPU mining even worth the Ether?

If you try to mine with your CPU processor, you’ll get a hashrate of about 0.25 MH/s which is about $0.0184 USD dollars per day if your electricity is 100% free. Compared to GPU mining where you can get about 35 MH/s or $2.5 dollars per day with free electricity, the decision is clear. You can calculate your values here: https://etherscan.io/ether-mining-calculator

It’s not worth the extra strain on your computer hardware. You’re better off by using a GPU to mine, which can get you about 35 MH/s or $2.50 USD dollars per day.

3. Where does the consumed ether/gas go?

The gas that you pay to execute transactions on ethereum goes to the miners that used their computing power to process that transaction on the blockchain via mining.

The amount that you pay is up to you and it’s calculated by this formula:
gas required for the transaction * gas price set by you = total price

You can calculate the estimate gas required for a transaction using web3.js myContract.methods.myMetho(param1, ...).estimateGas(options, callback).

4. How do I buy Ethereum with USD?

  1. Create an account on Gemini, coinbase, kraken, gdax or any other exchange that allows you to use fiat money.
  2. Verify that account. They will require you to upload a bunch of personal documents to verify your identity because they are interacting with regulated banks. Do this as they tell you.
  3. Send the money to the exchange. If you’re using kraken, go to funding -> USD -> deposit the money with a SEPA bank transfer. Wait until the money arrives to the exchange, usually a couple of days. If you’re using coinbase, simply buy with your credit card. It’s always better to use a bank transfer because there are less fees.
  4. Now simply buy the ether if you’re on the exchange. You can search on youtube how to use that specific exchange. In coinbase, you simply buy directly with your credit card and you get the Ether immediately in your account.

5. What is the difference between a transaction and a call?

A call is just reading information from the blockchain. For instance, when you connect to an ethereum node with metamask and you make a call, what you’re actually doing is just searching in the data stored on the blockchain connected to metamask to find the information that you want to get from that call.

For that reason, it doesn’t cost any gas / ether because you’re not sending information to anybody. You’re not adding information to the blockchain and nobody will mine the call. So miners don’t get paid since they don’t participate in the call execution.

You can only call function that are specified as constant or public variables, since they create constant functions to get the values from the Smart Contract.

A transaction is a way to update the blockchain with new information. When you generate a transaction you’re sending information to all the ethereum nodes so that they update the blockchain. Miners get that information and they update their own blockchain. It’s a write operation.

For instance, if you send ether to another user, you are actually generating a transaction that says Increase the balance of user B and reduce the balance of user A. That information is written on the blockchain and you have to pay gas for the mining.

6. Can a Smart Contract be upgraded/modified?

Yes and no. Contracts deployed on a blockchain are immutable. This means that the address and the code of that Smart Contract can’t be modified since it’s permanently written on the blockchain.

However there are ways to use a new contract instead of that one, which is similar to “updating” a contract. One way to update the code is to create an intermediary Smart Contract that will hold the address of the active Smart Contract. So all the calls and transactions will be redirected to the active version with the function delegatecall. That way, you’ll be using the same contract address but that contract will execute a different Smart Contract code in the end. From an “updated” contract.

Note that there are important security risks when delegating calls and that you have to be extra cautious when designing upgradable smart contracts.

Another way is to simply extract all the information from the old contract and insert it into a new version. Then update the address that your users will see.

Be creative and find your own ways to update a Smart Contract.

7. I sent ETH ether to an ETC (Ethereum Classic) address, can I recover the ether?

If you sent ether to an ethereum classic address, you may be able to recover your ether depending on if you’re using a Smart Contract or not in the process.

Private keys are equally valid on both chains. This means that if you send 10 ETH to an ETC address, the equivalent ETH address will receive those 10 ETH since the same account exists in both chains. So if you send ETH to an ETC account directly, you’re not losing the ether if the receiving address is the same on both chains.

Now Smart Contracts are unique to each chain since they are not generated from private keys. So if you send 10 ETH to an ETC Smart Contract address, you’ll lose your ether unless someone has created a Smart Contract with the exact ame address on the ethereum classic blockchain. Which is almost impossible because of the huge amount of possible addresses.

If you’re sending the money from an exchange, it really depends on whether the exchange is using a Smart Contract to manage its wallets or private key based accounts, and whether they are automatically replaying transactions (for example if you sent this to poloniex, the tx would be replayed and you’d be credited ETH even though sent to ETC deposit address). So really there’s no way to know except to contact the exchange and hope they have something in place to handle this.

8. What’s the difference between proof of stake and proof of work?

Proof of Stake (POS) and Proof of Work (POW) are algorithms for reaching consensus on the blockchain. Anyone can create a block; while we only want an unique chain, so we want a way to decide which block we should trust.

The goal of a consensus algorithm in a public blockchain network is to let many different users agree on the current state of the blockchain even though they don’t trust each other or any central authority.

Proof of work has the nice property that you can use Bayes’ Theorem and the laws of Thermodynamics to prove that a given block has indeed required a certain amount of work to be mined. That way, users can simply pick the longest valid chain with the highest amount of work as the correct chain. This implies that Proof of Work is extremely inefficient in term of energy, and therefore also very expensive which incentivize miners to centralize the hashing power.

Proof of Stake on the other hand, isn’t about mining it’s about validating. In effect blocks still need to be created by someone, and who gets to create the next block depends on the specific Proof of Stake algorithm, but the selection process must have some kind of randomness, or at least distribute voting shares. POS is greener because you’re not intensively making computing calculations. You have to essentially lock up your coins/tokens to mine or process transactions.

In summary. POW is a process to validate transactions with a lot of computational expensive operations where in POS the transactions are validated by voting or beting with you money, your “stake” on the right blockchain.

9. Why does Ethereum plan to move to Proof of Stake?

The Ethereum developers are working on a new version of the blockchain called Casper to update to Proof of Stake from Proof of Work to solve several problems such as:

  • Security: Ethereum developers and researchers believe that consensus algorithms based on Proof of Stake (PoS) can provide a higher degree of security for a given amount of resource costs, compared with Proof of Work (PoW) consensus algorithms. So the network will be much more secure to attacks.
  • Operation costs: No need to consume large quantities of electricity in order to secure a blockchain (eg. it’s estimated that both Bitcoin and Ethereum burn over $1 million worth of electricity and hardware costs per day as part of their consensus mechanism). Such energy consumption on hash calculations is estimated to be around Iceland’s energy consumption. These operation costs force users to pay a lot of gas fees for each transaction. With POS the gas costs will be much lower since the miners won’t be so indispensable.
  • Less coins needed: Because of the lack of high electricity consumption, there is not as much need to issue as many new coins in order to motivate participants to keep participating in the network.
  • More powerful: The ability to use economic penalties to make various forms of 51% attacks vastly more expensive to carry out than proof of work — to paraphrase Vlad Zamfir, “it’s as though your ASIC farm burned down if you participated in a 51% attack”.

10. What number of confirmations is considered secure in Ethereum?

Vitalik Buterin said in the Ethereum blog: Only a small number of extra confirmations (to be precise, around two to five) on the faster chain is required to bridge the gap; hence, the 17-second blockchain will likely require ten confirmations (~three minutes) to achieve a similar degree of security under this probabilistic model to six confirmations (~one hour) on the ten-minute blockchain.

TL;DR: about 5 confirmations. Although there’s not a standard number for the needed confirmations.

Bonus: How to create a Dapp from scratch on Ethereum?

If you want to become an Ethereum / Smart Contract developer, you need to follow these simple steps:

  1. Read up on the basic concepts. The Ethereum white paper isn’t a bad place to start: https://github.com/ethereum/wiki/wiki/White-Paper. Then read the Ethereum FAQ to get an excellent introduction to the Ethereum ecosystem: https://github.com/ethereum/wiki/wiki/Ethereum-introduction
  2. Start by coding Smart Contracts right away with the help of these tutorials. The sooner you start, the better you’ll become faster:
    - The ultimate end-to-end tutorial to create and deploy a fully decentralized Dapp in ethereum
    - Full Stack Hello World Voting Ethereum Dapp Tutorial
    - The Ethereum Greeter
    - Build Your First Ethereum Smart Contract with Solidity
  3. Ask any questions you may have on ethereum.stackexchange.com and keep creating your own little projects to become better each day.

Thanks for reading the entire article! Hope you found some information useful for your own personal development. Feel free to suggest any changes and improvements. I read all the comments.

Also be sure to clap this article, follow me on medium for more articles about ethereum development and on linkedin at www.linkedin.com/in/merunasgrincalaitis.

Feel free to let me know any other questions you have and I’ll add them to this list to help each other out.

If you want me to help you with your ICO, dapp, ethereum project, audit or token, send me an email to my personal email merunasgrincalaitis@gmail.com and let’s discuss the details. Have a wonderful day!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Merunas Grincalaitis

Merunas Grincalaitis

Blockchain expert. Get my new Ethereum book on Amazon: https://amzn.to/2KBBNyu and my previous one here: https://merunas.org/book