A Bluffers Guide to Ethereum: Some Answers to Questions … Go Learn More

Blockchain is one of those completely misunderstood areas of technology, and we often end up with people saying it is the best thing since…

A Bluffer’s Guide to Ethereum: Some Answers to Questions … Go Learn More

Blockchain — or as some would say ‘distributed ledgers’ — is one of those completely misunderstood areas of technology, and where we often end up with people saying it is the best thing since sliced bread, while others saying that it is a disaster. To say that Bitcoin is representive of a modern blockchain network is like comparing a Ford Model T to a Tesla car. For this, I quote a famous stanza from John Godrey Saxe:

It was six men of Indostan, to learning much inclined,
who went to see the elephant (Though all of them were blind),
that each by observation, might satisfy his mind.

And so these men of Indostan, disputed loud and long,
each in his own opinion, exceeding stiff and strong,
Though each was partly in the right, and all were in the wrong!
So, oft in theologic wars, the disputants, I ween,
tread on in utter ignorance, of what each other mean,
and prate about the elephant, not one of them has seen!
-- John Godfrey Saxe

And I quote: “Though each was partly in the right, and all were in the wrong!”. To me, a blockchain creates a most trustworthy world of digital signing, and which overcomes many of the flaws in methods of digital trust. I see the wonderment of five decades of cryptography research into public key, and the beauty of Merkle Trees. So let’s not close our minds to the opportunities that it brings, and learn a little bit more about the topic.

Don’t just Google it!

Unfortunately, we increasingly live in a world filled with superficial knowledge, and where we often surface learn things. If we want an opinion on something we often just Google it, and find someone who has answered that question. For a teacher a disappointing response from a student is:

“I tried to Google the answer, and I can’t find it! What do I do now?”,

of which the answer from the teaching is often something like:

“Well, do some research, and investigate, and find different angles, make notes, and you will find your own answer. You will learn as you research, and build up your own knowlege … then write it up with all the things you have learnt.”

So, let me fall into my own trap, and give you a bluffer's guide to something. I do this, not so that you take my opinions, but that it gets you interested in the topic, and where you want to learn more. Perhaps it switches you off from learning it? By that’s fine, as it is all part of finding things that interest you in your learning. Learning becomes a chore when it is boring and where there is little relevance to acquiring new knowledge.

I also want to overcome the biases of those who see that there is only one side to blockchain technologies, and of those who have never even touched a distributed ledger. So, here’s a bluffer's guide to Ethereum, in a few questions.

1. Does it costs me money to use Ethereum?

Yes. On Mainnet, you need to pay the miners to do some work for you. This is a good thing, is it stops the ledger from being hacked, as it would be too costly to do this. So, for every little bit of work that needs to be done to add your code onto Ethereum, and to change its state, you will get charged a little bit of Ether. That Ether needs to be paid for. Normally we define Ether as gas that the miners consume.

2. What is a smart contract?

A smart contract is a program that can run on the distributed Ethereum network. It is thus robust against central points of failure. The code is well managed and needs to be written in a special language called Solidity. A compiler then converts this high-level code into the binary code that runs on Ethereum. This code is highly trustworthy and has been checked so that it is robust in its operation. The smart contract then has functions that can be executed, and where data values can be passed in, and returned back.

3. Is my smart contract private to me?

No. You may own a smart contract, but once it has been published, everyone on the Ethereum network can see the code used in the smart contract. This is good from an auditing point of view, as there is nothing that is secret in the code. You may, though, have extended rights within the contract, as you are the owner. For example, you could create a smart contract to create NFTs (Non-Fungible Tokens), and where you are the creator of these, and where no one else can create them.

4. How do fungible tokens work?

