Code Monkey home page Code Monkey logo

blocksense's Introduction

BlockSense: Blockchain Based Trustworthy Crowd-sensing Platform

Environment

Installation

$ npm install

=> Note that you need to rebuild modules for electron after pre-step

# for windows
$ .\node_modules\.bin\electron-rebuild.cmd
# for linux
$ ./node_modules/.bin/electron-rebuild

Run it

$ npm start

Possible errors

  • Error: A dynamic link library (DLL) initialization routine failed

两个可能有用的链接:issues#10193, using-native-node-modules, 注意只有在dependencies中的modules才会被rebuild,还是失败的话检查一下package.json文件有没有写对

  • How to use sloc and js-ipfs modules with Electron

两个可能有用的链接:solc#using-with-electron, electronjs.org/docs/faq

  • npm install build ERROR MSB4019

可以参考这个链接:npm-install-g-karma-error-msb4019-the-imported-project-c-microsoft-cpp-defau

  • An unhandled error occurred inside electron-rebuild

两个可能有用的链接:compiling-native-addon-modules,node-gyp#installation, 另外检查路径中不要有中文。

Sometimes electron-rebuild results in an error like openssl/rsa.h: No such file. For Ubuntu and other Debian based systems run the following command to fix the problem sudo apt-get install libssl-dev

For Windows systems, first download and install openSSL libraries from here. Then edit the following file .\node_modules\ursa-optional\binding.gyp Change the contents of the file to:

{
  "targets": [
    {
      'target_name': 'ursaNative',
      'sources': [ 'src/ursaNative.cc' ],
      'conditions': [
        [ 'OS=="win"', {
          'defines': [
            'uint=unsigned int',
          ],
          'include_dirs': [
            # use node's bundled openssl headers platforms
            'C:\Program Files\OpenSSL-Win64\include',
                        "<!(node -e \"require('nan')\")"
          ],
          'libraries': [
            '-lC:/Program Files/OpenSSL-Win64/lib/capi.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/dasync.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/libapps.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/libcrypto.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/libssl.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/libtestutil.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/openssl.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/ossltest.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/padlock.lib',
            '-lC:/Program Files/OpenSSL-Win64/lib/uitest.lib'
          ]
        }, { # OS!="win"
          'include_dirs': [
            # use node's bundled openssl headers on Unix platforms
            '<(node_root_dir)/deps/openssl/openssl/include',
                        "<!(node -e \"require('nan')\")"
          ],
        }],
      ],
    }
  ]
}

Please note: The installation directory of OpenSSL should match with the path given in the above file.

  • Sweetalert2 text input not clickable/focus when bootstrap modal is open

This link is helpful to solve it: issues#374

  • Raise the exceed gas limit error

Just increase the upper bound of gas limit for testrpc or geth client, here I set limit gas to 100000000.

Cite

@article{HuangTMC2022BlockSense,
  author={Huang, Junqin and Kong, Linghe and Cheng, Long and Dai, Hong-Ning and Qiu, Meikang and Chen, Guihai and Liu, Xue and Huang, Gang},
  journal={IEEE Transactions on Mobile Computing}, 
  title={BlockSense: Towards Trustworthy Mobile Crowdsensing via Proof-of-Data Blockchain}, 
  year={2022},
  volume={},
  number={},
  pages={1-17},
  doi={10.1109/TMC.2022.3230758}
}

blocksense's People

Contributors

dependabot[bot] avatar imtypist avatar

Stargazers

 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

blocksense's Issues

Error: openssl/rsa.h: No such file found

Error while looking for OpenSSL libraries.
The issue can be reproduced in Windows by running

.\node_modules\.bin\electron-rebuild.cmd

The following error is obtained

C:\Users\username\Documents\Work\DC\BlockSense [master ≡ +1 ~0 -0 !]
λ  .\node_modules\.bin\electron-rebuild.cmd
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Program Files\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\.electron-gyp\\iojs-3.1.4\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\username\\.electron-gyp\\iojs-3.1.4',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\username\\.electron-gyp\\iojs-3.1.4\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  ursaNative.cc
  win_delay_load_hook.cc
c:\users\username\documents\work\dc\blocksense\node_modules\ursa-optional\src\ursanative.h(13): fatal error C1083: Cannot open include file: 'openssl/rsa.h': No such file or directory (compiling source file ..\src\ursaNative.cc) [C:\Users\username\Documents\Work\DC\BlockSense\node_modules\ursa-optional\build\ursaNative.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=3.1.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd C:\Users\username\Documents\Work\DC\BlockSense\node_modules\ursa-optional
gyp ERR! node -v v11.10.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Failed with exit code: 1

Error: gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info spawn C:\Program Files\Python27\python.EXE
gyp info spawn args [ 'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=2015',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\username\\.electron-gyp\\iojs-3.1.4\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\username\\.electron-gyp\\iojs-3.1.4',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\username\\.electron-gyp\\iojs-3.1.4\\<(target_arch)\\iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\ursa-optional\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  ursaNative.cc
  win_delay_load_hook.cc
c:\users\username\documents\work\dc\blocksense\node_modules\ursa-optional\src\ursanative.h(13): fatal error C1083: Cannot open include file: 'openssl/rsa.h': No such file or directory (compiling source file ..\src\ursaNative.cc) [C:\Users\username\Documents\Work\DC\BlockSense\node_modules\ursa-optional\build\ursaNative.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:197:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\username\\Documents\\Work\\DC\\BlockSense\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--target=3.1.4" "--arch=x64" "--dist-url=https://atom.io/download/electron" "--build-from-source"
gyp ERR! cwd C:\Users\username\Documents\Work\DC\BlockSense\node_modules\ursa-optional
gyp ERR! node -v v11.10.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Failed with exit code: 1
    at SafeSubscriber._error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\spawn-rx\lib\src\index.js:267:84)
    at SafeSubscriber.__tryOrUnsub (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:207:16)
    at SafeSubscriber.error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:158:26)
    at Subscriber._error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:92:26)
    at Subscriber.error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:72:18)
    at MapSubscriber.Subscriber._error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:92:26)
    at MapSubscriber.Subscriber.error (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:72:18)
    at SafeSubscriber._next (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\spawn-rx\lib\src\index.js:242:65)
    at SafeSubscriber.__tryOrUnsub (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:207:16)
    at SafeSubscriber.next (C:\Users\username\Documents\Work\DC\BlockSense\node_modules\rxjs\internal\Subscriber.js:145:22)

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.