Skip to content

Experimental implementation of a multi-hash Blockchain network implemented in Java

Notifications You must be signed in to change notification settings

Daniel-Szego/Hashmatrix

Repository files navigation

Hashmatrix

Experimental implementation of a multi-hash Blockchain network

Cryptography:

  • Elliptic Curve Cryptography for signing transactions
  • SHA-256 for hash pointers between hashed

Network:

  • Java remoting

State:

  • Extended account/balance based system
  • Each account has a balance that can be transferred from
  • Each account has a data that can be modified
  • Each account has a nonce, to prevent replay attack
  • Account controlled by public-private keys generated by elipcit curve crypto
  • Account address is the public key
  • Account owner is the private key
  • Accounts are added to the chain indirectly, as they are referred by the transactions
  • Account types are introduced: 3 charcters, providing the possibility for multiply cryptoassets

Transactions:

  • Three kind of a transactions
  • Transferring money from balance to balance, signed by the from account private key
  • Setting new data value signed by the private key of the account
  • Conditional transaction implementing simple rule based value adding
  • Transaction nonce must be higher by one as the account nonce

Blocks:

  • containing transactions -> block headers merke root of transactions
  • containing state (set of accounts) -> block header merkle root of accounts
  • multi block header with different data retention policy
  • hash chain resets based on the policy

Blockchain:

  • fork resolving strategy: o longest blockchain is considered o stale blocks are not added and not saved o pick the first from the chains with the same length

Wallet:

  • Random wallet controlling accounts
  • New accounts can be generated by the wallet
  • Accounts are not syncronized with the chain automatically, only if transactions was initialized on that account

Wallet UI

  • experimental implementation of a desktop wallet
  • data transaction
  • fun transfer transaction
  • no callback, local mining is directly started by the wallet
  • UI is pretty shitty

Communication protocols:

  • getting peers -> only one round
  • propagating transactions -> only one hop: only in fully connected networks
  • propagating blocks -> only one hop: only in fully connected networks
  • network implementation: java remoting

Mining:

  • Proof of work miner
  • difficulty hard-coded
  • Fork resolving policy: longest chain

Smart Contract:

  • Simple rule based value setting
  • IF <account_condition> operator value THEN <account_effect> new_value
  • operator: equal, contains, startswith

Explorer:

  • minimum prototype desktop explorer, listing the network event

Command prommpt commands:

  • -startNetwork, -port, : starting the local peer on localhost
  • -createAccount : creating a new account in the local wallet
  • -createGenesisBlock : creating a demo genesis block
  • -createTransaction -state -address -value <string_value> -sign <owner_priv_key> : data setting transaction
  • -createTransaction -transfer -from <from_account> -to <to_account> -amount -sign <owner_priv_key> : transfer transaction
  • -createTransaction -rule : rule based transaction, rule string is like IF <account_condition> THEN <account_effect> <new_value>
  • -runMinerOne : running miner one round
  • -getAccountData -account : getting account data
  • -connectPeer -peerAddress -peerPort
  • -syncBlockchain

About

Experimental implementation of a multi-hash Blockchain network implemented in Java

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages