From cc86e5112e0d8bcaa0edb0929750bc2b51b848af Mon Sep 17 00:00:00 2001 From: Pedro Pombeiro Date: Tue, 20 Mar 2018 11:44:59 +0100 Subject: [PATCH] Ensure private key starts with `0x` --- bot/index.js | 3 +++ config/default.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bot/index.js b/bot/index.js index 5b01b9c..66cafb6 100644 --- a/bot/index.js +++ b/bot/index.js @@ -91,6 +91,9 @@ async function sendTransaction (to, amount, gasPrice) { if (isNaN(amount)) { throw Error('Invalid amount') } + if (!config.privateKey.startsWith('0x')) { + throw Error('Private key should start with 0x') + } let transaction = null let hash = null diff --git a/config/default.js b/config/default.js index 38cde2f..88c3ee7 100644 --- a/config/default.js +++ b/config/default.js @@ -53,10 +53,10 @@ module.exports = { // URL for the signer signerPath: 'https://ropsten.infura.io', - // Address with the funding for the bounties + // Address with the funding for the bounties (hex value starting with 0x) sourceAddress: '0x26a4D114B98C4b0B0118426F10fCc1112AA2864d', - // Private key for ether.js wallet + // Private key for ether.js wallet (hex value starting with 0x) privateKey: '', // Token of the currency for fetching real time prices (e.g. 'SNT')