ethereum solidity 에서 안전하게 난수 생성하기

in #smart7 years ago (edited)

잘못된 생성 방법

solidity 에서 난수를 생성하는 방법으로, 보편적인 keccak256 해쉬 함수를 사용

( 주. SHA-2 와 SHA-3 가 궁금하면 https://ko.wikipedia.org/wiki/SHA-3 )

solidity v0.4.21 문서
http://solidity.readthedocs.io/en/v0.4.21/units-and-global-variables.html

바람직한 사용 방법

Oracle 을 활용한 외부 컨트랙트에서 생성후 가져오기
https://kndrck.co/posts/ethereum_oracles_a_simple_guide/

왜 이렇게 사용해야 하는가?

난수 생성의 결과가 마음에 들지 않을경우 트랜잭션에 포함하지 않고,
다시 난수를 발생할수 있기 때문에.

Sort:  

Congratulations @chupd! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Do not miss the last announcement from @steemitboard!

Congratulations @chupd! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @chupd! You received a personal award!

Happy Steem Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Downvote challenge - Add up to 3 funny badges to your board
Vote for @Steemitboard as a witness to get one more award and increased upvotes!