Coder Social home page Coder Social logo

aschplatform / asch Goto Github PK

View Code? Open in Web Editor NEW
477.0 69.0 148.0 6.61 MB

Asch is an efficient, flexible, safe and decentralized application platform, which was initially designed to lower the barrier to entry for developers.The services provided by the Asch platform include a public chain and a set of application SDKs.

JavaScript 96.57% Shell 3.43%
asch dapp blockchain sidechain bitcoin nodejs cryptocurrency decentralized-applications

asch's Introduction

Build Status Author License Platform


Asch

Asch system is a decentralized application platform, which is designed to lower the threshold for developers, such as using JavaScript as develop language, supporting relational database to save transaction data, and making DAPP development be similar with traditional Web application. It is sure that these characteristics are very attractive to developers and SMEs. The ecosystem of the whole platform cannot be improved until developers make a huge progress on productivity. Also, Asch platform is designed to be open for various fields, not limited to some particular parts such as finance, file storage, or copyright proof. It provides underlying and abstract API which can be combined freely to create different types of applications. In consensus mechanism, Asch inherits and enhances DPOS algorithm, by which the possibility of forks and risk of duplicate payments would be significantly reduced. Furthermore, Asch sidechain mode not only can mitigate the pressure of blockchain expansion, but also make DAPP more flexible and personal. Asch system, as a proactive, low-cost and full stack solution, will surely be a next generation incubator of decentralized applications.

More infomation please visit

System Dependency

  • nodejs v10.14.1+
  • npm v6.4.1+
  • g++
  • libssl

For ubuntu 14.04.x or higher.

# Install dependency package
sudo apt-get install curl sqlite3 ntp wget git libssl-dev openssl make gcc g++ autoconf automake python build-essential -y
# libsodium for ubuntu 14.04
sudo apt-get install libtool -y
# libsodium for ubuntu 16.04
sudo apt-get install libtool libtool-bin -y

# Install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
# This loads nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

# Install node and npm for current user.
nvm install v8
# check node version and it should be v8.x.x
node --version

# git clone sourece code
git clone https://github.com/AschPlatform/asch && cd asch

# Install node packages
npm install

# Build
> node build linux {localnet|testnet|mainnet}

# Run
> cd build/asch-linux-{version}-{localnet|testnet|mainnet}
> chmod +x aschd
> ./aschd start

# or run
> node app.js

Installation on docker.

Please install Docker firstly

# pull asch code docker image
docker pull aschplatform/asch:v1.3.0
# run docker and asch
docker run -i -t --name asch1.3.0 -p 4096:4096 aschplatform/asch:v1.3.0 /bin/bash
root@e149b6732a48:/# cd /data/asch && ./aschd start
Asch server started as daemon ...

Web Wallet

Then you can open http://localhost:4096 in your browser to visit the Web Wallet.

Usage

node app.js --help

  Usage: app [options]

  Options:

    -h, --help                 output usage information
    -V, --version              output the version number
    -c, --config <path>        Config file path
    -p, --port <port>          Listening port number
    -a, --address <ip>         Listening host name or ip
    -b, --blockchain <path>    Blockchain db path
    -g, --genesisblock <path>  Genesisblock path
    -x, --peers [peers...]     Peers list
    -l, --log <level>          Log level
    -d, --daemon               Run asch node as daemon
    --reindex                  Reindex blockchain
    --base <dir>               Base directory

Default localnet genesis account

This is the genesis account of localnet and one hundred million XAS in it.

{
  "address": "ABuH9VHV3cFi9UKzcHXGMPGnSC4QqT2cZ5",
  "publicKey": "116025d5664ce153b02c69349798ab66144edd2a395e822b13587780ac9c9c09",
  "secret": "stone elephant caught wrong spend traffic success fetch inside blush virtual element" // password
}

Releated projects

License

The MIT License (MIT)

Copyright (c) 2016-2018 Asch
Copyright (c) 2015 Crypti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

asch's People

Contributors

