Skip to content

Commit 99e3b36

Browse files
committed
chore: address pr review on pt 3
1 parent 964529a commit 99e3b36

File tree

1 file changed

+12
-32
lines changed

1 file changed

+12
-32
lines changed

src/pages/lessons/fundamentals/eth-intro-part-3.mdx

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ Welcome to Part 3 in the saga! Part 1 covered blockchain fundamentals. Part 2 co
1717

1818
## Smart contracts, an introduction
1919

20-
The Ethereum blockchain has a great deal of value flowing through it. In previous articles, we discussed the flow of **ether** from one user to another via transactions. However, the network is capable of more sophisticated interactions, and those use cases are enabled by smart contracts.
20+
The Ethereum blockchain has a great deal of value flowing through it. In the previous lesson, we discussed the flow of **ether** from one user to another via transactions. However, the network is capable of more sophisticated interactions, and those use cases are enabled by smart contracts.
2121

22-
Let's start with a simple definition: a **smart contract** is code (i.e., a computer program) deployed to the blockchain. As for the buzzword name, _contract_ conveys the relative permanence of these programs as they determine how assets can change hands and _smart_ is a nod to their programmability. For brevity, they're commonly referred to as just contracts, and we'll follow suit.
22+
Let's start with a simple definition: a **smart contract** is code (i.e., a computer program) deployed to the blockchain. As for the buzzword name, _contract_ conveys the relative permanence of these programs as they determine how assets can change hands and _smart_ is a nod to their programmability. For brevity, they're commonly referred to as just contracts, so we'll do the same in this lesson.
2323

2424
It may be helpful to think of contracts and individual accounts as the two types of actors within this system. With their programmed instructions, contracts can interact with the blockchain in much the same way as individual accounts: by sending and receiving ether or by interacting with other contracts. Contracts can go a step further by managing some internal state – a concept we'll explore shortly.
2525

@@ -33,9 +33,9 @@ A contract can be as complex or as simple as you need it to be. You can leave th
3333

3434
In this paradigm, that's a requirement. Users (or other contracts) may utilize your contract to move real value around. They need to be able to trust that your contract does what you say it does, and in order to do that, they need to be able to read it for themselves.
3535

36-
In reality, most users aren't reading the source code of each smart contract they interact with, but most wisely won't touch a contract if that source code isn't verified (e.g., on sourcify or Etherscan) and vetted (e.g., audited) by industry veterans.
36+
In reality, most users aren't reading the source code of each smart contract they interact with, but most wisely won't touch a contract if that source code isn't verified (e.g., on Sourcify or Etherscan) and vetted (e.g., audited) by industry veterans.
3737

38-
Consider the alternative: if contracts are black boxes, there's nothing to stop a bad actor from publishing a contract that appears innocuous, but actually grants themselves the ability to move your assets. Today, bad actors can deploy such a contract and try to lure users in via social engineering, but often wallet interfaces will warn users when code is unverified and to proceed with caution.
38+
Consider the alternative: if contracts are black boxes, there's nothing to stop a bad actor from publishing a contract that appears harmless, but actually grants themselves the ability to move your assets. Today, bad actors can deploy such a contract and try to lure users in via social engineering, but often wallet interfaces will warn users when code is unverified and to proceed with caution.
3939

4040
## What about my business model?
4141

@@ -51,11 +51,11 @@ Ethereum smart contracts can be written in a handful of programming languages, e
5151

5252
Each language is worth a look, but below is a "Hello, World"-style example written in Solidity, the most established of the languages. This example contract is titled `Billboard`, stores a single message, and contains one function to update that message. As written, anyone has the unrestricted ability to update that message.
5353

54-
You can imagine that a website might display whatever message is stored and provide an input to type in a new message, replacing the current one. The combination of a smart contract and its user interface is what's referred to as a decentralized application, or "dapp" for short.
54+
Imagine a website is displaying whatever message is stored and providing an input to type in a new message, replacing the current one. The combination of a smart contract and its user interface is what's referred to as a decentralized application, or "dapp" for short.
5555

