HiveSmartContracts Mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
cryptomancer 0156bb12dc
Merge pull request #15 from hive-engine/commentsAddAutoReduce
15 hours ago
.github/workflows Add dev branch 3 months ago
benchmarks upgraded from dsteem to dhive library to prepare for HF24 2 years ago
contracts Minor equality check change 2 days ago
libs change testing fixture stream node to be for hive 5 months ago
plugins Check for args and args.round 2 months ago
scripts moving to mongodb storage 4 years ago
snapshot remove steem references 1 year ago
test Add auto reward reduction to comments contract 4 days ago
.env.example Adapt .env.example to the NATed-ports customization feature 9 months ago
.eslintignore hive engine prep 3 years ago
.eslintrc initial commit 5 years ago
.gitignore improving p2p security 4 years ago
.npmrc fix tests, enforce node/npm version 3 years ago
.travis.yml Use LTS nodejs on travis test 1 year ago
LICENSE initial commit 5 years ago
README.md update build status 1 year ago
app.js keep transactions <= lastVerifiedBlockNumber - blocksTokeep and allow getBlockInfo and getTransactionInfo for light nodes again 8 months ago
app.pm2.json hive engine prep 3 years ago
compare_data.js fix lint 2 years ago
config.json add websocket support and dual rpc 4 months ago
find_divergent_block.js Merge branch 'hive-engine' of https://github.com/Rishi556/steemsmartcontracts-primersion into hive-engine 6 months ago
package-lock.json bump version number up to 1.8.3 2 months ago
package.json bump version number up to 1.8.3 2 months ago
restore_partial.js add comments 6 months ago
sync_hashes.js fix linter 2 years ago
update_node.sh adding steempegged contract, fixing some bugs, reinforcing tokens' security 4 years ago
witness_action.js Change Default Node in divergence check for registering 4 months ago

README.md

Hive Smart Contracts Build Status

1. What is it?

Hive Smart Contracts is a sidechain powered by Hive, it allows you to perform actions on a decentralized database via the power of Smart Contracts.

2. How does it work?

This is actually pretty easy, you basically need a Hive account and that's it. To interact with the Smart Contracts you simply post a message on the Hive blockchain (formatted in a specific way), the message will then be catched by the sidechain and processed.

3. Sidechain specifications

  • run on node.js
  • database layer powered by MongoDB
  • Smart Contracts developed in Javascript
  • Smart Contracts run in a sandboxed Javascript Virtual Machine called VM2
  • a block on the sidechain is produced only if transactions are being parsed in a Hive block

4. Setup a Hive Smart Contracts node

see wiki: https://github.com/hive-engine/hivesmartcontracts-wiki

In addition, the following is needed to use transaction framework for MongoDB:

Also, if using PM2, you will need to start the process with --no-treekill for proper shutdown. Also consider using --no-autorestart with proper monitoring to minimize noise and potential for problematic looping (though with transactions there is less risk of data corruption). Another oddity with PM2 is that you may need to clear node processes after a stop if the process does not terminate on its own. Otherwise it will interfere with logging.

E.g.

pm2 start app.js --no-treekill --kill-timeout 10000 --no-autorestart

DB Backup and Restore

Backup current state (track current hive blpck in config)

mongodump -d=hsc --gzip --archive=hsc_50287280.archive

Restore state

mongorestore --gzip --archive=hsc_50287280.archive

Edit config.json to match block number of backup.

5. Tests

  • npm run test

6. Usage/docs