a1300 avatar bassjobsen avatar bycnck avatar chengenguan avatar djgmygit avatar eaglehovering avatar johannesknopp avatar lbgod2222 avatar liangpeili avatar luckykaiyi avatar nswbmw avatar nuxkk321 avatar pinxue avatar sqfasd avatar yanyiwu 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

asch's Issues

node app.js failed when i pull the latest codes (1.3)

➜  asch git:(master) ✗ node app.js                                                                                     [108/1028]
log 2017-07-18 15:17:14 830 Asch started: 0.0.0.0:4096
fatal 2017-07-18 15:17:14 917 Error: Error: near line 163: table trs has no column named message

    at onerror (/home/yanyiwu/code/asch/src/dblite/index.js:252:24)
    at Socket.<anonymous> (/home/yanyiwu/code/asch/src/dblite/index.js:266:3)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at addChunk (_stream_readable.js:252:12)
    at readableAddChunk (_stream_readable.js:239:11)
    at Socket.Readable.push (_stream_readable.js:197:10)
    at Pipe.onread (net.js:589:20)

sodium install fail

     NEW_INT_PROP(crypto_stream_ ## ALGO ## _KEYBYTES); \
     ^~~~~~~~~~~~
../src/crypto_streams.cc:113:5: note: in expansion of macro ‘PROPS’
     PROPS(chacha20);
     ^~~~~
In file included from ../../nan/nan.h:197:0,
                 from ../src/include/node_sodium.h:20,
                 from ../src/crypto_streams.cc:8:
../../nan/nan_maybe_43_inl.h:116:35: note: declared here
 NAN_DEPRECATED inline Maybe<bool> ForceSet(
                                   ^~~~~~~~
/tmp/node_modules/sodium/install.js:288
            throw new Error(cmdLine + ' exited with code ' + code);
            ^

Error: make nodesodium exited with code null
    at ChildProcess.<anonymous> (/tmp/node_modules/sodium/install.js:288:19)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
npm WARN enoent ENOENT: no such file or directory, open '/tmp/package.json'
npm WARN tmp No description
npm WARN tmp No repository field.
npm WARN tmp No README data
npm WARN tmp No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node install.js --install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/zhenxi/.npm/_logs/2017-11-17T09_54_38_233Z-debug.log

API返回节点状态的建议

建议在每一个API返回信息中都包括当前节点的状态信息,客户端可以据此判断当前服务节点的状态。至少包括:最新区块高度,最新区块时间,当前服务器时间。

run source code failed

➜  asch git:(master) ✗ node app.js
log 2017-07-13 16:56:52 094 Asch started: 0.0.0.0:4096
module.js:598
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: Module did not self-register.
    at Object.Module._extensions..node (module.js:598:18)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Module.require (module.js:513:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/home/yanyiwu/code/asch/node_modules/sodium/lib/sodium.js:16:15)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)

➜  asch git:(master) ✗ node -v
v8.1.4

/api/transactions 逻辑混乱

api/transactions?recipientId=14762548536863074694&senderPublicKey=8065a105c785a08757727fded3a06f8f312e73ad40f1f3502e0232ea42e67efd&orderBy=t_timestamp:desc&limit=20&offset=0
这个请求想要的结果是and,但实际查询的时候有部分条件是or的关系。
如果把代码都改成and,则首页查不到交易记录

新账户命令行调用/api/transaction接口put方法进行转账报错

最新代码,新账户命令行调用/api/transaction接口put方法进行转账时会报错,但在web钱包转账则没有问题。

curl -k -H "Content-Type: application/json" -X PUT -d '{"secret":"ginger script clown ladder expand pigeon cancel tell struggle donate orbit napkin","amount":10000000,"recipientId":"AFc9P4xSVKArLxd737X8hv7SBbdFJbSj7u"}' 'http://localhost:4096/api/transactions'
{"success":false,"error":"Missing address or public key"}

原因:

1 openaccount(登陆)时不再记录公钥到数据库,但原来web登陆过的用户在db中能查到公钥,这样做是为了解决之前的系列bug,比如“未在web钱包登陆直接调用/api/transaction会出现account not found的问题,即转账不再需要先去登陆”
2 web钱包转账生成交易时是直接计算的交易签名,不需要从db查询公钥,所以新老账户都能正常转账
3.1 /api/transaction接口调用的是src/core/transactions.js中的addTransactions,将密码生成的公钥传到getAccount(src/core/accounts.js)通过library.base.account(src/base/account.js)去获取account信息(查数据库),但新账户查询返回的数据是没有公钥的,所以返回给addTransactions的account没有公钥。
3.2 addTransactions往下走,调用library.base.transaction.create(src/base/transaction.js),但是因为传入的account没有公钥(data.sender.publicKey),所以生成的签名信息中没有公钥。
3.3 addTransactions往下走,调用modules.transactions.receiveTransactions去应用交易,调用processUnconfirmedTransaction-->modules.accounts.setAccountAndGet-->Accounts.prototype.setAccountAndGet(src/core/accounts.js)但因为传入的对象{ publicKey: transaction.senderPublicKey }为空,所以直接return cb("Missing address or public key");

解决:
getAccount(src/core/accounts.js)对library.base.account的查询结果做一个处理,如果没有公钥那么直接把传进来的公钥加入到account中再返回给addTransactions

sqlite3进程占用cpu 100%

/api/accounts/top接口导致。该接口后面的sql导致cpu 100%。
select "username", "isDelegate", "u_isDelegate", "secondSignature", "u_secondSignature", "u_username", "address", lower(hex("publicKey")) as "publicKey", lower(hex("secondPublicKey")) as "secondPublicKey", "balance", "u_balance", "vote", "rate", (select GROUP_CONCAT(dependentId) from mem_accounts2delegates where accountId = a.address) as "delegates", (select GROUP_CONCAT(dependentId) from mem_accounts2u_delegates where accountId = a.address) as "u_delegates", (select GROUP_CONCAT(dependentId) from mem_accounts2multisignatures where accountId = a.address) as "multisignatures", (select GROUP_CONCAT(dependentId) from mem_accounts2u_multisignatures where accountId = a.address) as "u_multisignatures", "multimin", "u_multimin", "multilifetime", "u_multilifetime", "blockId", "nameexist", "u_nameexist", "producedblocks", "missedblocks", "fees", "rewards", "lockHeight" from "mem_accounts" as "a" order by "balance" desc limit 100;

npm test failed

➜  asch git:(master) ✗ npm test

> [email protected] test /home/yanyiwu/code/asch
> mocha --require mocha-babel



(node:6771) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'hea
der' of undefined
(node:6771) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are
 not handled will terminate the Node.js process with a non-zero exit code.
  1) "before all" hook: callee$0$0

  0 passing (36ms)
  1 failing

  1)  "before all" hook: callee$0$0:
     TypeError: Cannot read property 'header' of undefined
      at Test._assertHeader (node_modules/supertest/lib/test.js:208:19)
      at Test._assertFunction (node_modules/supertest/lib/test.js:247:11)
      at Test.assert (node_modules/supertest/lib/test.js:148:18)
      at assert (node_modules/supertest/lib/test.js:127:12)
      at node_modules/supertest/lib/test.js:124:5
      at Test.Request.callback (node_modules/superagent/lib/node/index.js:687:12)
      at ClientRequest.<anonymous> (node_modules/superagent/lib/node/index.js:639:10)
      at Socket.socketErrorListener (_http_client.js:400:9)
      at emitErrorNT (internal/streams/destroy.js:62:8)
      at _combinedTickCallback (internal/process/next_tick.js:102:11)

