SHARE
TWEET

difficulty forecast Gnosis

a guest Sep 2nd, 2015 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from ethereumAPI import EthereumAPI
  2.  
  3.  
  4. BLOCK_TARGET_NUMBER = 180000
  5. billion = 10**11
  6. bounds = []
  7. bounds.append(75 * billion)
  8. bounds.append(80 * billion)
  9. bounds.append(85 * billion)
  10.  
  11. e = EthereumAPI()
  12.  
  13.  
  14.  
  15. blocks_remaining = BLOCK_TARGET_NUMBER - int(e.number(),0)
  16. print blocks_remaining
  17.  
  18. print int(e.blockByNumber(160000)["difficulty"],0)
  19.  
  20. dif = float(int(e.blockByNumber(int(e.number(),0))["difficulty"],0))
  21. changes = []
  22.  
  23. periods_back = 30
  24. divide_by = 10
  25. print blocks_remaining / divide_by
  26.  
  27. for i in range(periods_back * divide_by):
  28.         dif = int(e.blockByNumber(int(e.number(),0)  - i * (blocks_remaining / divide_by))["difficulty"],0)
  29.         dif_new = int(e.blockByNumber(int(e.number(),0)  - i * (blocks_remaining / divide_by) - blocks_remaining)["difficulty"],0)
  30.         changes.append(dif / float(dif_new))
  31.         #dif = float(dif_new)
  32.  
  33. changes.sort()
  34. #print changes
  35.  
  36. dif = int(e.blockByNumber(int(e.number(),0))["difficulty"],0)
  37. last = 0
  38. for i in bounds:
  39.         for j in range(len(changes)):
  40.                 if dif * changes[j] > i:
  41.                         print float(j)/len(changes) - last
  42.                         last = float(j)/len(changes)
  43.                         break;
  44.                 #print 0
  45.                 #last = 0
  46. print 1 - last
  47.  
  48.  
  49.  
  50.  
  51. #print 0.225 + 0.475 + 0.275 + 0.025
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top