GithubHelp home page GithubHelp logo

input-output-hk / scorex Goto Github PK

View Code? Open in Web Editor NEW
503.0 70.0 79.0 7.81 MB

Modular blockchain framework. Public domain

License: Creative Commons Zero v1.0 Universal

Scala 12.25% Shell 0.01% CSS 3.41% HTML 0.19% JavaScript 84.14%

scorex's People

Contributors

alexeykiselev avatar asolovyov avatar catena2w avatar cryptox8 avatar gagarin55 avatar gitter-badger avatar jankotek avatar kushti avatar nvmd avatar oiwn avatar pitrov avatar pozharko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scorex's Issues

tmp data path

I get the following error. Tried a fix with sbt recompile && sbt startLocal1 and deleting all tmp folders, but didn't work for me.

tmp data gets stored in e.g. /tmp/wallet1 . I suggest a folder such as /tmp/scorex/wallet1 (so one can rm -r /tmp/scorex).

[main] >> [ERROR] scorex.Server$ >> 12:35:45.527  STARTUP ERROR: 
org.mapdb.DBException$DataCorruption: wrong header in file: /tmp/wallet1/wallet.s.dat
    at org.mapdb.StoreDirect.initOpen(StoreDirect.java:178) ~[scorex.jar:1.1.0-SNAPSHOT]
    at org.mapdb.StoreWAL.initOpenPost(StoreWAL.java:227) ~[scorex.jar:1.1.0-SNAPSHOT]
...
Caused by: java.io.IOException: Parent folder does not exist: /tmp/data1/signatures
    at org.mapdb.Volume$FileChannelVol.checkFolder(Volume.java:1790)
    at org.mapdb.Volume$MappedFileVol.<init>(Volume.java:1158)
    ... 24 more

Release automation

Create Jenkins task that make release:

  • run tests
  • update versions
  • publish to sonatype
  • commit/push changes
  • make nightly builds

Scorex version

I found that Scorex doesn't have own version.
ScorexApiRoute located in Lagonaki and returns scorex version from Constants defined in Lagonaki project.

What do think about to have two verions in future - for Scorex itself and Lagonaki app ?

Stackable APIs

Make modular API design to get modules-specific routing wired in an application

Dependently Typed keys, signatures, digests

At the moment a key / a signature / a digest is just Array[Byte], with some runtime checks made with the help require()/ensuring(). Describe those entities with sized arrays(presented in Shapeless) to get compile-time guarantees.

Peers Persistence

Implement disk-based persistence for peers whitelist/blacklist in PeerDatabaseImpl (instead of in-heap Buffer). Probably by using MapDb.

Share development plan

Since there is no issues in this project, nobody can help you with development. If there'll be some issues, open source comunity can increasy development speed

Web frontend

HTTP backend is already in place. Should be quite easy to add HTML/JS frontend. Would be interesting for e.g. visualizing transactions and consensus.

Settings.json path

Hi,

I tried running with start.sh, but a change is needed: with changing the script to the following it worked (scorex.Start does not exist):

#!/bin/sh

rm -rf data/

sbt clean

sbt compile

sbt start-script

cp settings.json target

sh -c 'target/start settings.json'

Implement Peer Blacklisting

Finish peer blacklisting. For now, Blacklist signal to be sent in case of bad behavior. Further steps:

  1. Connection drop
  2. Add peer to persistent blacklist
  3. Check for blacklist while adding peers to database during peers lists exchange. Filter by ip?

Protected API calls

Some API calls (payment/stop/???) should not be available for unauthorized users

Add wiki Docs

  • Quick start guide
  • Settings configuration
  • Security configuration (api_key, ???)

Genesis block timestamp

For now genesis block's timestamp calculates every time in Block class (genesis method) but for some consensus alogs it is important to have fixed value.
It will be great to be able have to change this behavior somehow.
Thanks!

Move P2P logic to basics module

Network layer is part of the top-level application now. The should be split to modular design as well, and core logic should be in the scorex-basics module.

Block height in http api

It would be great to return block height in /blocks/seq/{from}/{to} and /transactions/info api method

http api header fields format

It is a good idea to rename api_key header field to api-key.
Because HTTP standard suppose use '-' as name delimiter and some http servers check it. Eg. nginx will cut off api_key from request.

Fuzzing tests

We should add ability to add random delays to network messages, that emulates network latency.

Problem with api: transactions/address/

Hi all!

I have tried to get transactions for particular address.

The request

http://23.94.190.226:9081/transactions/address/kVVAu6F21Ax2Ugddms4p5uXz4kdZfAp8g

