Solitary Heling first 131 days of cold self-python block chain 045 Ethernet Square erc20 token 15

Solitary Heling first 131 days of cold self-python block chain 045 Ethernet Square erc20 token 15

【main content】

Additional comment today to study a solidity intelligent contract, a simple crowdfunding eth intelligence contracts. 28 minutes learning common.

(Also finishing taking notes took about 39 minutes)

Details see the end the process of learning the learning process screen video.

 

[About the solidity of the processing time]

The main study of Bowen: https: //www.jianshu.com/p/4b8e943ce7f2

Object timestamp (timestamp) learned solidity like that there is no language in date processing module and function objects such as a complete system python language, it's all just the original date and time.

Original excerpt:

solidity use their own local unit of time

Variables now returns the current unix timestamp (since January 1, 1970 after a number of seconds).

Note: Unix time the traditional stores a 32-bit integer. This will lead to "2038" issue, when the 32-bit unix time stamp is not enough, an overflow occurs, this time using a legacy system trouble. So, if we want our DApp enough to run for 20 years, we can use the 64-bit integer representing time, but our customers do this they have to pay more for gas.

Solidity further comprising second (seconds), min (minutes), h (hours), days (days), weeks (weeks) and annual (years) like time units. They are placed into corresponding seconds in uint. Therefore, one minute is 1/60 is 3600 hours (60 seconds × 60 minutes), one day is 86400 (24 hours × 60 minutes × 60 seconds), and so on.

Here are some practical case using the time unit:

```

uint lastUpdated;

 

// The 'last updated' to 'now'

function updateTimestamp() public {

  lastUpdated = now;

}

 

// If the last `updateTimestamp` more than five minutes, return 'true'

Less than 5 minutes // returns 'false'

function fiveMinutesHavePassed() public view returns (bool) {

  return (now >= (lastUpdated + 5 minutes));

}

```

 “

 

[To learn of this contract were intelligent autonomous analytical understanding and endorsement]

```

pragma solidity ^ 0.4.7;

 

contract WoYaoZongChou{

    address owner; // this variable record contract deployer (owner) address

    uint public goal; // target amount to be Crowdfunding (of course, here refers to the eth)

    uint public endtime; // refers to the length of this Crowdfunding (an unsigned integer, in seconds), if the purpose of the amount within date period after the date of deployment contracts plus this number of days, then the crowdfunding goals reached contract deployment can take away all the congregation to raise money, otherwise participation by the public themselves to raise their own share of the money returned.

    uint public total = 0; // This is the amount of actual crowdfunding to

   

    mapping (address => uint) gift; // Amount crowdfunding each participating node address of the actual donation, i.e. the amount corresponding to the address

   

    // Here is a function of the construction contract (only once on the deployment)

    // When deploying the contract, the duration manually specify the target amount and crowdfunding Crowdfunding (total)

    constructor(uint _goal, uint _time) public{

        owner = msg.sender;

        goal = _goal;

        endtime = now + _time;

        // variables now returns the current unix timestamp (since January 1, 1970 after a number of seconds).

        // from Bowen: https: //www.jianshu.com/p/4b8e943ce7f2

    }

   

    // call contract user nodes involved in crowdfunding, to transfer a certain amount of the contract addresses eth

    // this function to my doubts that does not reflect (like his hair as tokens contract) registration changes in the balance of both eth

    // preliminary understanding is:

    // It is used as tokens eth itself, so when calling this contract during the transfer node operation eth, eth record and broadcast network itself has completed a mobile eth token balance between two nodes

    function donate() payable public{

        require(now < endtime);

        require(total < goal);

        require(msg.value > 0);

        gift [msg.sender] + = msg.value; // record in the gift table at the current node adds a certain amount of donation (which means that a node can be called many times make a donation contract)

        total + = msg.value; // let the current actual crowdfunding increase in the balance

    }

   

    // If crowdfunding success, that is, within the stipulated time, the crowdfunding goal than or equal to a preset amount of money on eth, then prove successful, the deployment of this node can be removed eth contract to contract on account of deployed nodes.

    function draw() public{

        require (msg.sender == owner); // this call must first ensure that contracts and call this function nodes are deployed by the contract.

        require (total> goal); // really judge crowdfunding goal has been reached.

        owner.transfer (address (this) .balance); // execute transfers to the node address deployment contract from the contract address

        // transfer method of writing eth tokens is very simple:

        // node receives the transfer amount .transfer (transfer amount)

        // transfer amount so designated [] of [eth will be transferred to the receiving node transfer amount]

    }

   

    // If the crowdfunding node fails, the participation Crowdfunding can call contracts in their approach to get their donations

    function withdraw() public{

        require (now> endtime); // only publicly raise time has passed, this function is available by calling

        require (total <goal); // determine Analyzing all the chips has failed.

        uint amount = gift [msg.sender]; // get a total donation of nodes before the current contract calls eth of the total amount

        total - = amount; // eth reduce the amount of the current contract calls node ready to retrieve from the total amount of

        gift [msg.sender] = 0; // in the gift table, call the registration of new contracts node of the current donation amount is 0

        address (msg.sender) .transfer (amount); // total amount of the contract before the current call node donated a total of eth transferred back to the node current call contracts

    }

}

 

 

```

