diff --git a/blockchain.json b/blockchain.json index 7dd6210..e8a1c42 100644 --- a/blockchain.json +++ b/blockchain.json @@ -1 +1 @@ -[{"sender":{"P":null,"Q":null,"G":null,"Y":null},"recipient":{"P":null,"Q":null,"G":null,"Y":null},"miner":{"P":null,"Q":null,"G":null,"Y":null},"amount":0,"nonce":0,"R":0,"S":0,"miningTime":0,"difficulty":0,"previousBlockHash":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"timestamp":"0001-01-01T00:00:00Z"},{"sender":{"P":124334585104178018537342354507973396229081486761522638665531587228378821572146308508040265181448362979380041028812468562654458638087008520917706538759743858057739798219334114639642712323100006159568840572201452789112766967306545744051923877499403078217652976253866837175759751485975307908215307693172716083951,"Q":1325683629013751074584942400294182844511772252959,"G":26141189716406718735166685954688468302446411755761057594764426589010889617733449918677660549354929129990052410279264115900911908928290282365235099116814778923262737065487773320997659370640354573996110246242658866145422245611500205259643638514924156846224797192485592075928422150636297085091237112406248487655,"Y":111896023106432554777809308052085863034982465927166615553218927304801713083181810551956462303169716813833436449219419993350043269466866139597543167870732984366746098836377306502199983155278737536883971636034997486082415756904066748028920533259155461870402333867374806819743871633519713520336324574686122971428},"recipient":{"P":124334585104178018537342354507973396229081486761522638665531587228378821572146308508040265181448362979380041028812468562654458638087008520917706538759743858057739798219334114639642712323100006159568840572201452789112766967306545744051923877499403078217652976253866837175759751485975307908215307693172716083951,"Q":1325683629013751074584942400294182844511772252959,"G":26141189716406718735166685954688468302446411755761057594764426589010889617733449918677660549354929129990052410279264115900911908928290282365235099116814778923262737065487773320997659370640354573996110246242658866145422245611500205259643638514924156846224797192485592075928422150636297085091237112406248487655,"Y":123},"miner":{"P":168200871893033804870799634697462328944638433674704436661817787648633417925437204509339761693620849193268426903449070813327814689423746099093408374498357397459163210972375554728987561297091040219031504155199990603856392988701625639694879468087547312335911491057186512893098304324633020945086331849246867043357,"Q":1046670084638218396077199143251551363208506465433,"G":69047398695399525831031561001040812108714655194608942657210883880294137135420501106340297843261123670356989516418430722690789106439363484616426323979169215129999077346179350969565207439847971188781773312235420180319247278754552121253960951801593954552971243013906009254854302868272537872839739658369900959967,"Y":113593122885902890126821985757995540498761934354780946290216480898050693031336617247853256701540193881823377608209337819471139085473392314868277017349646409074676710198743237383827261388430299524926303183320949235512066755896303849119592387944547093387305771252856786451218527389780259332808873733118050319479},"amount":0,"nonce":107205,"R":941144495764846559675675538749071345253657097734,"S":1045292061480776227279410969126303648902832058938,"miningTime":9304712711,"difficulty":100000,"previousBlockHash":[34,74,4,191,81,58,244,37,24,85,239,153,81,190,217,206,161,23,155,60,225,95,77,215,229,64,156,175,53,67,133,27],"timestamp":"2024-03-15T17:30:40.686168336-07:00"},{"sender":{"P":124334585104178018537342354507973396229081486761522638665531587228378821572146308508040265181448362979380041028812468562654458638087008520917706538759743858057739798219334114639642712323100006159568840572201452789112766967306545744051923877499403078217652976253866837175759751485975307908215307693172716083951,"Q":1325683629013751074584942400294182844511772252959,"G":26141189716406718735166685954688468302446411755761057594764426589010889617733449918677660549354929129990052410279264115900911908928290282365235099116814778923262737065487773320997659370640354573996110246242658866145422245611500205259643638514924156846224797192485592075928422150636297085091237112406248487655,"Y":111896023106432554777809308052085863034982465927166615553218927304801713083181810551956462303169716813833436449219419993350043269466866139597543167870732984366746098836377306502199983155278737536883971636034997486082415756904066748028920533259155461870402333867374806819743871633519713520336324574686122971428},"recipient":{"P":124334585104178018537342354507973396229081486761522638665531587228378821572146308508040265181448362979380041028812468562654458638087008520917706538759743858057739798219334114639642712323100006159568840572201452789112766967306545744051923877499403078217652976253866837175759751485975307908215307693172716083951,"Q":1325683629013751074584942400294182844511772252959,"G":26141189716406718735166685954688468302446411755761057594764426589010889617733449918677660549354929129990052410279264115900911908928290282365235099116814778923262737065487773320997659370640354573996110246242658866145422245611500205259643638514924156846224797192485592075928422150636297085091237112406248487655,"Y":123},"miner":{"P":168200871893033804870799634697462328944638433674704436661817787648633417925437204509339761693620849193268426903449070813327814689423746099093408374498357397459163210972375554728987561297091040219031504155199990603856392988701625639694879468087547312335911491057186512893098304324633020945086331849246867043357,"Q":1046670084638218396077199143251551363208506465433,"G":69047398695399525831031561001040812108714655194608942657210883880294137135420501106340297843261123670356989516418430722690789106439363484616426323979169215129999077346179350969565207439847971188781773312235420180319247278754552121253960951801593954552971243013906009254854302868272537872839739658369900959967,"Y":113593122885902890126821985757995540498761934354780946290216480898050693031336617247853256701540193881823377608209337819471139085473392314868277017349646409074676710198743237383827261388430299524926303183320949235512066755896303849119592387944547093387305771252856786451218527389780259332808873733118050319479},"amount":0,"nonce":81758,"R":941144495764846559675675538749071345253657097734,"S":1045292061480776227279410969126303648902832058938,"miningTime":9875618426,"difficulty":100000,"previousBlockHash":[0,0,60,12,123,166,127,35,63,17,177,255,142,159,135,148,112,69,164,81,154,149,171,144,191,239,108,164,167,72,31,158],"timestamp":"2024-03-15T17:30:40.686217108-07:00"}] \ No newline at end of file +[{"sender":{"P":null,"Q":null,"G":null,"Y":null},"recipient":{"P":null,"Q":null,"G":null,"Y":null},"miner":{"P":null,"Q":null,"G":null,"Y":null},"amount":0,"nonce":0,"R":0,"S":0,"miningTime":0,"difficulty":0,"previousBlockHash":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"timestamp":"0001-01-01T00:00:00Z"},{"sender":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":51996143750538274136478406075177963521686622109835488246960703257111262626004591372611340083515304440734194408968806358833815439538317123457791789387734545041878387973535122170421410379125837323285892931516696214770626046526978455381349501023425999012502666016495567773381174249500463277838446882128660738179},"recipient":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":123},"miner":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":51996143750538274136478406075177963521686622109835488246960703257111262626004591372611340083515304440734194408968806358833815439538317123457791789387734545041878387973535122170421410379125837323285892931516696214770626046526978455381349501023425999012502666016495567773381174249500463277838446882128660738179},"amount":0,"nonce":57784,"R":120673424799108260233418723037671238952905847948,"S":414620227771783302622005043717071932179462850880,"miningTime":18111636943,"difficulty":100000,"previousBlockHash":[34,74,4,191,81,58,244,37,24,85,239,153,81,190,217,206,161,23,155,60,225,95,77,215,229,64,156,175,53,67,133,27],"timestamp":"2024-03-17T16:28:46.648769749-07:00"},{"sender":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":51996143750538274136478406075177963521686622109835488246960703257111262626004591372611340083515304440734194408968806358833815439538317123457791789387734545041878387973535122170421410379125837323285892931516696214770626046526978455381349501023425999012502666016495567773381174249500463277838446882128660738179},"recipient":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":111896023106432554777809308052085863034982465927166615553218927304801713083181810551956462303169716813833436449219419993350043269466866139597543167870732984366746098836377306502199983155278737536883971636034997486082415756904066748028920533259155461870402333867374806819743871633519713520336324574686122971428},"miner":{"P":109323646573944889017971237778979166402951725319866372099867982932268881762684139782899268033891823409243311489268588260056684363244728025842481944674695388396691286222725852102221017739551478086381994507889733922711574564153732248684860038129398518695786805476154353065843578991278852472230970998664035001731,"Q":921422443924672895878224248303232639235422794719,"G":64959536327200260046979789588575676756756503754983503606783280973770165695981612756742027273458939956322333435733300087757009868486842332523727514121178851322832964076299888901772063159288598340072206469466898501288945024583024250201415528129071120965682994878678832555302104941534265440367510272776298887332,"Y":51996143750538274136478406075177963521686622109835488246960703257111262626004591372611340083515304440734194408968806358833815439538317123457791789387734545041878387973535122170421410379125837323285892931516696214770626046526978455381349501023425999012502666016495567773381174249500463277838446882128660738179},"amount":1,"nonce":290797,"R":543224510889230789310846360669632071437128505256,"S":309045618337553885435084149056761959954947541482,"miningTime":137044572099,"difficulty":300000,"previousBlockHash":[0,0,95,216,202,79,21,9,134,255,110,91,89,155,26,138,155,217,140,9,64,132,232,251,21,171,123,95,177,116,209,191],"timestamp":"2024-03-17T16:29:30.955304197-07:00"}] \ No newline at end of file diff --git a/builds/node/node_darwin-amd64 b/builds/node/node_darwin-amd64 index ee7ee8c..7f2afb3 100755 Binary files a/builds/node/node_darwin-amd64 and b/builds/node/node_darwin-amd64 differ diff --git a/builds/node/node_darwin-arm64 b/builds/node/node_darwin-arm64 index 9668194..d55cd06 100755 Binary files a/builds/node/node_darwin-arm64 and b/builds/node/node_darwin-arm64 differ diff --git a/builds/node/node_linux-386 b/builds/node/node_linux-386 index bdee6cc..5e74b91 100755 Binary files a/builds/node/node_linux-386 and b/builds/node/node_linux-386 differ diff --git a/builds/node/node_linux-amd64 b/builds/node/node_linux-amd64 index 0baf056..a9b30a1 100755 Binary files a/builds/node/node_linux-amd64 and b/builds/node/node_linux-amd64 differ diff --git a/builds/node/node_linux-arm b/builds/node/node_linux-arm index d91549f..b7d5988 100755 Binary files a/builds/node/node_linux-arm and b/builds/node/node_linux-arm differ diff --git a/builds/node/node_linux-arm64 b/builds/node/node_linux-arm64 index 46e2433..9efb784 100755 Binary files a/builds/node/node_linux-arm64 and b/builds/node/node_linux-arm64 differ diff --git a/builds/node/node_windows-386 b/builds/node/node_windows-386 index 5dadf6a..004b3c4 100755 Binary files a/builds/node/node_windows-386 and b/builds/node/node_windows-386 differ diff --git a/builds/node/node_windows-amd64 b/builds/node/node_windows-amd64 index 5410d7c..07b181c 100755 Binary files a/builds/node/node_windows-amd64 and b/builds/node/node_windows-amd64 differ diff --git a/builds/node/node_windows-arm b/builds/node/node_windows-arm index a3c28e6..f3463d2 100755 Binary files a/builds/node/node_windows-arm and b/builds/node/node_windows-arm differ diff --git a/builds/node/node_windows-arm64 b/builds/node/node_windows-arm64 index 84189c0..6ac351f 100755 Binary files a/builds/node/node_windows-arm64 and b/builds/node/node_windows-arm64 differ diff --git a/create_block.go b/create_block.go index b9bffc4..2bb1768 100644 --- a/create_block.go +++ b/create_block.go @@ -69,6 +69,9 @@ func CreateBlock(sender dsa.PublicKey, recipient dsa.PublicKey, amount float64, block.PreviousBlockHash = [32]byte{} } block.Difficulty = previousBlock.Difficulty * (60 / uint64(previousBlock.MiningTime.Seconds())) + if block.Difficulty < minimumBlockDifficulty { + block.Difficulty = minimumBlockDifficulty + } block.Nonce++ hashBytes = HashBlock(block) hash = binary.BigEndian.Uint64(hashBytes[:])