diff --git a/lib/block.ex b/lib/block.ex index a174254..42618b7 100644 --- a/lib/block.ex +++ b/lib/block.ex @@ -11,6 +11,7 @@ defmodule Elixium.Blockchain.Block do defstruct index: nil, hash: nil, + version: 1, previous_hash: nil, difficulty: nil, nonce: 0, @@ -31,9 +32,9 @@ defmodule Elixium.Blockchain.Block do """ @spec initialize :: Block def initialize do - %Block{ + block = %Block{ index: 0, - hash: "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA", + hash: "", difficulty: 5.0, timestamp: DateTime.utc_now() |> DateTime.to_string(), transactions: [ @@ -50,6 +51,9 @@ defmodule Elixium.Blockchain.Block do } ] } + + %{block | hash: calculate_block_hash(block)} + end @doc """ @@ -60,12 +64,35 @@ defmodule Elixium.Blockchain.Block do def initialize(%{index: index, hash: previous_hash}) do %Block{ index: index + 1, + version: 1, previous_hash: previous_hash, difficulty: 4.0, timestamp: DateTime.utc_now() |> DateTime.to_string() } end + + @spec calculate_block_hash(Block) :: String.t() + def calculate_block_hash(block) do + %{ + index: index, + version: version, + previous_hash: previous_hash, + timestamp: timestamp, + nonce: nonce, + merkle_root: merkle_root + } = block + + Utilities.sha3_base16([ + Integer.to_string(index), + Integer.to_string(version), + previous_hash, + timestamp, + Integer.to_string(nonce), + merkle_root + ]) + end + @doc """ The process of mining consists of hashing the index of the block, the hash of the previous block (thus linking the current and previous block), the @@ -77,22 +104,9 @@ defmodule Elixium.Blockchain.Block do """ @spec mine(Block) :: Block def mine(block) do - %{ - index: index, - previous_hash: previous_hash, - timestamp: timestamp, - nonce: nonce, - merkle_root: merkle_root - } = block + %{nonce: nonce } = block - block = - Map.put(block, :hash, Utilities.sha3_base16([ - Integer.to_string(index), - previous_hash, - timestamp, - Integer.to_string(nonce), - merkle_root - ])) + block = Map.put(block, :hash, calculate_block_hash(block)) if hash_beat_target?(block) do block @@ -109,6 +123,7 @@ defmodule Elixium.Blockchain.Block do %{ hash: block.hash, index: block.index, + version: block.version, previous_hash: block.previous_hash, merkle_root: block.merkle_root, nonce: block.nonce, diff --git a/lib/validator.ex b/lib/validator.ex index 53500eb..734cbd7 100644 --- a/lib/validator.ex +++ b/lib/validator.ex @@ -38,7 +38,7 @@ defmodule Elixium.Validator do @spec valid_hash?(Block, number) :: :ok | {:error, {:wrong_hash, {:too_high, String.t(), number}}} defp valid_hash?(b, difficulty) do - with :ok <- compare_hash({b.index, b.previous_hash, b.timestamp, b.nonce, b.merkle_root}, b.hash), + with :ok <- compare_hash({b.index, b.version, b.previous_hash, b.timestamp, b.nonce, b.merkle_root}, b.hash), :ok <- beat_target?(b.hash, b.difficulty) do :ok @@ -55,11 +55,11 @@ defmodule Elixium.Validator do end end - @spec compare_hash({number, String.t(), String.t(), number, String.t()}, String.t()) :: + @spec compare_hash({number, number, String.t(), String.t(), number, String.t()}, String.t()) :: :ok | {:error, {:wrong_hash, {:doesnt_match_provided, String.t(), String.t()}}} - defp compare_hash({index, previous_hash, timestamp, nonce, merkle_root}, hash) do + defp compare_hash({index, version, previous_hash, timestamp, nonce, merkle_root}, hash) do computed = - [Integer.to_string(index), previous_hash, timestamp, Integer.to_string(nonce), merkle_root] + [Integer.to_string(index), Integer.to_string(version), previous_hash, timestamp, Integer.to_string(nonce), merkle_root] |> Utilities.sha3_base16() if computed == hash do diff --git a/test/block_test.exs b/test/block_test.exs index 72befcd..567fdd3 100644 --- a/test/block_test.exs +++ b/test/block_test.exs @@ -8,7 +8,8 @@ defmodule BlockTest do genesis = Block.initialize() assert genesis.index == 0 - assert genesis.hash == "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA" + assert genesis.hash == Block.calculate_block_hash(genesis) + assert genesis.version == 1 end test "can create a new empty block" do @@ -20,8 +21,10 @@ defmodule BlockTest do assert block.index == genesis.index + 1 assert block.previous_hash == genesis.hash + assert block.version == 1 end + test "can mine a block" do genesis = Block.initialize() diff --git a/test/blockchain_test.exs b/test/blockchain_test.exs index 39515e3..d3e0338 100644 --- a/test/blockchain_test.exs +++ b/test/blockchain_test.exs @@ -41,4 +41,13 @@ defmodule BlockchainTest do assert Blockchain.recalculate_difficulty() == 0 end + + test "chain.exs contains valid block hash" do + {chain, _} = Code.eval_file("test/fixtures/chain.exs") + ok = chain + |> Enum.map(& &1.hash == Block.calculate_block_hash(&1)) + |> Enum.all?() + assert ok + end + end diff --git a/test/fixtures/chain.exs b/test/fixtures/chain.exs index 0b7e69a..72f0336 100644 --- a/test/fixtures/chain.exs +++ b/test/fixtures/chain.exs @@ -1,294 +1,321 @@ [ - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "00003DB0C5652613D75A428EE7213F8948DDA272B9FAAC5EDDC5E78193673FA2", - index: 10, - merkle_root: "0C75214849F2AED41A247F26F1E1C9DA00DD0E6EAF9E6B1906E1D61B976EE2BE", - nonce: 2571, - previous_hash: "0000F9B65027DE0F15A97F3EC70FCC9732026F231367908A993154508E922AF5", - timestamp: "2018-02-19 20:17:13.555804Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "28432341D6CA2160E3596BBABE0BCB6DD18CCB51216AF0E0CF2C5DED79AAF486", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "28432341D6CA2160E3596BBABE0BCB6DD18CCB51216AF0E0CF2C5DED79AAF486:0" - } - ], - timestamp: "2018-02-19 20:17:13.556026Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "0000F9B65027DE0F15A97F3EC70FCC9732026F231367908A993154508E922AF5", - index: 9, - merkle_root: "53169A07C49A22571D1A30FF256E5AC90D6B2E19FC990AE578BC4AC163F1E997", - nonce: 6264, - previous_hash: "00002A8EA8F98A02098C2E6C0DF7CDA9AF1781349C4646BC2520009519891AE4", - timestamp: "2018-02-19 20:17:13.450557Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "5BA5992069DA73E71904B09C9F28006B43E4678B15386BB5ECEA515995AD0F48", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "5BA5992069DA73E71904B09C9F28006B43E4678B15386BB5ECEA515995AD0F48:0" - } - ], - timestamp: "2018-02-19 20:17:13.450753Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "00002A8EA8F98A02098C2E6C0DF7CDA9AF1781349C4646BC2520009519891AE4", - index: 8, - merkle_root: "7BBB038978F6825B774587D13C8583DAB2550682E88D70F1A573A8A8960D4DC9", - nonce: 11_414, - previous_hash: "0000E1BA6AD3A6FA288D2EBBEE843375DEEF50AAB7C15517E5BD404ED549769C", - timestamp: "2018-02-19 20:17:13.279529Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "05AD6967ED4CDF451B0AD2D91FCD6F946E16E21B8972F4349EB3FD73DF52DFB6", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "05AD6967ED4CDF451B0AD2D91FCD6F946E16E21B8972F4349EB3FD73DF52DFB6:0" - } - ], - timestamp: "2018-02-19 20:17:13.279655Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "0000E1BA6AD3A6FA288D2EBBEE843375DEEF50AAB7C15517E5BD404ED549769C", - index: 7, - merkle_root: "80D2497A3B0E06B4C894748298E1874DE17D352DD4D146892641FFE2D037B80F", - nonce: 2881, - previous_hash: "00009D2BAB1C74824847A4C985D912EDCBB6A9B458E5CAB8C1B165C82712498E", - timestamp: "2018-02-19 20:17:13.199553Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "EE91247A8CD9C9B130FEC35B5B712B9199AAD0C6374FC9271DA3FF1F8283F631", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "EE91247A8CD9C9B130FEC35B5B712B9199AAD0C6374FC9271DA3FF1F8283F631:0" - } - ], - timestamp: "2018-02-19 20:17:13.199689Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "00009D2BAB1C74824847A4C985D912EDCBB6A9B458E5CAB8C1B165C82712498E", - index: 6, - merkle_root: "AC353217F51E072123F823CFCAE964EB44F46B1F94108EC96E682D53FB8841B1", - nonce: 121_436, - previous_hash: "000031E6C2F65EE24B3F0455B29B919D83952169ED285B6998D13BABEA9AEC91", - timestamp: "2018-02-19 20:17:12.068655Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "5366BD054479273A7A00E174E8CEF98C16A952434C817CEF9FEBEB2B90141952", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "5366BD054479273A7A00E174E8CEF98C16A952434C817CEF9FEBEB2B90141952:0" - } - ], - timestamp: "2018-02-19 20:17:12.068850Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "000031E6C2F65EE24B3F0455B29B919D83952169ED285B6998D13BABEA9AEC91", - index: 5, - merkle_root: "82E2E259133CE457780A5132E4953A7EF2AC1FDE2E8D88CF9C5868E62B4FA4CE", - nonce: 9927, - previous_hash: "00000ABCBAEF13E5BB23B1833E8E3C6DF2630C939B916A77689B50F541181832", - timestamp: "2018-02-19 20:17:11.930151Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "AFB96333CD5750F1253718301FEB29C37B8C06C9CA34A547C351320B2977A9D4", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "AFB96333CD5750F1253718301FEB29C37B8C06C9CA34A547C351320B2977A9D4:0" - } - ], - timestamp: "2018-02-19 20:17:11.930298Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "00000ABCBAEF13E5BB23B1833E8E3C6DF2630C939B916A77689B50F541181832", - index: 4, - merkle_root: "858F6C76E3CE6FE6901770AAC5C5890D893D407532C0B16CB527276488258DAE", - nonce: 29_693, - previous_hash: "0000194E801B050AFBC86D9643FF39C0A777FEC467AD3B62D2C9342613554C59", - timestamp: "2018-02-19 20:17:11.612220Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "C2D60EA325C8731297B9DBC52238E75DB9FEBDBC2A2AFB1181891A6287364E81", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "C2D60EA325C8731297B9DBC52238E75DB9FEBDBC2A2AFB1181891A6287364E81:0" - } - ], - timestamp: "2018-02-19 20:17:11.612415Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "0000194E801B050AFBC86D9643FF39C0A777FEC467AD3B62D2C9342613554C59", - index: 3, - merkle_root: "7DCC3EB3946F77C48401BDF0532189BEBEC17C1AB3F06010D3B9BB05B7ECA086", - nonce: 8393, - previous_hash: "0000912365E1DC6A2C4E58FB8B0EA78E7D1B8095DDB4AE1E876181DA210CA08C", - timestamp: "2018-02-19 20:17:11.487178Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "FC8CC14F36C14D9383103A07248D5CCAC718028C94B458E6F9FCE8EFD548420B", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "FC8CC14F36C14D9383103A07248D5CCAC718028C94B458E6F9FCE8EFD548420B:0" - } - ], - timestamp: "2018-02-19 20:17:11.487432Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "0000912365E1DC6A2C4E58FB8B0EA78E7D1B8095DDB4AE1E876181DA210CA08C", - index: 2, - merkle_root: "FD345B4B94A69444B21FAF3E96D79F430EBCA315211C71D61A8A6F4A6474A3C0", - nonce: 105_954, - previous_hash: "0000CBF7F60385B7AED0D468CD4A0334D634E14E974A0C67946BEE8FEA13655A", - timestamp: "2018-02-19 20:17:10.527809Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "23F9EBE1529E46BF2ABBC38924AF14DDD49F2C3A3CE1A3C8EE43235B915B3CFB", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "23F9EBE1529E46BF2ABBC38924AF14DDD49F2C3A3CE1A3C8EE43235B915B3CFB:0" - } - ], - timestamp: "2018-02-19 20:17:10.528096Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "0000CBF7F60385B7AED0D468CD4A0334D634E14E974A0C67946BEE8FEA13655A", - index: 1, - merkle_root: "98A7A8CB790BA7B2F98E716F662EC87E5026FF49673591C5C9CA1FD58A9FB530", - nonce: 130_507, - previous_hash: "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA", - timestamp: "2018-02-19 20:17:09.344803Z", - transactions: [ - %Elixium.Transaction{ - designations: [], - fee: 0, - id: "1C3D89C62BB4A7E0AAE73415DE0848B9214DFF26EDA00613C0ACEDC6A01F77FC", - inputs: [], - outputs: [ - %{ - addr: - "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", - amount: 100.0, - txoid: "1C3D89C62BB4A7E0AAE73415DE0848B9214DFF26EDA00613C0ACEDC6A01F77FC:0" - } - ], - timestamp: "2018-02-19 20:17:09.347068Z", - txtype: "COINBASE" - } - ] - }, - %Elixium.Blockchain.Block{ - difficulty: 4.0, - hash: "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA", - index: 0, - merkle_root: nil, - nonce: 0, - previous_hash: nil, - timestamp: "2018-02-19 20:17:09.305017Z", - transactions: [ - %{ - inputs: [], - outputs: [ - %{ - addr: nil, - amount: nil, - data: "GENESIS BLOCK", - txoid: "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA:0" - } - ] - } - ] - } + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000A23C3D541A44F575D09BC8D0D7080493AB295BCBC9F39229A8A6F1CDD29", + index: 11, + merkle_root: "8A629F71916CC6F690146378E91815D0704B1B72C8F4696B75DEA50FAE061FF2", + nonce: 83921, + previous_hash: "0000077E74627951E01EE76DDF7F7609788CFED573F4BFAB4D2D577545ED5FCC", + timestamp: "2018-11-11 03:11:00.047788Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "D788C172419B156E8BB3AC1E64AE61CB9E8D084BDA41129BE6BA614BEACC3D53", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0315325659755404009217886, + txoid: "D788C172419B156E8BB3AC1E64AE61CB9E8D084BDA41129BE6BA614BEACC3D53:0" + } + ], + timestamp: "2018-11-11 03:11:00.047926Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "0000077E74627951E01EE76DDF7F7609788CFED573F4BFAB4D2D577545ED5FCC", + index: 10, + merkle_root: "33D7F64E85034D6C8936AC5FBE7C6B2D29B402720F5AD40B46F9C0D7F53D1E4E", + nonce: 425316, + previous_hash: "00000709CCCFE4933CB2EDBCF2D2040B48916855097AEE018F82C9C20D5C415A", + timestamp: "2018-11-11 03:10:55.741559Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "119D40FFF389C0CC16706EC2BA0E673268280EDA23047DE7040AD23FB98BF650", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0318221530067517094700363, + txoid: "119D40FFF389C0CC16706EC2BA0E673268280EDA23047DE7040AD23FB98BF650:0" + } + ], + timestamp: "2018-11-11 03:10:55.741699Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000709CCCFE4933CB2EDBCF2D2040B48916855097AEE018F82C9C20D5C415A", + index: 9, + merkle_root: "1E9A3B1735D4146607773F104B02DBBE932D143CC1142CBE412D8B53DC4ECB9A", + nonce: 5795987, + previous_hash: "00000B87D259EFD1D97E9252264685F651431D6CB5B3302B5D12A94F9B8AB10F", + timestamp: "2018-11-11 03:09:58.221460Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "6DC66AEE72FA111FEDC16D5DDC846199700908329103D0241435FEAA1FC90BF7", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0321117400379630180182840, + txoid: "6DC66AEE72FA111FEDC16D5DDC846199700908329103D0241435FEAA1FC90BF7:0" + } + ], + timestamp: "2018-11-11 03:09:58.221589Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000B87D259EFD1D97E9252264685F651431D6CB5B3302B5D12A94F9B8AB10F", + index: 8, + merkle_root: "5A6913722B7734D92BCC4526F3B344A087ED54E9BE5A3F996B8B59F0FC67EED7", + nonce: 487918, + previous_hash: "00000A7B65FFB5690B9D18A450E15265C49868766176FE17EDAE6C1F91FC90F1", + timestamp: "2018-11-11 03:09:53.419242Z", + transactions: [ + %Elixium.Transaction{ + designations: [], fee: 0, id: "A4544FEF8CC32FC92D1622579A8BC29FA5D4CDC38E614C29D827EF8EB1DB1D69", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0324013270691743265665317, + txoid: "A4544FEF8CC32FC92D1622579A8BC29FA5D4CDC38E614C29D827EF8EB1DB1D69:0" + } + ], + timestamp: "2018-11-11 03:09:53.419365Z", + txtype: "COINBASE" + } + ], + version: 1}, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000A7B65FFB5690B9D18A450E15265C49868766176FE17EDAE6C1F91FC90F1", + index: 7, + merkle_root: "7830ADBB085AEF5EDB106BAA02A09944162D0B1D6AF35930568479C7344EA358", + nonce: 297915, + previous_hash: "000005BB261D77C3915C447FE4B8D6E0C03047AB415D6D622160E086F749A93F", + timestamp: "2018-11-11 03:09:50.468850Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "581B6EB506E9CCF5AEBE361C587F96BE0C8F544FDA5BFCAB4D09804D7C33A134", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0326909141003856351147794, + txoid: "581B6EB506E9CCF5AEBE361C587F96BE0C8F544FDA5BFCAB4D09804D7C33A134:0" + } + ], + timestamp: "2018-11-11 03:09:50.468985Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "000005BB261D77C3915C447FE4B8D6E0C03047AB415D6D622160E086F749A93F", + index: 6, + merkle_root: "5FA2BC1B8EF371DA5717B962227F01BFBC63121940BB93F1E5280BB3C4E616B7", + nonce: 4669853, + previous_hash: "00000C99FBE9511060066941DC8A8A49EC4EAED020E4EFC77930D8F59A9DB1C9", + timestamp: "2018-11-11 03:09:04.227613Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "23BA6B325264EB3CC1581243E316D7976EA5E06F8620033F5A485FAB5105047B", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0329805011315969436630271, + txoid: "23BA6B325264EB3CC1581243E316D7976EA5E06F8620033F5A485FAB5105047B:0" + } + ], + timestamp: "2018-11-11 03:09:04.227737Z", + txtype: "COINBASE" + } + ], + version: 1}, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000C99FBE9511060066941DC8A8A49EC4EAED020E4EFC77930D8F59A9DB1C9", + index: 5, + merkle_root: "51C19D4BA5D2AE92A9551CC9968D0EB995658A7B39AAC4A596413E85F6630EC9", + nonce: 32975, + previous_hash: "00000D91F99E2DBEF709FFF478640D01080BC9A921DC426F18822127FE813941", + timestamp: "2018-11-11 03:09:03.888647Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "6F788DD1786667A4E8C2B64A7238EC2B162AE80F4638F06AE1090A29235690B8", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0332700881628082522112748, + txoid: "6F788DD1786667A4E8C2B64A7238EC2B162AE80F4638F06AE1090A29235690B8:0" + } + ], + timestamp: "2018-11-11 03:09:03.888780Z", + txtype: "COINBASE" + } + ], + version: 1}, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000D91F99E2DBEF709FFF478640D01080BC9A921DC426F18822127FE813941", + index: 4, + merkle_root: "A6F92078B48247553B9B42BEC0173EA0D270D442003829F0E4E918436074060A", + nonce: 460847, + previous_hash: "00000008662EB371A0D46A0E4C0C62F2ABB2386182DD2E98FAE79AE4DF24A783", + timestamp: "2018-11-11 03:08:59.328354Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "189AB28F14261EC0444B461265B7482E5782C96C76E3D1A01B629592C336AA2E", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0335596751940195607595225, + txoid: "189AB28F14261EC0444B461265B7482E5782C96C76E3D1A01B629592C336AA2E:0" + } + ], + timestamp: "2018-11-11 03:08:59.328482Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000008662EB371A0D46A0E4C0C62F2ABB2386182DD2E98FAE79AE4DF24A783", + index: 3, + merkle_root: "532D5C8E079F85660640BE25A7E27392080C306762382BE2854C4B394C59CB17", + nonce: 95561, + previous_hash: "00000B741D6655E6EAC06223120A73664ED6AC5C5C3CCC071DF3244C92319A4D", + timestamp: "2018-11-11 03:08:58.400507Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "957A440BFA05A318E560019C290D110FF25882AAA5A8266B7083B16BAA764E75", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0338492622252308693077702, + txoid: "957A440BFA05A318E560019C290D110FF25882AAA5A8266B7083B16BAA764E75:0" + } + ], + timestamp: "2018-11-11 03:08:58.400638Z", + txtype: "COINBASE" + } + ], + version: 1 + }, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000B741D6655E6EAC06223120A73664ED6AC5C5C3CCC071DF3244C92319A4D", + index: 2, + merkle_root: "4890AADBBEF238F5D1B0AD7783122C947611E88F04B322DBFDF27490EB0D1C8E", + nonce: 697775, + previous_hash: "00000010D18D813E736E086F72885B6252B7EE500979CAD144B2E285574DECE3", + timestamp: "2018-11-11 03:08:51.483674Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "4390CE859B3CDC1A81821F8A8D770733ACFFC88E948A813B616BB7F149D60802", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0341388492564421778560179, + txoid: "4390CE859B3CDC1A81821F8A8D770733ACFFC88E948A813B616BB7F149D60802:0" + } + ], + timestamp: "2018-11-11 03:08:51.483806Z", + txtype: "COINBASE" + } + ], + version: 1}, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "00000010D18D813E736E086F72885B6252B7EE500979CAD144B2E285574DECE3", + index: 1, + merkle_root: "F5736FE60301A579D83C3CF8D1895E4DF63075DBB9460DC3A3C2578F80A68484", + nonce: 232155, + previous_hash: "1167800E1997A264D82868295BBE871757D241AD220D15372C58880F255C19C3", + timestamp: "2018-11-11 03:08:49.192153Z", + transactions: [ + %Elixium.Transaction{ + designations: [], + fee: 0, + id: "7A88CD3E6BD23C29804ACD8E8222719CA614AFEA26798B72213175B0168E0E51", + inputs: [], + outputs: [ + %{ + addr: "04E362FB58A53FD9CC84C25D35ECE30BC7DBBDD712044E4D12481070A158B9896E7ABE1C76ABDB67B1780A33A43DA3A76C2DAFDB5EEE7D2F2B5714E3F05E3DED88", + amount: 761.0344284362876534864042656, + txoid: "7A88CD3E6BD23C29804ACD8E8222719CA614AFEA26798B72213175B0168E0E51:0" + } + ], + timestamp: "2018-11-11 03:08:49.212921Z", + txtype: "COINBASE" + } + ], + version: 1}, + %Elixium.Blockchain.Block{ + difficulty: 5.0, + hash: "1167800E1997A264D82868295BBE871757D241AD220D15372C58880F255C19C3", + index: 0, + merkle_root: nil, + nonce: 0, + previous_hash: nil, + timestamp: "2018-11-11 03:08:23.461575Z", + transactions: [ + %Elixium.Transaction{ + inputs: [], + outputs: [ + %{ + addr: nil, + amount: nil, + data: "GENESIS BLOCK", + txoid: "79644A8F062F1BA9F7A32AF2242C04711A634D42F0628ADA6B985B3D21296EEA:0" + } + ] + } + ], + version: 1 + } ] + + + + + +