A simple blockchain implementation using Elixir.
- Start the server with Blockchain.start_link().
- Create accounts with Accounts.create_account(String, Integer).
- The first parameter is a string used for the account name.
- The second parameter is an integer for account balance tokens. By default is 0.
- After you have created accounts now you can make transactions and mine blocks.
- To make a transaction between accounts use Blockchain.make_transaction(String, String, Integer)
- First and second parameter are strings used to specify the public keys of the sending and receiving account.
- The third parameter is an integer specifying the sent amount.
- To mine a new block use Blockchain.create_block(String)
- String specifying the account from which the new block is mined.
- To make a transaction between accounts use Blockchain.make_transaction(String, String, Integer)
- To see the blocks in the chain use Blockchain.show_blocks()
- To see the accounts use Accounts.show_accounts()
- To see the transactions pool use Pool.show_transactions_pool()
- To see the coinbase use Coinbase.get_total_value()
If available in Hex, the package can be installed
by adding blockchain
to your list of dependencies in mix.exs
:
def deps do
[
{:blockchain, "~> 0.1.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/blockchain.