y12studio / bkbc-tools

bkbc-tools java application
http://BlacKBananaCoin.org
Apache License 2.0
1 stars 1 forks source link

websocket inv wrapper #10

Closed y12studio closed 10 years ago

y12studio commented 10 years ago

wrap bitcoin/inv with ws://ip/inv

ref

y12studio commented 10 years ago

TEST bitpay/insight

Temporary Only Site : Insight with bitcoind 0.9.0

insight 是一個提供 http 瀏覽 blockchain 的軟體,同時提供 REST/websocket APIs 以利開發轉接查詢。下為 ubuntu 12.04 的測試過程,bitcoin 0.9.0 node build test · Issue #8 · y12studio/bkbc-tools 安裝過程。

$ cd ~/src
$ git clone https://github.com/bitpay/insight && cd insight
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs
$ npm --version
1.4.3
$ nodejs --version
v0.10.26
$ npm install
$ bitcoin-cli getinfo
{
    "version" : 90000,
    "protocolversion" : 70002,
    "blocks" : 292878,
    "timeoffset" : 0,
    "connections" : 7,
    "proxy" : "",
    "difficulty" : 5006860589.20540047,
    "testnet" : false,
    "errors" : ""
}
$ du -h ~/.bitcoin
439M    /home/bkbc/.bitcoin/chainstate
1.8G    /home/bkbc/.bitcoin/blocks/index
20G     /home/bkbc/.bitcoin/blocks
21G     /home/bkbc/.bitcoin
$ cat ~/.bitcoin/bitcoin.conf
server=1
testnet=0
rpcuser=xx
rpcpassword=xx
gen=0
maxconnections=30
txindex=1
$ INSIGHT_NETWORK=livenet BITCOIND_USER=xx BITCOIND_PASS=xx INSIGHT_PUBLIC_PATH=public npm start
$ curl http://localhost:3000/api/sync
{"status":"syncing","blockChainHeight":292871,
"syncPercentage":"40.976","syncedBlocks":120006,"error":null,
"type":"from .dat Files","startTs":1395994408353,"endTs":null}
$ sudo ufw status
Status: active
To                         Action      From
--                         ------      ----
8333/tcp                   ALLOW       Anywhere
3000                       ALLOW       Anywhere

bitcoin-cli getpeerinfo insight info

  {
        "addr" : "127.0.0.1:33443",
        "addrlocal" : "107.170.251.205:8333",
        "services" : "00000001",
        "lastsend" : 1395997907,
        "lastrecv" : 1395997906,
        "bytessent" : 278590,
        "bytesrecv" : 22381,
        "conntime" : 1395997329,
        "pingtime" : 0.00000000,
        "version" : 70000,
        "subver" : "/BitcoinX:0.1/",
        "inbound" : true,
        "startingheight" : 0,
        "banscore" : 0
    },

Need more storage ? Move to 40GB SSD VPS plan.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda         30G   27G  1.1G  97% /
udev            489M   12K  489M   1% /dev
tmpfs           199M  208K  199M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            498M     0  498M   0% /run/shm

insight sync 75% space issue

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/vda         40G   34G  3.7G  91% /
$ du -h .bitcoin
1.8G    .bitcoin/blocks/index
20G     .bitcoin/blocks
375M    .bitcoin/chainstate
21G     .bitcoin
$ du -h src/insight/node_modules/insight-bitcore-api/db
9.6G    src/insight/node_modules/insight-bitcore-api/db/txs
82M     src/insight/node_modules/insight-bitcore-api/db/blocks
20K     src/insight/node_modules/insight-bitcore-api/db/testnet/txs
20K     src/insight/node_modules/insight-bitcore-api/db/testnet/blocks
44K     src/insight/node_modules/insight-bitcore-api/db/testnet
9.7G    src/insight/node_modules/insight-bitcore-api/db

insight modify 0.9.0 ? bitcore/Connection.js at master · bitpay/bitcore