https://travis-ci.org/yanyiwu/asch/jobs/257804728

Asch升级与rebuild脚本升级

需求描述

  1. 作为节点用户,希望在运行asch rebuild或者upgrade的时候,能够提示一个可选的通道列表,以方便选择最合适或最快速的通道
  2. 至少包含两个种子通道,国内一个,国外一个,作为种子,内置在脚本中
  3. 提示的时候,需要包含通道的url,是国内还是国外,下载文件的md5sum,如果是rebuild,还要展示快照高度和时间,如果是upgrade,则要显示版本号

Travis 编译显示error

简单查了下目前看来似乎是sodium对node 8支持的不好,相关的issue : paixaop/node-sodium#120

个人想法是先直接把 travis 里面的 node 8 测试先删掉,先让测试通过。免得别人一直看到项目都是error状态,感觉不太好。

无公网ip进行p2p同步

本机笔记本搭建的虚拟机,无公网ip,版本1.1.1
#1.p2p直接同步

{"level":"log","message":"Block 13739514673166124509 loaded from 45.32.62.184:4096 at","timestamp":"2016-09-10 07:43:20 919","data":27240}
{"level":"info","message":"Removing peer GET http://61.49.232.193:4096/peer/signatures","timestamp":"2016-09-10 07:43:36 026"}   
{"level":"info","message":"Removing peer GET http://61.49.232.193:4096/peer/list","timestamp":"2016-09-10 07:44:52 163"}     
//这个节点无法连接,导致获取不到最新的节点列表,找不到下一个节点,查了下这是我自己的外网ip(路由器分得的ip)
卡主了

