August 2018
Intermediate to advanced
404 pages
11h 19m
English
Starting from web3.js v1.x.x, there is an option to extract/recover the address from the signed transaction data. This allows us to verify the origin of the transaction:
web3.eth.accounts.recoverTransaction(rawTransaction)
This method accepts the raw transaction as an input and returns the address used to sign the transaction:
var result = web3.eth.accounts.recoverTransaction("0x0...");
console.log(result);
You can also recover the address from signed data using the accounts.recover() method:
web3.eth.accounts.recover(signatureObject);
web3.eth.accounts.recover(message, signature [, preFixed]);
web3.eth.accounts.recover(message, v, r, s [, preFixed]);
This method can accept various types of input to recover the data:
web3 ...Read now
Unlock full access