Git Product home page Git Product logo

blockchain's Introduction

Blockchain

Blockchain use for cryptocurrency transactions. Uses Proof of work for consensus.

Having in mind that blockchain runs in a distributed network, until I build a GUI for this project you'll have ot use:

  • Terminals, commandPromnt, etc.
    • For windows users I recommend GitBash
  • PostMan(app/web) versions
    • this is to make requests.

Local environment testing.

Open at least to terminals(GitBash) in project directory and PostMan(app or browser).

  1. In one of the terminals run npm run dev.

This should start a Peer-to-peer Networkk in P2P_PORT=5001. The application should be running in the HTTP_PORT= 3001

Lets reserve the [5002-5999] ports for P2P connections and the [3002-3999] ports for app connections.

RUN COMMANDS

There are 3 parameters when running this application. After running the app for the first time. like instructed earlier, to connect with another terminal you must concider 3 things:

  1. The HTTP_PORT you want to connect to. - HTTP_PORT=[3002-3999]
  2. The P2P_PORT. - P2P_PORT=[5002-5999]
  3. And the already connected PEERS
  • PEERS=ws://localhost:3001
  • for multiple peers separate with (,).
  • PEERS=ws://localhost:5001, ws://localhost:5002, ..., ...

Full Example: HTTP_PORT=[3002-3999] P2P_PORT=[5002-5999] PEERS=ws://localhost:5001, ws://localhost:5002 npm run dev

This command is to at least have to "computers" running the blockchain.

Requests

... look at app.js

blockchain's People

Contributors

benjaminap avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

blockchain's Issues

post Transaction

In app.js add post for '/transaction'

  • request.body must have:

  • recipient

  • amount

  • Redirect to '/transactions'

Wallet Transaction

Inside Wallet class:

  1. createTransaction(recipient, amount, transactionPool)
  • check for amount to be lower or equal to continue.
  • check for existing transaction to update.
  • return transaction.
  1. Make method to look for a existing transaction with -> "address".

  2. Test Wallet new functions.

get Transactions request

In app.js add a get request for '/transactions'

  • return a json response of the poolTransactions array.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.