#2.查看当前的节点

43.241.227.162:4096 1.1.1 27251
222.161.26.233:4096 1.1.1 27251
115.159.183.175:4096 1.1.1 27251
115.159.194.28:4096 1.1.0 27251
61.177.35.222:4096 1.1.1 27251
119.29.238.31:4096 1.1.0 27251
114.215.185.200:4096 1.1.0 27247
120.24.182.36:4096 1.1.1 27251
45.32.19.241:4096 1.1.1 27251
45.32.252.52:4096 1.1.1 27251
45.32.248.33:4096 1.1.1 27251
45.32.22.78:4096 1.1.1 27251
45.32.62.184:4096 1.1.1 27251
61.49.232.193:4096 1.1.1 NaN        
======================================
12 height: 27251
1 height: 27247 114.215.185.200:4096
1 error: Request error: Error: connect ECONNREFUSED 61.49.232.193:4096 61.49.232.193:4096

#3.重启

./aschd restart

#4.正常同步

{"level":"log","message":"Block 17773867360424133440 loaded from 115.159.194.28:4096 at","timestamp":"2016-09-10 07:49:19 260","data":27274}
{"level":"log","message":"Block 4580021809615737743 loaded from 115.159.194.28:4096 at","timestamp":"2016-09-10 07:49:19 266","data":27275}
{"level":"log","message":"Loading 1 blocks from","timestamp":"2016-09-10 07:49:19 305","data":"115.159.194.28:4096"}        
//peerStr变量没打印出来
{"level":"log","message":"Block 7659093256240674728 loaded from 115.159.194.28:4096 at","timestamp":"2016-09-10 07:49:19 311","data":27276}

{"level":"info","message":"Removing peer GET http://61.49.232.193:4096/peer/signatures","timestamp":"2016-09-10 07:49:19 572"}    //这次直接过去了

{"level":"info","message":"Check blockchain on 61.177.35.222:4096","timestamp":"2016-09-10 07:49:38 663"}
{"level":"info","message":"Looking for common block with 61.177.35.222:4096","timestamp":"2016-09-10 07:49:38 664"}
{"level":"info","message":"Found common block 7659093256240674728 (at 27276) with peer 61.177.35.222:4096, last block height is 27276","timestamp":"2016-09-10 07:49:38 837"}
{"level":"log","message":"Loading 1 blocks from","timestamp":"2016-09-10 07:49:38 883","data":"61.177.35.222:4096"}
{"level":"log","message":"Block 11695764717976879393 loaded from 61.177.35.222:4096 at","timestamp":"2016-09-10 07:49:38 914","data":27277}

