Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/bs 171 #326

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Common
.DS_Store
.idea

# Logs
logs
*.log
Expand Down Expand Up @@ -36,6 +40,7 @@ jspm_packages
# Optional REPL history
.node_repl_history


# local data
data/
config.json
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
# ETC Explorer

<img src="public/img/explorer-logo.png" alt="ETC Explorer logo" height="200" />

<b>Live Version: [etherhub.io](http://etherhub.io)</b>

Follow the project progress at: [ETC Block Explorer Development](https://github.com/ethereumclassic/explorer)
# Papyrus Explorer

## Local installation

Clone the repo

`git clone https://github.com/ethereumclassic/explorer`
`git clone https://github.com/papyrusglobal/explorer`

Download [Nodejs and npm](https://docs.npmjs.com/getting-started/installing-node "Nodejs install") if you don't have them

Expand Down
1 change: 1 addition & 0 deletions abi/bios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[{"internalType":"address[]","name":"_sealers","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"addNewPoll","outputs":[{"internalType":"uint256","name":"closeTime","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorityBlackList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorityBlacklistPoll","outputs":[{"internalType":"uint256","name":"closeTime","type":"uint256"},{"internalType":"uint256","name":"votes","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"authorityStates","outputs":[{"internalType":"uint256","name":"votes","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"contractStakeOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"freeze","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"contract_","type":"address"}],"name":"freezeForContract","outputs":[],"payable":true,"stateMutability":"payable","type":"function"},{"constant":true,"inputs":[],"name":"getAddNewPollAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAuthorities","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getAuthorityBlacklistPollAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"authority","type":"address"}],"name":"getAuthorityState","outputs":[{"internalType":"uint256","name":"votes","type":"uint256"},{"internalType":"address[7]","name":"","type":"address[7]"},{"internalType":"uint256[7]","name":"","type":"uint256[7]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getFreeMeltingSlots","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMeltingHead","outputs":[{"internalType":"uint224","name":"stake","type":"uint224"},{"internalType":"uint32","name":"timestamp","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getMeltingSlots","outputs":[{"internalType":"uint224[]","name":"","type":"uint224[]"},{"internalType":"uint32[]","name":"","type":"uint32[]"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"handleClosedPolls","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"isOwner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"uint224","name":"val","type":"uint224"}],"name":"melt","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"contract_","type":"address"},{"internalType":"uint224","name":"val","type":"uint224"}],"name":"meltFromContract","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"melting","outputs":[{"internalType":"uint8","name":"top","type":"uint8"},{"internalType":"uint8","name":"bottom","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"ownerAddNewAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"ownerBlacklistAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"candidate","type":"address"}],"name":"ownerRemoveFromBlacklist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"participant","type":"address"}],"name":"proposeBlacklistAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"participant","type":"address"}],"name":"proposeNewAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"renounceOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address payable","name":"neo","type":"address"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"participant","type":"address"}],"name":"voteForBlackListAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"slot","type":"uint256"},{"internalType":"address","name":"participant","type":"address"}],"name":"voteForNewAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"withdraw","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]
15 changes: 3 additions & 12 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,10 @@ const path = require('path');
const favicon = require('serve-favicon');
const logger = require('morgan');
const bodyParser = require('body-parser');
const { getConfig } = require('./utils');

let config = {};
try {
config = require('./config.json');
} catch (e) {
if (e.code == 'MODULE_NOT_FOUND') {
console.log('No config file found. Using default configuration... (config.example.json)');
config = require('./config.example.json');
} else {
throw e;
process.exit(1);
}
}

const config = getConfig();

const app = express();
app.set('port', process.env.PORT || 3000);
Expand Down
47 changes: 12 additions & 35 deletions config.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,27 @@
"patch": true,
"patchBlocks": 100,
"bulkSize": 100,
"biosAddress": "0x82e3FB6449b7cb18bD9095B963e3E5863d21F8B4",
"settings": {
"symbol": "ETC",
"name": "Ethereum Classic",
"title": "Ethereum Classic Block Explorer",
"symbol": "PPR",
"name": "Papyrus",
"title": "Papyrus Explorer",
"author": "Elaine, Cody, Hackmod, Bakon",
"contact": "mailto:[email protected]",
"about": "This is an open source Blockchain Explorer.",
"rss": "https://ethereumclassic.org",
"reddit": "https://www.reddit.com/r/EthereumClassic",
"twitter": "https://twitter.com/eth_classic",
"linkedin": "https://www.linkedin.com/company/ethereum-classic",
"github": "https://github.com/ethereumclassic",
"about": "This is an open source Blockchain Explorer based on Ethereum Classic Explorer.",
"logo": "/img/explorer-logo.png",
"copyright": "2019 &copy; Ethereum Classic.",
"copyright": "Papyrus Explorer",
"poweredbyCustom": false,
"poweredbyEtcImage": "/img/powered-by-etcexplorer-w.png",
"poweredbyEtc": true,
"tokenList": "tokens.json",
"useRichList": true,
"useFiat": true,
"miners": {
"0xdf7d7e053933b5cc24372f878c90e62dadad5d42": "EtherMine",
"0xc91716199ccde49dc4fafaeb68925127ac80443f": "F2Pool",
"0x9eab4b0fc468a7f5d46228bf5a76cb52370d068d": "NanoPool",
"0x1C0FA194a9d3B44313DCD849F3C6be6Ad270a0A4": "MiningPoolHub",
"0x4750e296949b747df1585aa67beee8be903dd560": "UUPool",
"0xef224fa5fad302b51f38898f4df499d7af127af0": "91pool",
"0x0073Cf1B9230cF3EE8Cab1971B8DbeF21eA7B595": "2miners",
"0x4c2b4e716883a2c3f6b980b70b577e54b9441060": "ETCPool PL",
"0xd144e30a0571aaf0d0c050070ac435deba461fab": "Clona Network",
"0x568f58bf1667504fdf5aa02d776c156f940178a5": "Whalesburg",
"0x999c2944807874d3677ee3c6065c8a8a92721ac5": "NinjaPool.jp",
"0x39cd14977601184b7da518fd352261aad0cb9fd3": "91pool",
"0xf35074bbd0a9aee46f4ea137971feec024ab704e": "Solo Mining Pools",
"0xa97ed75172773ec705c2c78d999d3203199101bd": "epool",
"0x87cfd09c483fe65352456bb26c784a0e4c4ba389": "ArsMine",
"0x0073cf1b9230cf3ee8cab1971b8dbef21ea7b595": "2miners",
"0x004730417cd2b1d19f6be2679906ded4fa8a64e2": "2miners",
"0x1c0fa194a9d3b44313dcd849f3c6be6ad270a0a4": "MiningPoolHub",
"0x8c5535afdbdeea80adedc955420f684931bf91e0": "MiningPoolHub",
"0xfe0ca4e9d8b83ff2d03ef4f35f0b5f754e81d1fd": "Hiveon Pool",
"0xeda79f0735a56510876a497e1c105916666b0199": "Comining",
"0xd3bfd58a31ddeb2fdd2bc212e38c41725bc93ccd": "EtherDig HVPPS",
"0xf35074bbd0a9aee46f4ea137971feec024ab704e": "solopool.org"
}
"0x21b63aC543f1A418684AbB30307262A13ab4D0E5": "testnet2-head",
"0x743Cf78AdE27abD94C4588eD30CAD1425ECcEfF3": "testnet2-node2",
"0x6a47f2e17ba215f02db9a14a4a3793d0397d35f5": "testnet2-node3",
"0x9d308ffc5cb47378443636774e7f9dc007fc5db3": "testnet2-node4",
"0xe2740ad38baf1f87fb0b97144605b9a6f51bd617": "testnet2-node5"
}
}
}
50 changes: 50 additions & 0 deletions db.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,43 @@ const Market = new Schema(
}, { collection: 'Market' },
);

const Poll = new Schema(
{
address: { type: String, },
type: { type: Number, default: 0 }, // 0 — authority, 1 - blacklist
closeTime: { type: Number },
votes: { type: Number, default: 0 },
isVoted: { type: Boolean, default: false },
isDisabled: { type: Boolean, default: false }
},
{ collection: 'Poll' }
);

const AuthoritySlot = new Schema(
{
address: { type: String, default: '0x0000000000000000000000000000000000000000' },
timestamp: { type: Number, default: 0 }
},
{ _id : false }
);

const Authority = new Schema(
{
address: { type: String, index: { unique: true } },
votes: { type: Number, default: 0 },
slots: [AuthoritySlot]
},
{ collection: 'Authority' }
);

const Blacklist = new Schema(
{
address: { type: String, index: { unique: true } },
votes: { type: Number, default: 0 },
},
{ collection: 'Blacklist' }
)

// create indices
Transaction.index({ blockNumber: -1 });
Transaction.index({ from: 1, blockNumber: -1 });
Expand All @@ -128,6 +165,10 @@ TokenTransfer.index({ blockNumber: -1 });
TokenTransfer.index({ from: 1, blockNumber: -1 });
TokenTransfer.index({ to: 1, blockNumber: -1 });
TokenTransfer.index({ contract: 1, blockNumber: -1 });
Poll.index({ address: 1, isDisabled: 1, type: 1 });
Poll.index({ address: 1, isDisabled: 1, isVoted: 1 });
Poll.index({ address: 1, isDisabled: 1, isVoted: 1, type: 1, });
Blacklist.index({ address: 1 });

mongoose.model('BlockStat', BlockStat);
mongoose.model('Block', Block);
Expand All @@ -136,13 +177,21 @@ mongoose.model('Contract', Contract);
mongoose.model('Transaction', Transaction);
mongoose.model('Market', Market);
mongoose.model('TokenTransfer', TokenTransfer);
mongoose.model('Poll', Poll);
mongoose.model('Authority', Authority);
mongoose.model('AuthoritySlot', AuthoritySlot);
mongoose.model('Blacklist', Blacklist);
module.exports.BlockStat = mongoose.model('BlockStat');
module.exports.Block = mongoose.model('Block');
module.exports.Contract = mongoose.model('Contract');
module.exports.Transaction = mongoose.model('Transaction');
module.exports.Account = mongoose.model('Account');
module.exports.Market = mongoose.model('Market');
module.exports.TokenTransfer = mongoose.model('TokenTransfer');
module.exports.Poll = mongoose.model('Poll');
module.exports.Authority = mongoose.model('Authority');
module.exports.AuthoritySlot = mongoose.model('AuthoritySlot');
module.exports.Blacklist = mongoose.model('Blacklist');

mongoose.Promise = global.Promise;
mongoose.connect(process.env.MONGO_URI || 'mongodb://localhost/explorerDB', {
Expand All @@ -153,4 +202,5 @@ mongoose.connect(process.env.MONGO_URI || 'mongodb://localhost/explorerDB', {
// pass: 'yourdbpasscode'
});


// mongoose.set('debug', true);
8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ services:
MONGO_URI: 'mongodb://db/explorerDB'
depends_on:
- db
sync-votes:
build: .
command: ./tools/sync-votes.js
restart: always
environment:
MONGO_URI: 'mongodb://db/explorerDB'
depends_on:
- db
stats:
build: .
command: ./tools/stats.js
Expand Down
Loading