Fungible tokens allow an entity to create their own cryptographic tokens, and which are all the same, and have the same value. For example, I may create 1,000 tokens for tickets for a football match. There will only be 1,000 tokens and no more, or no less. These are then created with a smart contract, and assigned to an entity (normally the person who is creating the token). I can then put a value on the token, and either fix it or allow it to be traded in an exchange. For the football match, I could then sell 1,000 tokens, where the position of the token in someone’s wallet or on the ledger, will define the ownership of the token, and where they can prove that they purchased the token.

5. How do non-fungible tokens (NFTs) work?

NFTs differ from fungible tokens as they are not created when the smart contract is run. Each NFT is then minted, and created uniquely. For this, we might award a PhD qualification as an NFT, and where the university mints the token for someone who is to be awarded a PhD. This will be unique and contain details that cannot be changed. If required, we can transfer the NFT to another entity, but this can only be done by the owner of the NFT. The smart contract thus supports functions such as the creation and transfer of the token.

6. How do I test my smart contact without having to burn gas?

Luckily we can run either a local blockchain (with Geth) or use a test network. With the local blockchain, we can either run Geth as a stand-along package and then interact with it using the command-line interface (CLI). This allows us to create our own blockchain, and see the detail of its operation. But in many cases, we just need to see if we can correctly deploy our code, so we often use a GUI (Graphical User Interface) package known as Ganache. This automatically creates a test blockchain for us and adds a number of accounts. We can then see our transactions being mined, and view the operation of the ledger. Overall, each of the accounts is already created with Ether, so it doesn’t cost us anything.

Obviously, this is a fairly fast method of testing our code but doesn’t have other users performing their operations. So, to test our code on a more representative network, we can deploy it to a test network, such as Ropsten. With this, we now need some Ether, which we can request from the test network. We then need to add this Ether into a wallet. A well-known wallet is MetaMask. Then when we deploy our smart contract to the test network, we will be charged some gas to mine it.

Once we are all tested, we can go to the MainNet, and deploy the code. This will cost us some real Ether.

7. How big is my private key, and could it be discovered?

Ethereum using the sepc256k1 elliptic curve, and which has a 256-bit private key. This is a random number, and there are (2²⁵⁶):

115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,936

possible keys. It is almost impossible to every find a private key in this key space by just using brute force methods.

8. What’s a digital wallet?

In Ethereum, the digital wallet contains a private key. It is thus key that signs off transfers, and should not be distributed to anyone. The wallet then derives a public identifier that uniquely defines you. When someone wishes to send you some cryptocurrency or a token, they will send it to your public address. This will be recorded on the ledger, and where the wallet will then pick up the transaction from the ledger and show it in your wallet. This wallet too will then keep a tally of how much Ether you have and how much you will spend on any transaction.

9. Can I just port any program into a smart contract?

No. Ethereum guards against denial-of-service on the network, and inefficient code by changing for the work done. The more work that a miner has to do, the more it will cost you in Ether. Smart programs must thus be designed in a highly efficient way, and where every operation matters for the over cost. Most programs, though, are highly inefficient and would be too costly to just code for a smart contract. Along with this, Solidity mainly supports integer operations, and so complex maths operations which require decimal operation need to be carefully integrated — normally with external solidity libraries.

10. Can I add other smart contract code into my smart contract?

Yes, but beware! We can easily import existing smart contract code when we compile (but cannot link to already built code). Thus we compile each contract from fresh code. Whenever we use external code, we need to check it, as there may be weaknesses in the code, and which could allow for our smart contact to be hacked.

11. Will Ethereum eventually crash or become too slow?

Yes. Theoretically, every computing system has a limit, and if there are too many tasks and not enough resources, the system can crash or become slow. You thus cannot magically create computing resources that you do not have — even in a distributed infrastructure. We thus need processing and memory space to cope with the number of tasks that are required at any time. Up to now, we have coped with this, but we could hit a limit if Ethereum becomes too popular. Hopefully, Ethereum 2.0 will address this problem, and introduce a concept of sharding, and which distributed the processing, so that we have less dependence on a more centralised ledger approach.

