Developer Mindset - Reading Assignment

  • Why does smart contract development require a different mindset than regular programming?

Your smart contracts are visible by anyone on the blockchain, they can be duplicated and tested easily to find vulnerability inside it. They are holding money and often your user money so you need to be really careful.

  • Argue with your own words why clarity in your code is more important than performance.

Clariry is important because if you keep your code simple it will be easier to spot bugs, people who use your code as a library or people who code on your project will understand your functions easily.

  • As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?

The consequence will be that confidential informations could be leaked. A really bad usage will be to base an admin function or a key function on a password which is stored on a private variable.

  • Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?

You will always have to find the right balance regarding your smart contract use case, sometime you will have to change your initial code structure for security purpose.

  1. Why does smart contract development require a different mindset than regular programming?
    Because the money is handled by code

  2. Argue with your own words why clarity in your code is more important than performance.
    When the code is clear, it’s easy to understand and to test. Which makes fewer bugs.

  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    That all private data is publicly viewable too.

  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    Because we need to find the correct balance between performance, security and structure.

1 Like

Because the stakes are higher and the field is new and not fully discovered.

Performance doesnt matter if the code isnt clear. If bugs ever appear, it will be 10000 times harder to ever be able to fix it if the code is unclear. And since the stakes are so high, you better want to be sure that your contract works fine and have a nice overview with clear code.

“Understand that your public functions are public, and may be called maliciously and in any order. The private data in smart contracts is also viewable by anyone.” A false believe may be that private functions cannot be called. This is only directly true, because it can be still called from the contract itself, and if it does so by a public function, it is still useable by everyone and can be exploited if it wasnt thought of

Because we deal with the blockchain and not every other kind of program which is usual as an software engineer. And since we do that, we have to take security differently into consideration and not be in the same mindset as a normal software engineer.

1 Like
  1. Why does smart contract development require a different mindset than regular programming?
    It is a New Ecosystem dealing with money and constant upgrades.

  2. Argue with your own words why clarity in your code is more important than performance.
    It would be much easier to find bugs and to upgrade.

  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    You have to remember that private data in smart contacts is also viewable by anyone.

  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    You have to strike the proper Balance for the tradeoffs.

1 Like
  1. Why does smart contract development require a different mindset than regular programming?
    Because they are dealing with money.

  2. Argue with your own words why clarity in your code is more important than performance.
    Because performance derives from clarity.

  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    Maybe someone believes that the names and all the other private data of the persons where belongs the money are not visible from any other except from the smart contract.

  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    ???

Hi @T-9000
What do you think about other students answers for question number 4, do you see the point of this question?

Ok lets try.
4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
Because we can’t have in a smart contract for example monolithic and upgradability simultaneously. They are properties each other opposites. We have to find the correct balance.

1 Like

:stuck_out_tongue_winking_eye: :+1:

1 Like

1. Why does smart contract development require a different mindset than regular programming?

Smart contract development requires a different mindset because the stakes are much higher. A small bug in a normal application can be patched up easily; whereas, a small bug in a smart contract could lead to a complete loss of funds.

2. Argue with your own words why clarity in your code is more important than performance.

Clarity is more important than performance because when something goes wrong, it’s much easier to isolate variables (for you and other devs) when you can easily follow along with the code’s logic. Sludging through sloppy code is a nightmare in regular programming–catastrophic in smart contracts especially since solutions are already difficult with smart contracts.

3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?

The most glaring danger with holding that false belief would be creating a masterKey-type function with a password stored on-chain.

4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?

The principles come down to tradeoffs because they’re almost mutually exclusive (depending how you define them). Your code can be both rigid and upgradeable, but by defining rigid as difficult to change, it is thus not quite upgradeable. The degree of such tradeoffs depend on the project itself.

1 Like
  1. They are highly critical and also hard to modify.
  2. Both go hand in hand, worse performance make it more costly to interact with the user, on the other hand if there is no clarity in the code less users will interact with it.
  3. The abstraction of data is visible but the actual data is not
  4. The new way of developing comes with new ways to deal with stuff -> ugradeability <-> modularization
1 Like

1. Why does smart contract development require a different mindset than regular programming?

