Blockchain random number generating system and blockchain random number generating method

11586420 ยท 2023-02-21

Assignee

Inventors

Cpc classification

International classification

Abstract

The disclosure provides a blockchain random number generating system and blockchain random number generating method. The blockchain random number generating system includes a smart contract. A second electronic device generates a second random number and a second hash value corresponding to the second random number, and transmits the second hash value to a first block of the smart contract. A first electronic device generates a first random number and a first hash value corresponding to the first random number, and transmits the first hash value to a second block of the smart contract. A fifth block of the smart contract receives a real-time transaction index, and generates a random seed according to the real-time transaction index, the first random number and the second random number and calculates a result of the smart contract in the fifth block according to the random seed.

Claims

1. A blockchain random number generating system, comprising: a first electronic device; a second electronic device; and a smart contract, wherein the second electronic device generates a second random number and a second hash value corresponding to the second random number, and transmits the second hash value to a first block of the smart contract, the first electronic device generates a first random number and a first hash value corresponding to the first random number, and transmits the first hash value to a second block of the smart contract, the first electronic device transmits the first random number to a third block of the smart contract and the second electronic device transmits the second random number to the third block, a fifth block of the smart contract receives a real-time transaction index, and generates a random seed according to the real-time transaction index, the first random number, and the second random number, and calculates a result of the smart contract in the fifth block according to the random seed.

2. The blockchain random number generating system of claim 1, wherein the smart contract generates a random seed according to a block hash value of a fourth block, the real-time transaction index, the first random number, and the second random number and calculates a result of the smart contract in the fifth block according to the random seed, a block index value of the fourth block is a block index value of the fifth block minus one.

3. The blockchain random number generating system of claim 1, wherein the smart contract issues a penalty corresponding to the first electronic device when determining that a hash result of the first random number is not equal to the first hash value, the smart contract issues a penalty corresponding to the second electronic device when determining that a hash result of the second random number is not equal to the second hash value.

4. The blockchain random number generating system of claim 1, wherein when the smart contract receives the first hash value in the second block, the smart contract is in a contract-established state.

5. The blockchain random number generating system of claim 1, wherein the fifth block of the smart contract receives the real-time transaction index from an external data retrieval function.

6. A blockchain random number generating method, adaptable for a first electronic device, a second electronic device, and a smart contract, the blockchain random number generating method comprising: generating a second random number and a second hash value corresponding to the second random number by the second electronic device, and transmitting the second hash value to a first block of the smart contract; generating a first random number and a first hash value corresponding to the first random number by the first electronic device, and transmitting the first hash value to a second block of the smart contract; transmitting the first random number to a third block of the smart contract by the first electronic device and transmitting the second random number to the third block by the second electronic device; and receiving a real-time transaction index by a fifth block of the smart contract, and generating a random seed according to the real-time transaction index, the first random number and the second random number, and calculating a result of the smart contract in the fifth block according to the random seed.

7. The blockchain random number generating method of claim 6, wherein the smart contract generates a random seed according to a block hash value of a fourth block, the real-time transaction index, the first random number, and the second random number and calculates a result of the smart contract in the fifth block according to the random seed, a block index value of the fourth block is a block index value of the fifth block minus one.

8. The blockchain random number generating method of claim 6, wherein the smart contract issues a penalty corresponding to the first electronic device when determining that a hash result of the first random number is not equal to the first hash value, the smart contract issues a penalty corresponding to the second electronic device when determining that a hash result of the second random number is not equal to the second hash value.

9. The blockchain random number generating method of claim 6, wherein when the smart contract receives the first hash value in the second block, the smart contract is in a contract-established state.

10. The blockchain random number generating method of claim 6, wherein the fifth block of the smart contract receives the real-time transaction index from an external data retrieval function.

Description

BRIEF DESCRIPTION OF THE DRAWINGS

(1) FIG. 1 is a block view of a blockchain random number generating system according to an embodiment of the disclosure.

(2) FIG. 2 is a schematic view of a blockchain random number generating system according to an embodiment of the disclosure.

(3) FIG. 3 is a flowchart of a blockchain random number generating method according to an embodiment of the disclosure.

DESCRIPTION OF EMBODIMENTS

(4) FIG. 1 is a block view of a blockchain random number generating system according to an embodiment of the disclosure. FIG. 2 is a schematic view of a blockchain random number generating system according to an embodiment of the disclosure.

(5) Please refer to FIG. 1 and FIG. 2, a blockchain random number generating system 100 in an embodiment of the disclosure includes a first electronic device 110, a second electronic device 120, and a smart contract 130 (also referred to as a blockchain smart contract). The first electronic device 110 and the second electronic device 120 are, for example, a personal computer, a smart phone, a tablet computer or other similar devices held by the parties executing the smart contract. The smart contract 130 is, for example, a lottery, a multiplayer game, or other similar activities. The first electronic device 110 and the second electronic device 120 represent, for example, both the organizer and the participant of the lottery, or multiple players in a multiplayer game, or two participants in other events.