12. I heard proof of work is bad, what the problem?

In Ethereum, proof of work involves the miners of the transactions being rewarded for their good work. There is not so much competition for this as we have in Bitcoin — and which is a highly competitive method of mining. Overall, Bitcoin is very wasteful and slow, in creating new blocks, whereas Ethereum is much faster, and incentivizes users to be efficient in their code. Ethereum 2.0 will hopefully bring a proof of stake model, and where nodes will provide a stake in the network, in order to be a worker. They will then be paid for doing good work.

13. How do I update my smart contract to a new version?

Updating a smart contract that is committed and running is not a good thing, as the current version has been checked and everyone knows how it works. If we were allowed to change a smart contract to a new version, so could add in malicious code, so a new contract must be published to a new location, and then remapping into applications.

14. Can I connect to external systems in my smart contact?

No. The running of the smart contact should be isolated from the Internet, as any external connections could compromise the operation of the smart contract.

15. How do I become a miner?

We have a distributed infrastructure in Ethereum, and anyone can add their own hardware onto the network and become a miner.

16. How much might a proof of stake node cost?

As Ethereum moves to proof of stake, it is likely that you will need around 32 Ether to be registered as a validator on the network. These validators will check the transactions that are created, and add them to blocks on the Ethereum network. These validators will then be rewarded for their good work, and hopefully, pay back their stake.

17. I heard that quantum computers are a risk to blockchain. Is that true?

Yes. Very much. Quantum computers can crack many of our existing public key methods, such as the elliptic curve methods used in Ethereum. Once built at scale, it would be theoretically possible to reverse a public key back to the private key, and then be able to transfer any digital assets. We have, though, many years to migrate towards newer public key methods, such as with lattice cryptography. NIST is currently looking to standardize the post-quantum cryptography (PQC) methods for public-key encryption and digital signing.

18. How can we say that the blockchain is trustworthy?

Under the hood, we use digital signatures to verify that transactions have been signed-off with a private key, and then checked by everyone with the associated public key. At the core of this with Ethereum is the usage of the ECDSA (Elliptic Curve Digital Signature Algorithm) and where we can hash the transaction, and then create a digital signature, and which is added to the blockchain along with the details of the transactions.

19. What does a digital signature look like?

Ethereum uses ECDSA for its signature, and where we create a random nonce value for the signature and then use a private key to create the signature. This signature has two values r and s, and it is these values, along with the transaction and the public key which are used to check the validity of a signature.

20. Who are things referenced in Ethereum?

Private keys and contacts are stored at a unique 256-bit address. When we reference a wallet or a contact, we reference its address.

21. How do I view the ledger?

If you have a wallet, it will tell you about your viewpoint of the ledger and things that related to you. To view the whole of the ledger, we can use Etherscan, and which has a complete picture of MainNet and other test networks (Etherscan). Each transaction shows a sender and a recipient:

22. How do I create a smart contact?

Well, you can use Microsoft Code or Visual Studio, but one of the most dependable systems is to use Remix (https://remix.ethereum.org). This is an online tool which allows you to edit, compile, deploy and test a smart contract.

23. After I mine a contract, does it cost me any more?

If a smart contact does not change its state, it does not cost anything to run the code. But if it does, such as adding new data to a data store, it will require the miners to do some work, and so gas will be charged. An example is here.

Conclusion

I give you these bluffer answers, not so you can bluff your way around the topic, but to open up your mind to the opportunities to learn something about this amazing new world we are creating. The Internet is full of old methods that really haven’t scaled well. This new world will embed trust and resilience into every single element of the most amazing machine that humankind has ever created.

As an academic, I want my students to become independent learners. I want them to build solid foundations of knowledge, and ones that they can build on. I want them to love learning, and to investigate new things, and not close their minds to opportunities. Learning is a life-long goal and we never stop. Because …

Join Coinmonks Telegram Channel and Youtube Channel learn about crypto trading and investing

Also, Read