The code manages money so there is a lot at risk. Second, fixing bugs is difficult because of the immutability of the blockchain and may require cooperation from users. Further, the platform is new, so is constantly changing and new vulnerabilities are being discovered so devs need to be proactive and stay informed.

2. Argue with your own words why clarity in your code is more important than performance.

Often times performance comes at the cost of complexity. Simple code is easier to understand, maintain, and test. Lack of understanding what the code is actually doing my lead to more bugs. In the end it’s better to have safer code than faster code most of the time.

3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?

  • Thinking private data is hidden a dev could store confidential info not meant to visible
  • Thinking private functions are hidden a dev might reveal implementation details that could allow attackers to exploit the contract
  • Thinking private functions are hidden a dev might be lazy and not do proper input checks or make unsafe assumptions

4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?

It’s not possible to maximize all the desirable principals at once. Having more of one principal means having less of another, so a balance needs to be found that makes sense for the particular application. Contracts meant to be used for only a short time will tend towards simplicity at the price of malleability and reuse (more rigid, monolithic). Permanent contracts must be upgradable and modular but at the cost of being more vulnerable and higher complexity.

1 Like
  1. Why does smart contract development require a different mindset than regular programming?
    • High risks with a changing landscape, where cost of failure is high and change (updates) can be difficult.
  2. Argue with your own words why clarity in your code is more important than performance.
    • The less complex the code and the clearer it is stated, the less errors can sneak in, the easier it is to find bugs, the less risk you have running your smart contract.
  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    • Believing data is private may result in people putting confidential data on view to everyone.
  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    • Because it is all a matter of how much risk you are willing to take (therefore a tradeoff). What risk level is acceptable in return for the particular business benefit.
