Skip to content

FRAIN-chain/hash-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TL;DR

$ npx hardhat test benchmark/gas.js --network hardhat

    Normal

Min: 22745
Max: 23144
Average (std): 22766.676434676434676434 (23.033533318397716373 = sqrt(530.543657129737715817))
Median: 22760
      ✓ Commit Hash

Min: 5236
Max: 757180
Average (std): 63611.785103785103785103 (47739.897636971280496974 = sqrt(2279097826.388496051499714502))
Median: 69526
      ✓ Reveal Hash

    Hashed

Min: 22686
Max: 22686
Average (std): 22686.0 (0.0 = sqrt(0.0))
Median: 22686
      ✓ Commit Hash

Min: 24805
Max: 24805
Average (std): 24805.0 (0.0 = sqrt(0.0))
Median: 24805
      ✓ Reveal Hash

Commit-and-Reveal Scheme in Solidity

  • solc: 0.6.12

Test

$ npx hardhat node
$ npx hardhat test benchmark/CommitReveal.js --network localhost

  CommitReveal
    Normal
Tester:  0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 (10000 ETH)
Deploy CommitReveal:     0x129955157BE2622EbB0a7bEBC990216C63069973
      ✓ Commit Hash (38734054 gas)
      ✓ Reveal Hash (71372250 gas)
    Hashed
      ✓ Commit Hash (36884859 gas)
      ✓ Reveal Hash (38856806 gas)

·----------------------------------|---------------------------|-------------|----------------------------·
|       Solc version: 0.6.12       ·  Optimizer enabled: true  ·  Runs: 200  ·  Block limit: 6718946 gas  │
···································|···························|·············|·····························
|  Methods                                                                                                │
·················|·················|·············|·············|·············|··············|··············
|  Contract      ·  Method         ·  Min        ·  Max        ·  Avg        ·  # calls     ·  usd (avg)  │
·················|·················|·············|·············|·············|··············|··············
|  CommitReveal  ·  commit         ·      44825  ·      62072  ·      45732  ·         820  ·          -  │
·················|·················|·············|·············|·············|··············|··············
|  CommitReveal  ·  commit_hashed  ·      44861  ·      44897  ·      44895  ·         820  ·          -  │
·················|·················|·············|·············|·············|··············|··············
|  CommitReveal  ·  reveal         ·      27831  ·     796620  ·      87124  ·         820  ·          -  │
·················|·················|·············|·············|·············|··············|··············
|  CommitReveal  ·  reveal_hashed  ·      47355  ·      47391  ·      47389  ·         819  ·          -  │
·················|·················|·············|·············|·············|··············|··············
|  Deployments                     ·                                         ·  % of limit  ·             │
···································|·············|·············|·············|··············|··············
|  CommitReveal                    ·          -  ·          -  ·     691625  ·      10.3 %  ·          -  │
·----------------------------------|-------------|-------------|-------------|--------------|-------------·

  4 passing (7m)

About

Solidity implementation of Commit-and-Reveal Scheme

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •