0

In Error using web3.eth.personal.sign , the problem with the number of arguments was resolved. But now that I can try the actual call, I'm getting a "does not exist" error.

console.log("Calling personal.sign");
this.web3.eth.personal.sign(this.bottleDataToSign, this.addressProdFrom, this.passwordProd)
  .then((sig)=>{
    console.log("sig="+sig);

Console:

Calling personal.sign
ERROR
Error: Uncaught (in promise): Error: Returned error: The method personal_sign does not exist/is not available ErrorResponse onreadystatechange wrapFn onInvokeTask runTask invokeTask invokeTask globalZoneAwareCallback

In node_modules/web3-eth-personal/src/index.js, it looks like "sign" actually calls "personal_sign":

new Method({
        name: 'sign',
        call: 'personal_sign',
        params: 3,
        inputFormatter: [formatters.inputSignFormatter, formatters.inputAddressFormatter, null]
    }),

Poking around in other node_modules/web3 directories/files, I didn't see any declaration for it:

$ grep -r "personal_sign" web3*
web3-core-helpers/src/formatters.js: * Hex encodes the data passed to eth_sign and personal_sign
web3-eth-personal/src/index.js:            call: 'personal_signTransaction',
web3-eth-personal/src/index.js:            call: 'personal_sign',

So does this imply the code is just missing? Am I calling it correctly? I'm still using npm web3 package: 1.0.0-beta.33, and used it from an import Web3 from "web3"; Anything else to try? Thanks.

  • Has your web3 provider enabled personal RPC? – Ayushya Mar 26 '18 at 18:11
  • I don't know. I do have a web3 = new Web3('http://localhost:8545'); // port# from geth's rpcport line for the actual web3 variable, but I thought that was only needed for talking to a geth node, which I didn't think personal.sign had to do. If needed, how would I do that? Thanks. – gkd720 Mar 26 '18 at 18:37
  • @gkd720 What command line do you use to launch geth? – Ismael Mar 27 '18 at 2:45
  • I invoke geth with: $ geth --identity "TestNode1" --rpc --rpcport "8545" --rpccorsdomain "*" --datadir "~/ethereum/TestChain1" --port "30303" --nodiscover --ipcdisable --rpcapi "db,eth,net,web3" --networkid 2429 --keystore ~/Library/Ethereum/keystore console But why does this even matter? I'm just calling a web3 package method, not yet trying to issue a transaction through geth; that was my next step in the flow. Thanks. – gkd720 Mar 27 '18 at 15:12
0

After further extensive searching, I now see what @Ayushya and @Ismael were getting at. After adding "personal" to the list of items for option --rcapi, I can successfully call the eth.personal.sign method. Looks like the typings.d.ts still needs manual tweaking, but I guess that's why they call it "beta". Thanks to both of them.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.