{"level":"info","message":"Check blockchain on 120.24.182.36:4096","timestamp":"2016-09-10 07:49:48 620"}
{"level":"info","message":"Looking for common block with 120.24.182.36:4096","timestamp":"2016-09-10 07:49:48 621"}
{"level":"info","message":"Found common block 11695764717976879393 (at 27277) with peer 120.24.182.36:4096, last block height is 27277","timestamp":"2016-09-10 07:49:48 819"}
{"level":"log","message":"Loading 1 blocks from","timestamp":"2016-09-10 07:49:48 888","data":"120.24.182.36:4096"}
{"level":"log","message":"Block 11752414667528652591 loaded from 120.24.182.36:4096 at","timestamp":"2016-09-10 07:49:48 901","data":27278}

之后能一直同步最新的区块

怀疑Round.prototype.tick函数会有几率造成不一致

问题分析

当区块高度为505707时,这时刚好完成第5007轮结算(每101个区块结算一次)
之所以卡块是因为,这个区块apply之后,数据库出现了不一致性,导致下一轮的受托人排名与其他节点的排名不一致,于是下一个区块到来的时候,会通不过检验,就不能接受新的区块了

测试和重现方案

  1. 把mainnet的区块链下载下来,在第505706块时,构造一个snapshot,并禁止启动网络模块
  2. 获得第505707块的block数据,调用processBlock, 记录当前的受托人数据,包括投票数、余额等
  3. 调用popLastBlock,回滚该区块,并记录当前的受托人数据,比如投票、余额等
  4. 反复执行上面两个步骤,直到出现不一致,然后分析日志

UIA新增接口,根据指定资产返回交易记录

背景

原来的/api/uia/transactions/:address接口用于返回指定账户的所有资产操作记录
/api/uia/transfers/:address/:currency接口用于返回指定账户和制定资产的所有操作记录

需求说明

  1. 这两个接口命名不太合理,可以合并到一个uri下,比如/api/uia/my/transactions
  2. 需要新增一个根据指定资产返回资产操作记录的接口, 不限定账户了, /api/uia/transactions/:currency

主网1.1.5节点运行报错直接退出