1 Like
  1. Why does smart contract development require a different mindset than regular programming?
    Because this is new technology that changes rapidly and changes and bugs are discovered as we go, so we need to have an open mind.

  2. Argue with your own words why clarity in your code is more important than performance.
    The code needs to be easy to understand and logical to avoid mistakes and bugs. The easier the better.

  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    The misconception that private functions cant be vied by others, be carefull with external contract calls that can be malisious, the same with public functions they can be mallisious and mess up the contract, be awere of gas limits and block gas limit, miners can manipulate block timestamps, dont use random number generator on blockchain since it can be manipulated.

  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    I think it`s because you have to make choices between security and useability. The contract can be made more secure but with smaller room for errors if the contract is immutable. On the other hand, if the contract is more open and easier to change, then it might be more vunerable to hacks I would think.

1 Like
  1. Because these contracts handle money, so stakes are higher and bugs can be fatal.
  2. Once bugs do occur, developers need to find it as fast as possable and it needs to be easy to fix, without introducing new unforseen bugs.
  3. Some may believe private data and functions are truly private and no one can see them and use that knowledge for potential attacks on the system.
  4. Because nothing is black and white, no program can be simple to read and understand and, at the same time, execute complex set of interconnected algorithms running in most efficent way. We must prioritaze things we deduce are needed the most, depending on the situation we find ourselfs in.
1 Like
  1. It is in new circumstances, involves financial responsibilities and not easy to be updated if not designed well.

  2. Any bug or error can let malicious attack or hack from 3rd parties with high performance but less clarity hence complicated code.

  3. A understanding that private data is NOT viewed by outsiders.

  4. It all depends on the overall purpose and structure of the code to perform securely and smoothly.

1 Like
  1. Why does smart contract development require a different mindset than regular programming?
    – Because they are a new technology that keeps evolving, thus requiring the developers to stay up to date with the latest features of the development platform.
    – Because they have a high risk of failure due to their handling of money, being open-source and being in a new ecosystem (new technology with little history)
    – Because they are difficult to update due to their immutability, i.e. they cannot be modified once deployed.

  2. Argue with your own words why clarity in your code is more important than performance.
    – Easier to update
    – Easier to find bugs
    – Easier to test
    – More modular
    – Complexity increases the likelihood of errors

  3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
    Although private data and functions cannot be seen from the user interface interacting with the contract, they are part of an open-source code, thus can be read and studied for loopholes by hackers.

  4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?
    There is a fundamental tradeoff between malleability and security, because flexibility adds complexity to a program, thus increases the likelihood of being less secure (vulnerability increase).

1 Like
  1. Why does smart contract development require a different mindset than regular programming?

Because it’s blockchain baby.
Immutable.
Once you deploy that thing there’s no pulling it back.
Too often developers run sloppy code to production
knowing that they can bug fix bug fix modify modify.
That’s not doable in blockchain coding.
Some characteristics of a smart contract can be modifiable,
but if they are that’s written into the code where anyone can see it.
That’s another difference- transparency.
With smart contracts the code is on the blockchain where anyone can look it up.

  1. Argue with your own words why clarity in your code is more important than performance.

In smart contract production, especially in contracts handling assets or finances,
it is essential that the code is understandable. (THen you’ll know it will revert on failure and you won’t lose your ETH).

It doesn’t matter how fast or cheap your code is to run if nobody can tell what it’s going to do.

  1. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?

People might think that private means no-one else can see the information. Then they may put personal or even incriminating or inflammatory information where it can be seen. Also, they might think no-one else can see a particular function and that they can pull a fast one.

  1. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?

I’m kind of a maximalist, so while I think being able to update a contract is a fun idea the tradeoff for clarity and security is one I probably wouldn’t make often.

What it comes down to though is blockchain is hard and security is hard,
and being able to cut yourself some slack can save some effort I suppose.

Having to redeploy a contract that could have been made updateable might not always be possible, might require the consensus or too many players, so it should be made updateable I guess.

1 Like
1. Why does smart contract development require a different mindset than regular programming? 
	a. high cost of failure
	b. difficult changes
	c. in some ways similar to hardware programming or financial service programming

2. Argue with your own words why clarity in your code is more important than performance.
	a. because you have a good overview of your code and can find bugs easier. Also testing is much easier.
	
3. As the article says, all data and functions are public in a smart contract. What false beliefs might someone have around private data and private functions in a smart contract that could have dangerous consequences?
	a. it suggests that private data regards to privacy - you should only store privat data on blockchain if it is neccessary
	
4. Why do you think all the fundamental principles mentioned in the article comes down to tradeoffs?  
	a. you have to find a good compromise between performance, flexibility and security. These three properties form a magic triangle. If you want one property to be more pronounced, you have to reduce one or both other properties
1 Like

1 - Because the cost of failure can be high, and change can be difficult.

2 - Because it will be easier to revisit and update it if needed in the future.

3 - The code is open-source, thus can be read and studied for loopholes by hackers.

4 - There are important exceptions where security and software engineering best practices may not be aligned. In each case, the proper balance is obtained by identifying the optimal mix of properties.

1 Like
  1. When you develop smart contracts you program code based on platforms (e. g. ethereum) which are new and evolves very quickly. That means over the time new bugs and new methods for programming secure smart contracts are developed. There are no best practices which are proofed for several years. Best practices are often changed rapidly. That being said the new Developers have to update themselves constantly. It is also higher risk of develop smart contracts because you handle a lot of money or public information which means your stakes are a way higher. This results in implementing useful risk management/ strategies. Smart contracts are also hard to update.

  2. In order to keep contracts simple so that other people can verify and proof your code decreases the possibility of errors and critical bugs. It is better to use clear code which everybody can understand instead of doing fancy things which for example increases the speed of a transaction/calculation but only a few people could understand this. In order to achieve a good performance it is very likely that your code gets more complex which increases the likelihood of errors.

  3. Private data in a smart contract can be seen by anyone. So, don´t put data in it which nobody should ever be seen. Private function are not private, they can be called from other public function inside of the smart contract which could lead to malicious exploitation.

  4. Because we are dealing with new technology which is not developed for several years and has established itself for a longer period of time you have to to tradeoffs. It is like the real word where you also have to take tradeoffs. You cannot have a car which has high comfort, less weight, high power, high crash safety and high performance. If you want to have a high secure smart contract you should develop it as simple as possible but this limits also the possibilities inside your smart contracts because you can only use “simple” functions. As a developer you are restricted and maybe cannot implement things which makes the program smoother because the possibilities to do so are not there. But this could change because this technology still evolves rapidly and therefore there are no best practices which are proven and where the developer exactly knows that he has to make no tradeoffs because the methods are proven and valid.

1 Like