Last active
April 21, 2022 02:27
-
-
Save giansalex/e7e0443d9e7faeef9f1f1da2ed393e9b to your computer and use it in GitHub Desktop.
Revisions
-
giansalex revised this gist
Apr 21, 2022 . No changes.There are no files selected for viewing
-
giansalex revised this gist
Feb 28, 2022 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,7 +34,7 @@ function ascii_to_hex(str) console.log('Message to sign:', message); console.log('Sign with account:', accountToSignWith); var messageHex = '0x' + ascii_to_hex(message); // var messageHex = '0x' + keccak256(signDocBytes); // cosmos chain window.ethereum.enable().then(function() { web3.eth.sign(messageHex, accountToSignWith, signHandler); -
giansalex revised this gist
Feb 28, 2022 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -34,6 +34,7 @@ function ascii_to_hex(str) console.log('Message to sign:', message); console.log('Sign with account:', accountToSignWith); var messageHex = '0x' + ascii_to_hex(message); // var messageHex = keccak256(signDocBytes); // cosmos chain window.ethereum.enable().then(function() { web3.eth.sign(messageHex, accountToSignWith, signHandler); -
giansalex revised this gist
Feb 19, 2022 . 1 changed file with 6 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ var Web3 = require('web3'); var web3 = new Web3(window.web3.currentProvider); var accountToSignWith = '0xbedcf417ff2752d996d2ade98b97a6f0bef4beb9'; var message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Eaedem res maneant alio modo.' function signHandler(err, signature) { @@ -24,7 +24,7 @@ function ascii_to_hex(str) { var arr1 = []; for (var n = 0, l = str.length; n < l; n ++) { var hex = Number(str.charCodeAt(n)).toString(16); arr1.push(hex); } @@ -33,6 +33,8 @@ function ascii_to_hex(str) console.log('Message to sign:', message); console.log('Sign with account:', accountToSignWith); var messageHex = '0x' + ascii_to_hex(message); window.ethereum.enable().then(function() { web3.eth.sign(messageHex, accountToSignWith, signHandler); }); -
giansalex created this gist
Feb 19, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ var Web3 = require('web3'); var web3 = new Web3(window.web3.currentProvider); var accountToSignWith = '0x64D356169841B3E18fd7415780Cf01Bb4d22B872'; var message = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Tubulum fuisse, qua illum, cuius is condemnatus est rogatione, P. Eaedem res maneant alio modo.' function signHandler(err, signature) { if (!err) { console.log('Signature:', signature); signature = signature.substr(2); r = '0x' + signature.substr(0, 64); s = '0x' + signature.substr(64, 64); v = '0x' + signature.substr(128, 2) console.log(' r:', r) console.log(' s:', s) console.log(' v:', v) } else { console.error('Coult not sign message:', err); } } function ascii_to_hex(str) { var arr1 = []; for (var n = 0, l = str.length; n < l; n ++) { var hex = Number(str.charCodeAt(n)).toString(16); arr1.push(hex); } return arr1.join(''); } console.log('Message to sign:', message); console.log('Sign with account:', accountToSignWith); var messageHex = '0x' + ascii_to_hex(message); web3.eth.sign(messageHex, accountToSignWith, signHandler);