2

I tried to implement the Ledger node js api (https://www.npmjs.com/package/ledgerco) in my application. The first part with getAddress_async works, but I’m stuck with the signTransaction_async. I started with the examples on the NPM site:

eth.signTransaction_async("44'/60'/0'/0", "e8018504e3b292008252089428ee52a8f3d6e5d15f8b131996950d7f296c7952872bd72a2487400080").then(function(result) { console.log(result); }).fail(function(ex) {console.log(ex);});

I replaced the original derivation path "44'/60'/0'/0'/0" to "44'/60'/0'/0" and replaced the raw transaction string to my customized version (the second string with ‘()’ is for readability) :

e8068504e3b2920082520894BB9bc244D798123fDe783fCc1C72d3Bb8C18941387038d7ea4c6800080 ->

(e8) (06) 85 (04e3b29200) 82 (5208) 94 (BB9bc244D798123fDe783fCc1C72d3Bb8C189413) 87 (038d7ea4c68000) 80

Nonce: 06, GasPrice: 4e3b29200, Gas: 5208 (0.000441 ETH = 21000), To address: 0xBB9bc244D798123fDe783fCc1C72d3Bb8C189413 (example address), Value: 038D7EA4C68000 ( 0.001 ETH), What is the first ‘e8’?

I can run my NodeJS app successfully and get this result:

{ v: '1c', r: '767fd4a3083a003f2d056edd19b53aaf1a82331ef6b0bafa7e815b0c05e1e696', s: '3973be6e55cade0d56148e1f46faf9781c97369d376647209d2e95551f7a995f' }

Based on this output I can create this signed transaction string:

0xf86b068504e3b2920082520894BB9bc244D798123fDe783fCc1C72d3Bb8C18941387038d7ea4c680008025a0767fd4a3083a003f2d056edd19b53aaf1a82331ef6b0bafa7e815b0c05e1e696a03973be6e55cade0d56148e1f46faf9781c97369d376647209d2e95551f7a995f

What is this first part: 0xf86b, The rest of the string I can create, based on the input above. The last part is to push it to the Ethereum blockchain, for that I use:

https://etherscan.io/pushTx

Error! Unable to broadcast Tx : {"jsonrpc":"2.0","error":{"code":-32010,"message":"Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 1441000000000000 and got: 0."},"id":1}

I have enough funds on my wallet and when I sign a transaction with my Ledger in combination with MyEtherWallet or my private Ethereum node, I can create a signed transaction and push it successful to the Ethereum blockchain.

Can someone help me to debug this issue with the raw transaction and explain the parts I mentioned above.

  • Here is my full node JS application to sign a transaction: const ledger = require('ledgerco'); ledger .comm_node .create_async() .then(function(comm) { console.log(comm.device.getDeviceInfo()); var eth = new ledger.eth(comm) eth.signTransaction_async("44'/60'/0'/0", "E8068504e3b2920082520894DF900e740116c863e8B9995b666c4891F95f321E87038d7ea4c6800080").then( function(result) {console.log(result);}).fail( function(ex) {console.log(ex);}); }) .catch(function(reason) { console.log('An error occured: ', reason); }); – Jeroen Oct 16 '17 at 8:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.