Add auto reward reduction to comments contract
|15 hours ago|
|.github/workflows||3 months ago|
|benchmarks||2 years ago|
|contracts||2 days ago|
|libs||5 months ago|
|plugins||2 months ago|
|scripts||4 years ago|
|snapshot||1 year ago|
|test||4 days ago|
|.env.example||9 months ago|
|.eslintignore||3 years ago|
|.eslintrc||5 years ago|
|.gitignore||4 years ago|
|.npmrc||3 years ago|
|.travis.yml||1 year ago|
|LICENSE||5 years ago|
|README.md||1 year ago|
|app.js||8 months ago|
|app.pm2.json||3 years ago|
|compare_data.js||2 years ago|
|config.json||4 months ago|
|find_divergent_block.js||6 months ago|
|package-lock.json||2 months ago|
|package.json||2 months ago|
|restore_partial.js||6 months ago|
|sync_hashes.js||2 years ago|
|update_node.sh||4 years ago|
|witness_action.js||4 months ago|
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
- a block on the sidechain is produced only if transactions are being parsed in a Hive block
4. Setup a Hive Smart Contracts node
In addition, the following is needed to use transaction framework for MongoDB:
- Run MongoDB in replicated mode. This is as simple as changing the mongo config to add replication config:
and then enabling replication by using the mongo shell:
replication: replSetName: "rs0"
See https://docs.mongodb.com/manual/tutorial/convert-standalone-to-replica-set/ for details. Also, if you are /upgrading/ from a previous MongoDB, you need to take careful extra steps and follow https://docs.mongodb.com/manual/release-notes/4.4-upgrade-standalone/ carefully.
mongo > rs.initiate()
- Need version 3.6.3 mongo node library.
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.
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
mongorestore --gzip --archive=hsc_50287280.archive
Edit config.json to match block number of backup.
- npm run test