(6) In an embodiment, the second electronic device 120 generates a second random number (i.e., R.sub.B) and a second hash value (i.e., H.sub.B=hash (R.sub.B)) corresponding to the second random number, and transmits the second hash value (i.e., H.sub.B) to a block 0 (or referred to as first block) of the smart contract 130. The first electronic device 110 generates a first random number (i.e., R.sub.A) and a first hash value (i.e., H.sub.A=hash (R.sub.A)) corresponding to the first random number, and transmits the first hash value (i.e., H.sub.A) to a block 1 (or referred to as the second block) of the smart contract 130. When the smart contract 130 records the first hash value in the block 1, the contract of the smart contract 130 is established. After the contract is established, the first electronic device 110 transmits the first random number (i.e., R.sub.A) to a block 2 (or referred to as the third block) of the smart contract 130, and the second electronic device 120 transmits the second random number (i.e., R.sub.B) to the block 2 after the second electronic device 120 confirms that the first random number is written into the blockchain (that is, after confirming that the first electronic device 110 cannot modify the first random number). A block 7 (or referred to as the fifth block) of the smart contract 130 receives a real-time transaction index (for example, real-time NASDAQ index) from an external data retrieval function (for example, oracle function), and generates a random seed according to the real-time transaction index, the first random number and the second random number and calculate the result of the smart contract 130 in the block 7 according to the random seed.

(7) It should be noted that the smart contract 130 may issue a penalty corresponding to the first electronic device 110 when determining that the hash result of the first random number is not equal to the first hash value. The smart contract 130 may issue a penalty corresponding to the second electronic device 120 when determining that the hash result of the second random number is not equal to the second hash value.

(8) In an embodiment, the blockchain random number generating system 100 in the disclosure may not receive the first random number, the second random number, the first hash value, and the second hash value, and the block after the contract is established receives the real-time transaction index and generates a random seed according to the real-time transaction index, and calculates the result of the smart contract 130 according to the random seed.

(9) In an embodiment, the blockchain random number generating system 100 of the disclosure may also receive the first random number, the second random number, the first hash value, and the second hash value without receiving the above-mentioned real-time transaction index, and generate a random seed according to the first random number and the second random number and calculate the result of the smart contract 130 in the block 7 according to the random seed.

(10) In an embodiment, the smart contract 130 may also generate a random seed according to the block hash value of a block 6 (or referred to as the fourth block), the real-time transaction index, the first random number and the second random number, and calculate the result of the smart contract 130 in the block 7 (or referred to as the fifth block) according to the random seed.

(11) In an embodiment, the smart contract 130 may also generate a random seed according to the block hash value of the block 6 (or referred to as the fourth block), the first random number, and the second random number, and calculate the result of the smart contract 130 in the block 7 (or referred to as the fifth block) according to the random seed.

(12) FIG. 3 is a flowchart of a blockchain random number generating method according to an embodiment of the disclosure.

(13) In step S301, the second electronic device generates a second random number and a second hash value corresponding to the second random number, and transmits the second hash value to the first block of the smart contract.

(14) In step S302, the first electronic device generates a first random number and a first hash value corresponding to the first random number, and transmits the first hash value to the second block of the smart contract.

(15) In step S303, the first electronic device transmits the first random number to the third block of the smart contract and the second electronic device transmits the second random number to the third block.

(16) In step S304, the fifth block of the smart contract receives the real-time transaction index, and generates a random seed according to the real-time transaction index, the first random number and the second random number and calculates a result of the smart contract in the fifth block according to the random seed.

(17) In summary, in the disclosure, the blockchain random number generating system and the blockchain random number generating method receives a second hash value corresponding to the second random number from the second electronic device by the first block of the smart contract, and the contract is established after the second block of the smart contract receives the first hash value corresponding to the first random number from the first electronic device. Then, the third block of the smart contract receives the first random number from the first electronic device and receives the second random number from the second electronic device to determine whether the first electronic device and the second electronic device are in breach of contract. The fifth block of the smart contract receives the real-time transaction index and generates the random seed according to the real-time transaction index, the first random number and the second random number, and calculates the result of the smart contract in the fifth block according to the random seed. Therefore, neither party can predict or control all the variables in advance to predict the result of contract when the contract is signed.

(18) Although the present disclosure has been disclosed in the above embodiments, it is not intended to limit the present disclosure, and those skilled in the art can make some modifications and refinements without departing from the spirit and scope of the disclosure. Therefore, the scope of the present disclosure is subject to the definition of the scope of the appended claims.