Subscribe to 2-333.eth
Subscribe to 2-333.eth
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
English:
Week 8 is my favorite solidity course because it didn't have the hassle of front-end and js.
answer ALL of these questions:
I'm not a computer science major in college and I only know some basic python and js. I'm currently learning solidity and want to work on web3 related stuff.
As I said at the beginning of the article, I like solidity related courses, especially it is related to Layer2.
I started the course on Oct 22 and finished it on Oct 29 with a total duration of about 8h.
I understood and modified the course solidity code according to the youtube tutorial www.youtube.com/watch?v=TL5NoWky3Uk and also learned some basic js testing skills.
I like some wonderful ways of thinking in this tutorial, such as the keccak256 data of randomA, which not only can provide cover for randomA, but also becomes a unique serial number for each BetGame.
I think the idea of keccak256 data as item serial number is inspiring, it prevents bored people from going through the 1..2..3..4. order to try to participate in projects that don't belong to him. Keeping the real data on the user side, encrypting the data and keeping it permanently on the blockchain to prevent someone from cheating, solves the problem that the blockchain is so completely public that users have no privacy. Just like zksync, the user keeps the raw data, calculates the data on demand and proves the authenticity to the institution, which could be the bridge between web3 and this is the world connection.
This project has inspired me so much that if a new person asks me how to get started with solidity, I will immediately recommend this lesson to him.
My address (I may delete the wallet address from this post when I mint nft): 0xe62ef3e82127bb97e641b15e866798c827206762
My smart contract code:
github.com/a9team2333/roadtoweb3/blob/main/week8/betgame-update-221028.sol
Some improvements I made to the contract.
{function killGame} If playerA never REVEAL, this game will never end and the player's token will be stored in the contract forever. So I added a time limit, if playerB acceptBet, playerA must choose to reveal within 100 minutes, otherwise playerB can choose to force the game to end, both bets belong to playerB. (You can't be duplicitous in a casino :))
{function recall} In order to prevent playerA from forgetting his random, a judgment function is added, where playerA will feedback whether it is bigger or smaller than the random after entering the number (this part needs to be cooperated with the front end, where player A enters the random, and the data will be stored temporarily until it is deleted at the end of the game). At the same time, in order to avoid hacker attacks, this function needs to be called at an interval of 3 minutes each time.
中文:
第八周是我最喜欢的solidity课程,因为它没有麻烦的前端和js。
answer ALL of these questions:
我的大学专业不是计算机专业,只会一些基础的python和js。我现在正在学习solidity,想要从事web3相关的工作。
正如文章开头所说,我喜欢solidity相关的课程,特别是它与Layer2相关。
我从10月22日开始学习,在10月29完成课程,总时长大概8h。
我根据youtube教程www.youtube.com/watch?v=TL5NoWky3Uk,理解和修改了课程solidity代码,也学会了一些基本的js测试技能。
我喜欢这个教程中一些奇妙的思维方式,比如randomA的keccak256数据,它不仅能够为randomA提供掩护,也成为了每一场BetGame独特的序号。
我认为keccak256数据作为项目序号的思路很有启发,它可以避免无聊的人通过1..2..3..4..的顺序来试着参加不属于他的项目。把真实数据保存在用户端,同时将数据加密处理并永久保存在区块链上,链上数据和用户数据互相验证,解决了区块链完全公开化以至于用户没有隐私的问题。正如zksync一样,用户保存原始数据,并根据验证需求来计算数据并向项目方证明真实性,这可能会成为web3和这是世界联系的桥梁。
这个项目对我启发很大,如果有新人问我如何入门solidity,我会立刻向他推荐这一课。
我对合约的一些改进:
{function killGame}如果玩家A一直不reveal,这个游戏会永无止境,玩家的token也将永远存放在合约里。因此我增加了时间限制,如果玩家B acceptBet,玩家A必须在100分钟内选择reveal,否则玩家B可以选择强行结束游戏,两份赌注都属于玩家B。(在赌场里你不能三心二意: ))
{function recall}为了防止玩家A忘记自己的random,增加了判断函数,玩家A输入数字后会反馈比random大还是小(这部分需要和前端配合,玩家A在前端输入random,数据会暂时储存,直到游戏结束后被删除),同时为了避免hacker攻击,这个函数每次调用需要间隔3分钟。
English:
Week 8 is my favorite solidity course because it didn't have the hassle of front-end and js.
answer ALL of these questions:
I'm not a computer science major in college and I only know some basic python and js. I'm currently learning solidity and want to work on web3 related stuff.
As I said at the beginning of the article, I like solidity related courses, especially it is related to Layer2.
I started the course on Oct 22 and finished it on Oct 29 with a total duration of about 8h.
I understood and modified the course solidity code according to the youtube tutorial www.youtube.com/watch?v=TL5NoWky3Uk and also learned some basic js testing skills.
I like some wonderful ways of thinking in this tutorial, such as the keccak256 data of randomA, which not only can provide cover for randomA, but also becomes a unique serial number for each BetGame.
I think the idea of keccak256 data as item serial number is inspiring, it prevents bored people from going through the 1..2..3..4. order to try to participate in projects that don't belong to him. Keeping the real data on the user side, encrypting the data and keeping it permanently on the blockchain to prevent someone from cheating, solves the problem that the blockchain is so completely public that users have no privacy. Just like zksync, the user keeps the raw data, calculates the data on demand and proves the authenticity to the institution, which could be the bridge between web3 and this is the world connection.
This project has inspired me so much that if a new person asks me how to get started with solidity, I will immediately recommend this lesson to him.
My address (I may delete the wallet address from this post when I mint nft): 0xe62ef3e82127bb97e641b15e866798c827206762
My smart contract code:
github.com/a9team2333/roadtoweb3/blob/main/week8/betgame-update-221028.sol
Some improvements I made to the contract.
{function killGame} If playerA never REVEAL, this game will never end and the player's token will be stored in the contract forever. So I added a time limit, if playerB acceptBet, playerA must choose to reveal within 100 minutes, otherwise playerB can choose to force the game to end, both bets belong to playerB. (You can't be duplicitous in a casino :))
{function recall} In order to prevent playerA from forgetting his random, a judgment function is added, where playerA will feedback whether it is bigger or smaller than the random after entering the number (this part needs to be cooperated with the front end, where player A enters the random, and the data will be stored temporarily until it is deleted at the end of the game). At the same time, in order to avoid hacker attacks, this function needs to be called at an interval of 3 minutes each time.
中文:
第八周是我最喜欢的solidity课程,因为它没有麻烦的前端和js。
answer ALL of these questions:
我的大学专业不是计算机专业,只会一些基础的python和js。我现在正在学习solidity,想要从事web3相关的工作。
正如文章开头所说,我喜欢solidity相关的课程,特别是它与Layer2相关。
我从10月22日开始学习,在10月29完成课程,总时长大概8h。
我根据youtube教程www.youtube.com/watch?v=TL5NoWky3Uk,理解和修改了课程solidity代码,也学会了一些基本的js测试技能。
我喜欢这个教程中一些奇妙的思维方式,比如randomA的keccak256数据,它不仅能够为randomA提供掩护,也成为了每一场BetGame独特的序号。
我认为keccak256数据作为项目序号的思路很有启发,它可以避免无聊的人通过1..2..3..4..的顺序来试着参加不属于他的项目。把真实数据保存在用户端,同时将数据加密处理并永久保存在区块链上,链上数据和用户数据互相验证,解决了区块链完全公开化以至于用户没有隐私的问题。正如zksync一样,用户保存原始数据,并根据验证需求来计算数据并向项目方证明真实性,这可能会成为web3和这是世界联系的桥梁。
这个项目对我启发很大,如果有新人问我如何入门solidity,我会立刻向他推荐这一课。
我对合约的一些改进:
{function killGame}如果玩家A一直不reveal,这个游戏会永无止境,玩家的token也将永远存放在合约里。因此我增加了时间限制,如果玩家B acceptBet,玩家A必须在100分钟内选择reveal,否则玩家B可以选择强行结束游戏,两份赌注都属于玩家B。(在赌场里你不能三心二意: ))
{function recall}为了防止玩家A忘记自己的random,增加了判断函数,玩家A输入数字后会反馈比random大还是小(这部分需要和前端配合,玩家A在前端输入random,数据会暂时储存,直到游戏结束后被删除),同时为了避免hacker攻击,这个函数每次调用需要间隔3分钟。
No activity yet