Ensure private key starts with `0x`

This commit is contained in:
Pedro Pombeiro 2018-03-20 11:44:59 +01:00
parent 1ccae9359e
commit cc86e5112e
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
2 changed files with 5 additions and 2 deletions

View File

@ -91,6 +91,9 @@ async function sendTransaction (to, amount, gasPrice) {
if (isNaN(amount)) { if (isNaN(amount)) {
throw Error('Invalid amount') throw Error('Invalid amount')
} }
if (!config.privateKey.startsWith('0x')) {
throw Error('Private key should start with 0x')
}
let transaction = null let transaction = null
let hash = null let hash = null

View File

@ -53,10 +53,10 @@ module.exports = {
// URL for the signer // URL for the signer
signerPath: 'https://ropsten.infura.io', 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', sourceAddress: '0x26a4D114B98C4b0B0118426F10fCc1112AA2864d',
// Private key for ether.js wallet // Private key for ether.js wallet (hex value starting with 0x)
privateKey: '', privateKey: '',
// Token of the currency for fetching real time prices (e.g. 'SNT') // Token of the currency for fetching real time prices (e.g. 'SNT')