Blockchain explorer
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.

34 lines
863 B

7 years ago
'use strict';
module.exports = (sequelize, DataTypes) => {
const Block = sequelize.define('Block', {
height: {
type: DataTypes.INTEGER.UNSIGNED,
primaryKey: true,
7 years ago
},
hash: DataTypes.STRING(64),
size: DataTypes.MEDIUMINT.UNSIGNED,
version: DataTypes.TINYINT.UNSIGNED,
merkleroot: DataTypes.STRING(64),
time: DataTypes.DATE,
nonce: DataTypes.BIGINT.UNSIGNED,
7 years ago
bits: DataTypes.STRING(8),
difficulty: DataTypes.DECIMAL(16, 8).UNSIGNED,
hashrate: DataTypes.BIGINT.UNSIGNED,
7 years ago
previousblockhash: DataTypes.STRING(64),
nextblockhash: DataTypes.STRING(64),
}, {
timestamps: false,
7 years ago
indexes: [{
unique: true,
fields: ['hash', 'height']
7 years ago
}],
freezeTableName: true,
});
Block.associate = function(models) {
models.Block.hasMany(models.Transaction);
};
return Block;
};