0xs34n / blockchain-cli Goto Github PK
View Code? Open in Web Editor NEW⛓️ A minimal blockchain command-line interface.
License: Apache License 2.0
⛓️ A minimal blockchain command-line interface.
License: Apache License 2.0
Hi guys,
After running sudo npm install
, i was received some errors:
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ndc07/.npm/_logs/2018-12-12T17_33_36_212Z-debug.log
My configuration: Ubuntu 18.04
, Node v10.14.2
, npm v6.4.1
Thanks for helping me 🙏
What's the best way to do this? Look for example READMEs
When I run npm start
, it gives me this error:
'.' is not recognized as an internal or external command, operable program or batch file.
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `./main.js`
npm ERR! Exit status 1
In order to fix the error, I changed the start script to node ./main.js
.
Failed when trying to npm install blockchain-cli -g
Then I tried git clone w/a local install
Mac / [email protected] / node v8.4.0
npm install
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ== integrity checksum failed when using sha512: wanted sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ== but got sha1-No8lEtefnUb9/HE0mueHi7weuVw=. (25587 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== integrity checksum failed when using sha512: wanted sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== but got sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=. (8851 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ== integrity checksum failed when using sha512: wanted sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ== but got sha1-D8Z9fBQYJd6UKC3VNr7GubzoYKs=. (4142 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== integrity checksum failed when using sha512: wanted sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== but got sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=. (8851 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== integrity checksum failed when using sha512: wanted sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg== but got sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=. (8851 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EINTEGRITY: sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg== integrity checksum failed when using sha512: wanted sha512-8T7Zn1AhMsQ/HI1SjcCfT/t4ii3eAqco3yOcSzS4mozsOz69lHLsoMXmF9nZgnFanYscnSlUSgs8uZyKzpE6kg== but got sha1-3ACaJGuNCaF3tLegrne8Vw9LG3k=. (2516 bytes)
WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
> [email protected] install /usr/local/projects/blockcahin/blockchain-cli/node_modules/fsevents
> node install
[fsevents] Success: "/usr/local/projects/blockcahin/blockchain-cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
> [email protected] install /usr/local/projects/blockcahin/blockchain-cli/node_modules/wrtc
> node-pre-gyp install --fallback-to-build
[wrtc] Success: "/usr/local/projects/blockcahin/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-darwin-x64/wrtc.node" is installed via remote
added 684 packages in 13.969s
The --harmony
flag in the shebang line in this file is confusing my linux system, as it is treating node --harmony
as a single executable file name:
~ $ npm i -g blockchain.js
~ $ blockchain
/usr/bin/env: ‘node --harmony’: No such file or directory
Considering anyone with a reasonably up-to-date Node installation won't need the harmony
flag, it's probably safe to remove it and prevent this from being a problem for anyone - and, perhaps, encourage people to update their Node installations in the process.
Planning on launching Blockchain.js on Product Hunt on Thursday!
@nblackburn thoughts? advice? tips?
Error message is:
module.js:529
throw err;
^Error: Cannot find module '/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-darwin-x64/wrtc.node'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at Object. (/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/lib/peerconnection.js:6:15)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
Any idea?
sudo npm install blockchain-cli -g
/usr/local/bin/blockchain -> /usr/local/lib/node_modules/blockchain-cli/main.js
[email protected] install /usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc
node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(undefined): https://node-webrtc.s3.amazonaws.com/wrtc/v0.0.62/Release/node-v57-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build'
gyp ERR! System Linux 3.13.0-129-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--module=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64/wrtc.node" "--module_name=wrtc" "--module_path=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64"
gyp ERR! cwd /usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64/wrtc.node --module_name=wrtc --module_path=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/blockchain-cli/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:125:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:213:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:927:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
node-pre-gyp ERR! System Linux 3.13.0-129-generic
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/blockchain-cli/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc
node-pre-gyp ERR! node -v v8.4.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64/wrtc.node --module_name=wrtc --module_path=/usr/local/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
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/speed/.npm/_logs/2017-09-06T13_24_14_797Z-debug.log
OS: ubuntu Ubuntu 14.04 trusty
Kernel: x86_64 Linux 3.13.0-129-generic
Uptime: 3h 1m
Packages: 4247
Shell: bash 4.3.11
Resolution: 1920x1080
DE: Gnome 3.9.90
WM: GNOME Shell
WM Theme: Adwaita
Radiance [GTK2]
, Radiance [GTK3]
Icon Theme: elementary-xfce-darker
Font: Cantarell 11
CPU: AMD FX-8350 Eight-Core @ 4GHz
GPU: GeForce GTX 750 Ti
RAM: 5535MiB / 24011MiB
Hi there,
Thanks for building this CLI. It's a really cool way to play around with a blockchain in a really interactive way.
Is there a way to display the full hash and previous hash values? I think it would be helpful if one could take the previous block and manually calculate the next hash to get a deeper understanding of how the blocks are generated, unfortunately the hash is clipped in the table display like so:
┌─────────────────────────────────────────┐
│ ⛓ Block #1 │
├────────────────────┬────────────────────┤
│ ⏮ Previous Hash │ 0000018035a828da0… │
├────────────────────┼────────────────────┤
│ 📅 Timestamp │ Fri, 15 Sep 2017 │
│ │ 16:04:40 GMT │
├────────────────────┼────────────────────┤
│ 📄 Data │ hello │
├────────────────────┼────────────────────┤
│ 📛 Hash │ 00002ddfc3a099f0b… │
├────────────────────┼────────────────────┤
│ 🔨 Nonce │ 86328 │
└────────────────────┴────────────────────┘
Hi
$ npm install blockchain-cli -g
/Users/jorge/.nvm/versions/node/v4.8.0/bin/blockchain -> /Users/jorge/.nvm/versions/node/v4.8.0/lib/node_modules/blockchain-cli/main.js
> [email protected] install /Users/jorge/.nvm/versions/node/v4.8.0/lib/node_modules/blockchain-cli/node_modules/wrtc
> node-pre-gyp install --fallback-to-build
[wrtc] Success: "/Users/jorge/.nvm/versions/node/v4.8.0/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v46-darwin-x64/wrtc.node" is installed via remote
+ [email protected]
added 244 packages in 24.765s
Jorges-MBP:website jorge$ blockchain
/Users/jorge/.nvm/versions/node/v4.8.0/lib/node_modules/blockchain-cli/lib/blockchain/index.js:7
class Blockchain {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/jorge/.nvm/versions/node/v4.8.0/lib/node_modules/blockchain-cli/lib/cli/command/list-blockchain.js:1:82)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
https://github.com/0xs34n/blockchain-cli not working
App shouldn't crash when wrong command gets entered
I got this error on the peer I send the discover
command. (Only him is affected)
I'm also doing this test only on localhost. All nodes are in the same computer, but in different ports.
node: symbol lookup error: /home/victor/.nvm/versions/node/v8.2.1/lib/node_modules/blockchain-cli/node_modules/wrtc/build/wrtc/v0.0.62/Release/node-v57-linux-x64/wrtc.node: undefined symbol: XOpenDisplay
I'll investigate it further, but any light is welcome. :)
PS: this bug was found on Linux.
I uninstalled NPM, reinstalled it, and I still keep getting this error:
network request to https://npm-registry.whitewater.ibm.com/e/end-of-stream/_attachments/end-of-stream-1.4.0.tgz failed, reason: getaddrinfo ENOTFOUND npm-registry.whitewater.ibm.com npm-registry.whitewater.ibm.com:443
https://github.com/seanjameshan/blockchain-cli/blob/master/lib/cli/util/table.js#L26
the function 'toUTCString' should be changed to 'toISOString' (the toUTCString function will lose milliseconds that lead to sha256(block) different)
It's best to get rid of 'timeStamp/1000' but use timeStamp directly
https://github.com/seanjameshan/blockchain-cli/blob/master/lib/cli/util/table.js#L10
this line should be changed to 'colWidths:[20,66]' to show hash fully :
#13
https://github.com/seanjameshan/blockchain-cli/blob/master/lib/blockchain/index.js#L128
this line should be changed to 'return i >= this.difficulty;' ; the hash should contains at least difficulty zero
https://github.com/seanjameshan/blockchain-cli/blob/master/lib/blockchain/index.js#L111
before L111 while
there should have a time:
var _beginTime = new Date();
after L116 spinner.clear();
there show have a tips:
console.log("Mining new block use time: ", new Date() - _beginTime, "ms")
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.