returns:

Ooops! The server was not able to produce a timely response to your request. Please try again in a short while!

Is it right that this method must return txs for any address ?

preferable JSON style

Hi guys!

I'm thinking about json fields naming style in your project. Now you use '-' as separator. For instance: 'consensus-algo'. But in JavaScript it will be problem because we can't use '-' in variable's name.
There is workaround for JS: data["consenus-algo"] or data["some long name"].
But may be it will be more comfortable use something like '_' or camelCase? What do you think ?

I have just found Google Style : https://google.github.io/styleguide/jsoncstyleguide.xml

it's up to you, just want know your decision/opinion

Invalid block processing

When invalid block is received from any peer we should

  1. Add this peer to blacklist and don't ask blocks from it
  2. Forget his score, if it's maximum score in blockchain

api method for transaction info ?

Hi guys!
Sorry for a stupid question,but is it possible to get particular transaction info by http api?
I didn't find any method at swagger definition :(

puz = hash(lastBlockPuz ++ lastBlockS)

Current puz calculation (puz = hash(lastBlockId)) is vulnerable to cheap iterations. s value is costly to replay so it is the only value should be used.

http api /blocks/seq

I want suggest small improvement.

/blocks/seq rest method returns now transactions as array in array.

For instance:

.... "transactions": [ [ { "type": 1, .....

I think it will be always only one element in parent array. Shall we fix response structure?

Different Tx type representation as bytes array

I've found that when we need represent *PaymentTransaction * as bytes array we use tx type as 1-byte array proof

override lazy val bytes: Array[Byte] = {
    val typeBytes = Array(TypeId.toByte)
......

But when we calculate singnature data we represent Tx type as 4-byte array proof:

  private def signatureData(sender: PublicKeyAccount, recipient: Account,
                            amount: Long, fee: Long, timestamp: Long): Array[Byte] = {
    val typeBytes = Ints.toByteArray(TransactionType.PaymentTransaction.id)
......

Shall we use similar solution in both cases ?

The only one logging solution

Throughout the code there are few logging solutions being used, Logback / JUL, sometimes println even. Consider the only solution & use it everywhere

StackOverflow for incorrect settings.json

If we provide incorrect wallet file path to Wallet.scala we will have empty wallet seed and stuck in infinity loop:

in Wallet.scala

def readSeed(): Array[Byte] = Base58.decode(scala.io.StdIn.readLine()).getOrElse {
        println("Wallet seed should be correct Base58 encoded string.")
        readSeed()
      }
      readSeed()

Example:

    val walletFile = new java.io.File(s"/asdfasdfasdfasdftmp/wallet${Random.nextLong()}.dat")
    val w = new Wallet(Some(walletFile), "", None)

Tests running error using sbt console

Tried to run test from console:

sbt test

got

[info] Run completed in 819 milliseconds.
[info] Total number of tests run: 10
[info] Suites: completed 7, aborted 0
[info] Tests: succeeded 10, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[error] ../Scorex-Lagonaki/src/test/scala/scorex/ScorexTestSuite.scala:15: not found: type CryptoTestSuite
[error]   ,new CryptoTestSuite
[error]        ^
[error] one error found
[error] (scorex/test:compileIncremental) Compilation failed
[error] Total time: 9 s, completed Sep 23, 2015 4:21:24 AM

NullPointerException during Handshake construction

Some time after start we have NullPointerException in the logs.
Short investigation shows that it happens due to null as appVersion argument during Handshake construction


[ERROR] [05/18/2016 09:44:31.374] [lagonaki-akka.actor.default-dispatcher-18] [akka://lagonaki/user/networkController/$x] null
java.lang.NullPointerException
        at scorex.network.Handshake.bytes$lzycompute(Handshake.scala:21)
        at scorex.network.Handshake.bytes(Handshake.scala:20)
        at scorex.network.PeerConnectionHandler$$anonfun$handshake$1.applyOrElse(PeerConnectionHandler.scala:80)
        at scala.PartialFunction$OrElse.applyOrElse(PartialFunction.scala:170)
        at akka.actor.Actor$class.aroundReceive(Actor.scala:482)
        at scorex.network.PeerConnectionHandler.aroundReceive(PeerConnectionHandler.scala:31)
        at akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
        at akka.actor.ActorCell.invoke(ActorCell.scala:495)
        at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at akka.dispatch.Mailbox.exec(Mailbox.scala:234)
        at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
        at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
        at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
        at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)

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.