Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the blockchain available for external usage #27

Open
robinmonjo opened this issue Dec 3, 2017 · 6 comments
Open

Make the blockchain available for external usage #27

robinmonjo opened this issue Dec 3, 2017 · 6 comments

Comments

@robinmonjo
Copy link
Owner

The goal is to provide the blockchain part as an hex package so people can reuse it in their own project.

To achieve this we must:

  1. define an API that could work for "every use cases"
  2. document high level API + usage
  3. find a name for the package
  4. namespace the blockchain app with this name
  5. follow this guide to publish the app

@yordis the first part I think is to think about an API. For now, the Blockchain app exposes:

A protocol that data we want to store on the chain must follow:

defprotocol Blockchain.BlockData do
  @spec hash(t) :: String.t()
  def hash(data) 

  @spec verify(t, [Blockchain.Block.t()]) :: :ok | {:error, String.t()}
  def verify(data, chain)
end

A set of functions to interact with the blockchain

@yordis you have a use case in mind, this is perfect to define what APIs you will need. We can then include them in the project. Then we must find a name for the package and namespace it. Waiting for suggestions 😊

@yordis
Copy link
Collaborator

yordis commented Dec 3, 2017

  1. Just put it under Coincoin.Blockchain with the package name of coincoin_blockchain

@yordis
Copy link
Collaborator

yordis commented Dec 3, 2017

  1. What will the blockchain be responsable for?

This is thinking on all the use cases.

@robinmonjo
Copy link
Owner Author

Ok if we put it under Coincoin.Blockchain we should auto alias it in coincoin so people don't have to type Coincoin.Blockchain.command every time. Looks like it's doable not sure if it works with releases though ...

The blockchain is responsible for what it is currently:

  • communication between peers
  • communication protocol (including Proof-of-Work)
  • storing data

@yordis
Copy link
Collaborator

yordis commented Dec 3, 2017

@robinmonjo yes, about the aliasing. Look my PR I didn't change that piece on your code because I used the alias.

  • Will be the P2P be part of the blockchain or could we extract it as well? You know better so think if we can divide as well
  • I am not clean about PoW being part of the protocol. What do you mean by that? Specially that technologies like ETH have to move away from PoW for a reason (do not scale when you add it with smart contract shit, nobody will like to do miner work, unless you give them a really high paid transaction)
  • storing data, then we need to define a good protocol around it and we should be good to go

@robinmonjo
Copy link
Owner Author

Sure we could extract the P2P part too. But this won't have much value by its own without the blockchain logic on top of it.

Blockchains are ran on a network of untrusted peers. Having a mechanism such as PoW or PoS is mandatory in such environment to ensure consensus between peers.

What do you mean about "food protocol" ?

@yordis
Copy link
Collaborator

yordis commented Dec 3, 2017

"food protocol" type I will fix it BrokeBack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants