Skip to content

Instantly share code, notes, and snippets.

View jim380's full-sized avatar

Jay Namsayin jim380

View GitHub Profile
let msg = web3.sha3(_from,_to,_value,_fee,nonce)
let signature = web3.eth.sign(_from, msg)
let r = signature.slice(0, 66)
let s = '0x' + signature.slice(66, 130)
let v = '0x' + signature.slice(130, 132)
v = web3.toDecimal(v)
console.log('r', r)
console.log('s', s)
@jim380
jim380 / transferProxy()
Created August 18, 2018 21:12
transferProxy() snippet
function transferProxy(address _from, address _to, uint256 _value, uint256 _fee,
uint8 _v, bytes32 _r, bytes32 _s) public returns (bool){
if(balances[_from] < _fee + _value || _fee > _fee + _value) revert();
uint256 nonce = nonces[_from];
bytes32 h = keccak256(_from,_to,_value,_fee,nonce);
if(_from != ecrecover(h,_v,_r,_s)) revert();
if(balances[_to] + _value < balances[_to]

Keybase proof

I hereby claim:

  • I am jim380 on github.
  • I am jim380 (https://keybase.io/jim380) on keybase.
  • I have a public key whose fingerprint is 3FF1 8C12 8C59 4510 2586 081F 64AE E416 7CA1 C855

To claim this, I am signing this object: