This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bash | |
git clone https://github.com/ArkEcosystem/core-plugin-skeleton your-plugin-name | |
cd your-plugin-name | |
yarn install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "@vendor/your-plugin-name", | |
"description": "This plugin provides X for ARK Core 2.0", | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const twilio = require('twilio') | |
const util = require('util') | |
const container = require('@arkecosystem/core-container') | |
const logger = container.resolvePlugin('logger') | |
module.exports = class Twilio { | |
constructor(options) { | |
this.client = twilio(options.accountSid, options.authToken) | |
this.options = options | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const container = require('@arkecosystem/core-container') | |
const emitter = container.resolvePlugin('event-emitter') | |
class Listener { | |
setUp(options, twilio) { | |
emitter.on('forging.missing', data => { | |
if (data.delegate.publicKey === options.publicKey) { | |
twilio.sendMessage(data.delegate, data.block) | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const listener = require('./listener') | |
const Twilio = require('./twilio') | |
exports.plugin = { | |
pkg: require('../package.json'), | |
register: async (container, options) => { | |
logger.info('[Monitor] Waiting for Missed Blocks') | |
listener.setUp(options, new Twilio(options.twilio)) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
'@arkecosystem/core-event-emitter': {}, | |
'@arkecosystem/core-config': {}, | |
'@arkecosystem/core-logger': {}, | |
... | |
'@vendor/your-plugin-name': { | |
publicKey: 'your-delegate-public-key', | |
twilio: { | |
body: '%s is missing', | |
to: '+12345678901', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "devnet", | |
"messagePrefix": "DARK message:\n", | |
"bip32": { | |
"public": 46090600, | |
"private": 46089520 | |
}, | |
"pubKeyHash": 30, | |
"nethash": "578e820911f24e039733b45e4882b73e301f813a0d2c31330dafda84534ffa23", | |
"wif": 170, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** Calculates delegate fee for processing and forging if transaction | |
* @param {Number} Fee price per byte in ARKTOSHI as set by forger/delegate in delegate.json setting feeMultiplier | |
* @param {Transaction} Transaction for which we calculate dynamic fee | |
* @returns {Number} Calculated dynamic fee in ARKTOSHI | |
*/ | |
calculateFee (feeMultiplier, transaction) { | |
if (feeMultiplier <= 0) { | |
feeMultiplier = 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dynamic transaction payload | |
{ | |
"verified":true, | |
"id":"afaa18bfc29762b7b5172fa1f71ea7471c0d9e6dcf2992638865ecb4b3d1f26b", | |
"version":1, | |
"timestamp":47674390, | |
"senderPublicKey":"03d7dfe44e771039334f4712fb95ad355254f674c8f5d286503199157b7bf7c357", | |
"recipientId":"DBm8ZgZvaDhgba9jyFNVwDGD8ysbN3w8Tv", | |
"type":0, | |
"vendorFieldHex":"5449443a2030", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// serialised transaction Transfer | |
// serialised.length = 160 | |
{"serialized": | |
{ | |
"type":"Buffer", | |
"data":[255,1,30,0,22,116,215,2,3,215,223,228,78,119,16,57,51,79,71,18,251,149,173,53,82,84,246,116,200,245,210,134,80,49,153,21,123,123,247,195,87,14,1,0,0,0,0,0,0,6,84,73,68,58,32,48,0,194,235,11,0,0,0,0,15,0,0,0,30,72,161,107,90,67,151,232,118,184,105,194,229,52,233,123,39,157,230,102,177,48,68,2,32,69,177,255,192,154,14,176,62,80,182,75,185,130,144,48,143,68,177,152,153,1,75,93,101,109,175,41,10,149,220,23,79,2,32,15,59,8,76,121,202,240,45,147,56,172,137,149,29,183,136,156,137,156,69,81,149,205,254,98,22,126,19,61,71,244,227] | |
} | |
} |
OlderNewer