Doing some ERC-735 tests on truffle+ganache I got stuck when creating claim signatures. They need to be signed from my ganache account, but I don't know its private key. The code to be used is this:
const messageToSign = "hello world"; const privateKey = "43f2ee33c522046e80b67e96ceb84a05b60b9434b0ee2e3ae4b1311b9f5dcc46"; var msgHash = EthUtil.hashPersonalMessage(new Buffer(messageToSign)); var sig = EthUtil.ecsign(msgHash, new Buffer(privateKey, 'hex')); var signatureRPC = EthUtil.toRpcSig(sig.v, sig.r, sig.s) console.log(signatureRPC);
As explained on Sign data with private key inside a truffle test file there was a method to sign messages from Truffle using:
let signedMessage = await web3.personal.sign("data", accounts)
but it is now deprecated, it throws "Method personal_sign not supported" error, so a solution seems to be an explicit signing using private key (code above).
How can I get the private key from ganache? or even better, can I get the private key from truffle?