{"level":"info","message":"Looking for common block with 106.14.45.12:8192","timestamp":"2017-02-09 01:18:58 988"}
{"level":"info","message":"Found common block 1518104767700375799 (at 1501961) with peer 106.14.45.12:8192, last block height is 1501961","timestamp":"2017-02-09 01:18:59 022"}
{"level":"log","message":"Loading 1439 blocks from","timestamp":"2017-02-09 01:19:02 947","data":"106.14.45.12:8192"}
{"level":"log","message":"Block 14954908233605090347 loaded from 106.14.45.12:8192 at","timestamp":"2017-02-09 01:19:02 980","data":1501962}
{"level":"log","message":"Block 16641632668832042828 loaded from 106.14.45.12:8192 at","timestamp":"2017-02-09 01:19:03 005","data":1501963}
...
{"level":"log","message":"Block 9785152359305830651 loaded from 106.14.45.12:8192 at","timestamp":"2017-02-09 01:29:55 338","data":1525453}
{"level":"log","message":"Block 1949618104125083819 loaded from 106.14.45.12:8192 at","timestamp":"2017-02-09 01:29:55 352","data":1525454}
...
{"level":"info","message":"Received new block id: 6451765306592868204 height: 1525490 round: 15104 slot: 1954652 reward: 350000000","timestamp":"2017-02-09 01:35:20 590"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:35:20 611"}
{"level":"info","message":"Generate new block at height 1525491","timestamp":"2017-02-09 01:35:30 057"}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 217","data":55}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 254","data":77}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 258","data":76}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 263","data":76}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 269","data":75}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 273","data":75}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 277","data":74}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 281","data":73}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 284","data":72}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 290","data":71}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 294","data":70}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 298","data":69}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 302","data":68}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 306","data":67}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 310","data":66}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 314","data":65}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 317","data":64}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 322","data":63}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 328","data":62}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 332","data":61}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 336","data":60}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 339","data":59}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 344","data":59}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 348","data":58}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 352","data":57}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 357","data":56}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 362","data":58}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 367","data":57}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 370","data":56}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 374","data":55}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 378","data":54}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 381","data":53}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 385","data":52}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 389","data":51}
{"level":"warn","message":"Main queue","timestamp":"2017-02-09 01:35:30 392","data":50}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:35:30 549"}
{"level":"log","message":"Forged new block id: 9987265633722234070 height: 1525491 round: 15104 slot: 1954653 reward: 350000000","timestamp":"2017-02-09 01:35:30 551"}
{"level":"info","message":"receive propose height 1525492 bid 16186484046096121858","timestamp":"2017-02-09 01:35:40 090"}
{"level":"info","message":"Received new block id: 16186484046096121858 height: 1525492 round: 15104 slot: 1954654 reward: 350000000","timestamp":"2017-02-09 01:35:40 573"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:35:40 604"}
...
{"level":"info","message":"Ban 10 min POST http://108.61.180.235:8192/peer/propose","timestamp":"2017-02-09 01:41:10 199"}
{"level":"info","message":"Received new block id: 11810378320108355737 height: 1525524 round: 15105 slot: 1954687 reward: 350000000","timestamp":"2017-02-09 01:41:10 619"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:41:10 651"}
{"level":"info","message":"receive propose height 1525525 bid 1422231077241471783","timestamp":"2017-02-09 01:41:20 082"}
{"level":"info","message":"Received new block id: 1422231077241471783 height: 1525525 round: 15105 slot: 1954688 reward: 350000000","timestamp":"2017-02-09 01:41:20 502"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:41:20 539"}
{"level":"info","message":"receive propose height 1525526 bid 6433447915577461684","timestamp":"2017-02-09 01:41:30 142"}
{"level":"info","message":"Received new block id: 6433447915577461684 height: 1525526 round: 15105 slot: 1954689 reward: 350000000","timestamp":"2017-02-09 01:41:30 559"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:41:30 579"}
{"level":"info","message":"Removing peer POST http://36.4.172.6:8192/peer/blocks","timestamp":"2017-02-09 01:41:34 836"}
{"level":"info","message":"receive propose height 1525527 bid 12347846580357711600","timestamp":"2017-02-09 01:41:40 130"}
{"level":"info","message":"Ban 10 min POST http://139.224.225.220:8192/peer/propose","timestamp":"2017-02-09 01:41:40 197"}
...
{"level":"info","message":"Received new block id: 10049830975072097853 height: 1525542 round: 15105 slot: 1954705 reward: 350000000","timestamp":"2017-02-09 01:44:10 703"}
{"level":"info","message":"Block applied correctly with 0 transactions","timestamp":"2017-02-09 01:44:10 724"}
{"level":"info","message":"receive propose height 1525543 bid 18159480594734712859","timestamp":"2017-02-09 01:44:20 116"}
{"level":"info","message":"Received new block id: 18159480594734712859 height: 1525543 round: 15105 slot: 1954706 reward: 350000000","timestamp":"2017-02-09 01:44:20 614"}
{"level":"fatal","message":"uncaughtException","timestamp":"2017-02-09 01:44:20 631","data":{"message":"Cannot read property 'map' of undefined","stack":"TypeError: Cannot read property 'map' of undefined\n    at /root/asch-linux-1.1.5-mainnet/app.js:11248:19\n    at Account.<anonymous> (/root/asch-linux-1.1.5-mainnet/app.js:5252:15)\n    at Socket.onerror (/root/asch-linux-1.1.5-mainnet/app.js:2581:14)\n    at emitOne (events.js:96:13)\n    at Socket.emit (events.js:188:7)\n    at readableAddChunk (_stream_readable.js:177:18)\n    at Socket.Readable.push (_stream_readable.js:135:10)\n    at Pipe.onread (net.js:542:20)"}}
{"level":"info","message":"Cleaning up...","timestamp":"2017-02-09 01:44:20 655"}
{"level":"info","message":"all dapps stopped successfully","timestamp":"2017-02-09 01:44:20 664"}
{"level":"info","message":"Cleaned up successfully","timestamp":"2017-02-09 01:44:20 664"}

Asch客户端升级

  1. asch-js不再依赖具体ip,应该动态维护一个ip列表,所有的asch核心服务只与资源标识符有关
    比如,/asch/core/transfer, /asch/uia/issue, /asch/core/storage等
  2. 客户端应该与多个后端服务保持长连接,当签署一个交易时,至少广播给5个节点以上
  3. 事件通知前端实时更新

log信息,换行符‘\n’并没有正确解释

log信息,换行符‘\n’并没有正确解释,打印信息如下所示:
fatal 2017-08-31 06:27:32 978 init.js:410 Domain uia { message: 'Cannot find module 'complex.js'',
stack: 'Error: Cannot find module 'complex.js'\n at Function.Module._resolveFilename (module.js:489:15)\n at Function.Module._load (module.js:439:25)\n at Module.require (module.js:517:17)\n at require (internal/module.js:11:18)\n at Object. (/home/ouxb/asch/node_modules/mathjs/lib/type/complex/Complex.js:1:77)\n at Module._compile (module.js:573:30)\n at Object.Module._extensions..js (module.js:584:10)\n at Module.load (module.js:507:32)\n at tryModuleLoad (module.js:470:12)\n at Function.Module._load (module.js:462:3)' }

启动hang住

config.json中的loglevel如果写错(比如写成debg)会导致启动app.js后hang住,并且没有任何文件日志、console日志或者其他报错信息。

Problem caused by static_eval

Can you tell to the devs to check this repository please

https://github.com/AschPlatform/asch/blob/ff97f3c1cf2bdfd95cbb337dad694cd3b7c69a34/src/utils/protobuf.js

Problem: Arbitrary Code Execution

They are using protocol-Buffers 3.1.6
This version have a issue becuse it use some outdated of static-eval
The Vulnerability is introduced through this way:
Protocol-buffers> [email protected][email protected][email protected]

Here is the commit to fix part of the problem in the github of static-eval
browserify/static-eval@c06f1b8

Further information of the problem:
https://maustin.net/articles/2017-10/static_eval
https://nodesecurity.io/advisories/548

dapp充值xas,超过一千万报错

dapp充值xas最大值是9999999

{"level":"debug","message":"verify block slot ok","timestamp":"2017-11-30 05:48:10 129"}
{"level":"debug","message":"setAccountAndGet data is:","timestamp":"2017-11-30 05:48:10 129","data":{"publicKey":"28566206743a02f9744cd7d5dcf226d8c4155f45475bb260ef4f13dfb347827d"}}
{"level":"debug","message":"verify block transactions ok","timestamp":"2017-11-30 05:48:10 131"}
{"level":"debug","message":"setAccountAndGet data is:","timestamp":"2017-11-30 05:48:10 136","data":{"publicKey":"28566206743a02f9744cd7d5dcf226d8c4155f45475bb260ef4f13dfb347827d","isGenesis":false}}
{"level":"fatal","message":"uncaughtException","timestamp":"2017-11-30 05:48:10 142","data":{"message":"plus() number type has more than 15 significant digits: 1000000000000000","stack":"BigNumber Error: plus() number type has more than 15 significant digits: 1000000000000000\n    at ifExceptionsThrow (/root/asch/node_modules/bignumber/bignumber.js:477:17)\n    at new BigNumber (/root/asch/node_modules/bignumber/bignumber.js:248:9)\n    at BigNumber.P.plus.P.add (/root/asch/node_modules/bignumber/bignumber.js:1327:24)\n    at EventEmitter.dbLite.query (/root/asch/src/utils/model.js:204:40)\n    at Socket.<anonymous> (/root/asch/src/dblite/index.js:382:16)\n    at emitOne (events.js:116:13)\n    at Socket.emit (events.js:211:7)\n    at addChunk (_stream_readable.js:263:12)\n    at readableAddChunk (_stream_readable.js:250:11)\n    at Socket.Readable.push (_stream_readable.js:208:10)"}}
{"level":"info","message":"Cleaning up...","timestamp":"2017-11-30 05:48:10 159"}
{"level":"info","message":"all dapps stopped successfully","timestamp":"2017-11-30 05:48:10 165"}
{"level":"info","message":"Cleaned up successfully","timestamp":"2017-11-30 05:48:10 166"}

ejs版本低于2.5.5有重大漏洞--来自github提示

We found a potential security vulnerability in one of your dependencies.
The ejs dependency defined in package.json has a known moderate severity security vulnerability in version range < 2.5.5 and should be updated.

Review vulnerable dependency

区块同步在2865350就无法在增加了

error 2017-10-29 06:41:48 078 app.js:9104 Failed to process block: Failed to verify transaction: Amount should be integer { id: '5df16ed548d8b7450ac0f31ffe5345ba930f29c4d7e6942f7856890c7f32f44f',
version: 0,
timestamp: 33051030,
height: 2865351,
previousBlock: '62820a89b6235cbad8fc325bfca179db0bec5d6fc1aac254fb970fbbedbf57a2',
numberOfTransactions: 1,
totalAmount: 0,
totalFee: 50000000000,
reward: 350000000,
payloadLength: 263,
payloadHash: '09319d25b0e219105500880a261710ace98188dbac9e9cbdbe13b8f02720da30',
generatorPublicKey: 'd0ebf16dbf8701290d30ecd8527263f471cea8f98ee5657a22df4b5abce61da0',
generatorId: '277484741189613089',
blockSignature: 'fefb333fd75d00942d4d343034862a8934df862cdb4ad827e9fd028fddfc523fdbb2386e78f273bd223343e87b92a6506fac3ec2cbe5aaceaa1e320bed619305',
totalForged: 50350000000,
transactions:
[ { id: '09319d25b0e219105500880a261710ace98188dbac9e9cbdbe13b8f02720da30',
height: 2865351,
blockId: '5df16ed548d8b7450ac0f31ffe5345ba930f29c4d7e6942f7856890c7f32f44f',
type: 10,
timestamp: 33051013,
senderPublicKey: '7eaf284de9fd5d1d3505890c0f7361fe255c84acb8b6328704ecab1aebb54d25',
requesterPublicKey: '',
senderId: '9015597308060636230',
recipientId: '',
amount: 0,
fee: 50000000000,
signature: '3cd962577d601999e97213e66ed1c8d92a82b12ccef3c3d3f9a787454e79a4bcee3eac63ed74e4a6f9b56e8ab5665482a3f081180c072c467c4b0e3b8d1c8f0d',
signSignature: 'ef346da41ad7f05baf283ad3307cd9b427193817f61c6c78d9d7a18f8996c689f20fd083f9d757ef73f1eaa5388cfe130dd353ab002a22355973ad06ae0cf706',
message: '',
asset: [Object] } ] }
error 2017-10-29 06:41:48 080 app.js:9105 Block 5df16ed548d8b7450ac0f31ffe5345ba930f29c4d7e6942f7856890c7f32f44f is not valid, ban 60 min 45.63.27.97:80

Asch抽象事务层代码重构

需求描述

参考dapp sdk中smartdb和orm的实现,可大幅降低冗余代码并提高数据库写入性能

子任务

travis-ci account

麻烦 aschplatform 的管理员开个 travis-ci的账号,帮忙 aschplatform的github账号,然后仓库会自动同步过去。
目前travis 在 asch-cli和 asch-js已经加上,参考 https://github.com/AschPlatform/asch-js README 最上方的一些图标。
有账号了以后才能把build跑通。

过滤交易类型的type取值范围不对

curl -k -X GET 'http://127.0.0.1:8192/api/transactions?blockId=d6507819d28149dc7cb5747755884841f4145ac7667de32dfb537e7e78df3d21&type=14&and=1'
// 返回结果
{"success":false,"error":"Value 14 is greater than maximum 10"}

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.