[Learning] Postscript

With today's study, I deeply understand the technology blocks to the center of the chain of trust to solve the huge change - such activities as crowdfunding, if not block chain technology, we will certainly need a centralized organization ( such as those crowdfunding agencies) to ensure the endorsement of the trust - which in fact is impossible to completely eliminate the crisis of confidence - because any centralized organization can never be completely transparent.

And with things like smart contract, it all becomes very simple, because the smart deployed a contract can no longer be modified, and content intelligence contracts are open and transparent, such as the above two functions [draw] [ withdraw], its specific implementation constraints for each node involved in crowdfunding are clearly seen, and I believe this is absolutely not modified, so the trust to solve the problem fundamentally.

If we can solve the subsequent use of public and trust funds through crowdfunding after intelligence contract, then the block chain technology really will completely change the world.

 

[Number of insights and summary of this stage of learning python block chain]

To this day, I have to know and learn from scratch block chain has 45 days, and on the block chain from the technology completely clueless, and today it already has a very deep understanding, I saw a vast picture of the future.

This stage of learning this block chain will come to an end, it will be suspended from tomorrow to learn new knowledge for some time, turn to practice project, led me to learn [is] a community learning platform will be ready by ERC20 intelligent system integration contract carried out on the chain, as a beginner, there is certainly more difficult, but no more difficult thing is meaningless things. I thought constantly challenge themselves from one another to get out of the comfort zone, is the sophisticated life.

Welcome to the community [is] to learn, this is a completely open, equal exchange of community, hope aspire to lifelong learning lifelong friends gather to grow together, grow together!

Community groups are qq: 646854445 expect the exchange with you.

 

[Routine of self-description of the stick]

The last routine explanation, why should I insist on self-study.

 

"If I had not seen the sun, I can live with this dark, but the sun has made me desolate, desolate updated."

- Emily Dickinson

If you want to ask me how to look at his earlier life, I think yesterday and today's answers will be completely different.

Yesterday, I live in desolate satisfaction, conscious peace of mind, took the bag body monthly salary, listening to the kind of command, almost invariably lived a life; sometimes mutual harmony to the people around children, sometimes tongue against preoccupied, show the trivial life, Chuiladanchang work; ecstasy, ecstasy, which can be integrated into the wonders of peace movement, the crushing of marching in step, marking time. At the time I think this is leisurely resignation of ordinary life, that is my fate up.

But one day, I saw a different sun and a different life circumstances under the sun - that's not desolate.

Today, I live in desolate pain, conscious desire to change, marching in step overwhelmed, watching the passage of life, who missed all eyes wide open remorse ... ...

Jiangzai I know I can not go back, I only change is the only right direction.

 

First, why old age is still learning

Give up a lot to go to dinner, go HI songs to play, go to the movies, catch drama ...... time, and then engaged in the learning age, should no longer seems to have been carried out, attracted endless people around puzzled and even contempt poor ......

But I do not want to give up the vow of lifelong learning.

because--

I do not agree with the status quo my life today!

Robert Kiyosaki told us, to reflect on their current life is not what you want, is not that the best motivation and answer?

Gone through most of their lives, and then only to find once, the moment the ongoing life is not what you want, it is a kind of experience?

Only the hearts of sincere feelings in order to answer this question, and then let the rich language is not portrayed.

Half of the trek experience, but found that does not go right, how many people have the courage to admit all the past is wrong?

And I'm willing to tell the past me: "! You're wrong."

So has experienced half a lifetime mistake, big pressure and age of the head, there is hope and a half from the end of the ladder frame and down again, then hobbled to climb another ladder in it?

I prefer to believe that there is hope!

This is why I want to continue to adhere to lifelong learning all the reasons to go on.

 

Second, at this age still learning these techniques do make sense

Pure technology this age are in fact no meaning.

But the interest can go beyond sense.

But technology can lead to changes in thinking, this is the meaning.

Invest in their own minds, their ideas of reform, this is the best preserved, more long-term investment, in the past I have never invested before, miss too much, then invest in their own minds from the start.

Robert Kiyosaki tells us that the really rich are rich time; real freedom is freedom to decide what they are willing to do.

Because I'm willing to do something where my interest, so I hope I have the freedom of choice that day, although that day may still be today from so far away, but I want to believe that more than a day to catch a few steps away from the hope that even taking a step forward.

Furthermore, although I might then have been unable to fully complete master these techniques, but the technology itself is the awakening of the heart may be enlightened, inspired, so as long as we understand that, I believe I will leave that to run away from me the more positive the faster the closer to the next point, and will not be abandoned by the unknown future that too far.

So how can I give up chasing the pace quest?

I want to believe: feeling too late, perhaps not too late.

 

I am grateful to have been concerned, I encourage you!

If anything against this one to the advanced age until I grew up in ridiculous Alas, please let us know.

Q My number is: 578 652 607, look forward to hearing your advice.

 

 

[Simultaneous voice notes]

https://www.ximalaya.com/keji/19103006/274964839

 

[Learning] screen recording screen

Links: https://pan.baidu.com/s/1voRSniK0rP4r0NN4pCVOgA

Extraction code: ofdu

 

Guess you like

Origin www.cnblogs.com/lhghroom/p/12589305.html