This post is from a low-reputation account and contains an unverified outbound link. Be cautious before clicking external links.

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

chupd(25)
Published in
#smart
Words
52
Reading
1 min
Listen
Play
8y

잘못된 생성 방법

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/

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

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

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