5656
```solidity
5757
// SPDX-License-Identifier: MIT
58-
pragma solidity 0.8.17;
58+
pragma solidity 0.8.23;
5959
6060
contract Billboard {
6161
string public message;
@@ -72,15 +72,15 @@ contract Billboard {
7272

7373
If you're familiar with object-oriented programming, a contract will look an awful lot like the concept of a class. In effect, when a contract is deployed, a single instance becomes available for all the world to use — analogous to a "singleton" class.
7474

75-
For all users, a deployed contract has a particular state at any given block. In other words, the Billboard's `message` is always the same for everyone. A contract's state can keep track of all manner of things; within a token contract, for example, the state might include who owns how many of which assets.
75+
For all users, a deployed contract has a particular state at any given block in the blockchain. In other words, the Billboard's `message` is always the same for everyone, until someone updates it. A contract's state can keep track of all manner of things; within a token contract, for example, the state might include who owns how many of which assets.
7676

7777
In a Solidity contract, the `constructor` method is executed only once, when the contract is first deployed. Continuing the class analogy, the `constructor` might remind you of the `__init__` method within a Python class or similar initialization methods in other languages. So, whoever deploys this contract gets to determine the starting billboard message.
7878

79-
You may have noticed the JavaScript-like syntax of Solidity, including the use of camelCasing, semicolons, and inline comments. A few notable differences exist as well: the type system, a compiler version declaration, and new keywords. Hopefully this example was simple enough to convey the concepts, but the intricacies of the language are beyond the scope of this article. You'll find links to more learning resources at the end.
79+
You may have noticed the JavaScript-like syntax of Solidity, including the use of camelCasing, semicolons, and inline comments. A few notable differences exist as well: the type system, a compiler version declaration, and new keywords. Hopefully this example was simple enough to convey the concepts, but the intricacies of the language are beyond the scope of this lesson. Continue learning in Academy to develop those skills.
8080

8181
## How does a contract get on the blockchain?
8282

83-
Earlier in this blog series, you may recall reading that the only way to make changes to the state of the Ethereum blockchain is via transactions. That remains true for deploying new contracts.
83+
Earlier in this series, do you recall reading that the only way to make changes to the state of the Ethereum blockchain is via transactions? That remains true for deploying new contracts.
8484

8585
While a contract is being written, developers will frequently compile their code for manual or automated testing. The output of each compilation is the contract's **bytecode**.
8686

@@ -137,7 +137,7 @@ So long as we're talking about the management of digital assets, you can program
137137
Over the years, standards for various digital assets have proposed, debated, and agreed upon, providing some foundational building blocks for more complex contracts. Among the most notable are the ERC-20 token standard (i.e., fungible tokens) and the ERC-721 standard (i.e., non-fungible tokens or "NFTs").
138138

139139
<Callout emoji="💡" size="md" variant="info">
140-
**Note**: To save you the Google search, _fungible_ means interchangeable or indistinguishable. In other words, if you own 100 fungible tokens, it doesn't make any difference which 100 tokens they are. NFTs, on the other hand, may each have unique qualities, so the particular token you own is significant.
140+
**Note**: To save you the web search, _fungible_ means interchangeable or indistinguishable. In other words, if you own 100 fungible tokens, it doesn't make any difference which 100 tokens they are. NFTs, on the other hand, may each have unique qualities, so the particular token you own is significant.
141141
</Callout>
142142

143143
To demystify those standards: the different token types are simply smart contract patterns that anyone can make use of. The ERC-20 standard specifies which functions your fungible token contract must include, but at its core, the contract simply maintains list of public addresses and how many tokens each one owns, represented by an integer.
@@ -162,40 +162,20 @@ contract MyToken is ERC20 {
162162

163163
Once deployed, the `MyToken` contract has access to all the functions defined in OpenZeppelin's `ERC20` contract implementation. Conveniently, you don't have to reinvent the wheel and can focus on what makes your token contract unique.
164164

165-
Beyond inheritance, contracts have the ability to interact with other deployed contracts or even serve as a _factory_ or _proxy_ for deploying still more contracts! Those concepts are good topics for future blog posts.
165+
Beyond inheritance, contracts have the ability to interact with other deployed contracts or even serve as a _factory_ or _proxy_ for deploying still more contracts! Those concepts are good topics for future lessons.
166166

167167
## A note on upgradeability
168168

169169
While the blockchain is said to be immutable, there are patterns of writing smart contracts that can support upgradeability. These patterns introduce trade-offs which may or may not make sense for your use case. The specifics are beyond the scope of this introductory lesson.
170170

171-
## Starting off on your own
172-
173-
A couple tips and resources to take your next steps:
174-
- Continue on your journey within D_D Academy. The Tiered NFT track and ERC-20 lesson are great next steps.
175-
- The user interface can be a bit intimidating, but [Remix](https://remix.ethereum.org/) is great for being able to open a web browser and have a Solidity developer environment immediately ready for use.
176-
- [Solidity by Example](https://solidity-by-example.org/) is a great reference manual to keep nearby while writing contracts. Succinct code samples are organized by topic.
177-
- OpenZeppelin's [Contracts Wizard](https://docs.openzeppelin.com/contracts/5.x/wizard) is a terrific starting point for token contracts, in particular. You can select a few preferences and have the bones of a contract generated for you. There's even a convenient button to open that contract within a Remix environment.
178-
- If you'd like some guided instruction, [CryptoZombies](https://cryptozombies.io/) is an accessible and high quality Solidity tutorial.
179-
- When you're ready for more Solidity challenges that connect to a JavaScript front-end, give [Speedrun Ethereum](https://speedrunethereum.com/) a try.
180-
- If you prefer video tutorials, Patrick Collins has a very comprehensive course with [Python](https://www.youtube.com/watch?v=M576WGiDBdQ) and [JavaScript](https://www.youtube.com/watch?v=gyMwXuJrbJQ) editions.
181-
- When you get stumped, the [Ethereum Stack Exchange](https://ethereum.stackexchange.com/) is a great place to see if your question has been well-answered already.
182-
183-
## Future iterations
184-
185-
Remix shines when used for rapid ideation and learning the ropes. Once you get more invested in testing, writing custom scripts, and sharing your codebase with a team, you may outgrow Remix.
186-
187-
When you're ready for them, there are a range of smart contract development framework options, written in various languages and with varying trade-offs. Ethereum.org maintains a list of those [frameworks](https://ethereum.org/en/developers/docs/frameworks/). For those of you in the Python ecosystem, I give an introduction to the Ape framework [here](https://snakecharmers.ethereum.org/intro-to-ape/).
188-
189171
## And breathe
190172

191173
We covered a lot of ground! Did all that sink in? Test yourself:
192174

193175
<br />
194176
<QuizStatusChecker quiz="quiz-eth-intro-3" />
195177

196-
If you're satisfied with your answers, you've now got a strong foundation on which to begin your dapp-building journey. Use the resources recommended above to take your next steps and be sure to document your own journey! Many of the tools in this industry are brand new or rapidly evolving. A great way to make a positive impact is simply to help improve the documentation of each tool as you find opportunities to.
197-
198-
For now at least, this concludes the three-part series, _A Developer's Guide to Ethereum_. If you're building in the Python ecosystem, you'll find more one-off guides for web3.py on the Snake Charmers [blog](https://snakecharmers.ethereum.org/).
178+
For now at least, this concludes the three-part series, _A Developer's Guide to Ethereum_. If you're satisfied with your answers, you've now got a strong foundation on which to begin your dapp-building journey. Continue your next steps in Academy and be sure to document your own journey! Many of the tools in this industry are brand new or rapidly evolving. A great way to make a positive impact and grow your network is simply to help improve the documentation of each tool as you find opportunities to.
199179

200180
Happy building! ⚡️
201181

0 commit comments

Comments
 (0)