func (msg *MsgEthereumTx) Sign(chainID *big.Int, priv *ecdsa.PrivateKey) {
	txHash := msg.RLPSignBytes(chainID)

	sig, err := ethcrypto.Sign(txHash[:], priv)
	if err != nil {
		panic(err)
	}

	if len(sig) != 65 {
		panic(fmt.Sprintf("wrong size for signature: got %d, want 65", len(sig)))
	}

	r := new(big.Int).SetBytes(sig[:32])
	s := new(big.Int).SetBytes(sig[32:64])

	var v *big.Int

	if chainID.Sign() == 0 {
		v = new(big.Int).SetBytes([]byte{sig[64] + 27})
	} else {
		v = big.NewInt(int64(sig[64] + 35))
		chainIDMul := new(big.Int).Mul(chainID, big.NewInt(2))

		v.Add(v, chainIDMul)
	}

	msg.Data.V = v
	msg.Data.R = r
	msg.Data.S = s
}
// Sign calculates a secp256k1 ECDSA signature and signs the transaction. It
// takes a private key and chainID to sign an Ethereum transaction according to
// EIP155 standard. It mutates the transaction as it populates the V, R, S
// fields of the Transaction's Signature.
Sign calculates a secp256k1 ECDSA signature and signs the transaction. It
takes a private key and chainID to sign an Ethereum transaction according to
EIP155 standard. It mutates the transaction as it populates the V, R, S
fields of the Transaction's Signature.
// Sign calculates a secp256k1 ECDSA signature and signs the transaction . It // takes a private key and chainID to sign an Ethereum transaction according to // EIP155 standard . It mutates the transaction as it populates the V R S // fields of the Transaction ' s Signature .
func (msg *MsgEthereumTx) Sign(chainID *big.Int, priv *ecdsa.PrivateKey) {
	txHash := msg.RLPSignBytes(chainID)
	sig, err := ethcrypto.Sign(txHash[:], priv)
	if err != nil {
		panic(err)
	}
	if len(sig) != 65 {
		panic(fmt.Sprintf("wrong size for signature: got %d, want 65", len(sig)))
	}
	r := new(big.Int).SetBytes(sig[:32])
	s := new(big.Int).SetBytes(sig[32:64])
	var v *big.Int
	if chainID.Sign() == 0 {
		v = new(big.Int).SetBytes([]byte{sig[64] + 27})
	} else {
		v = big.NewInt(int64(sig[64] + 35))
		chainIDMul := new(big.Int).Mul(chainID, big.NewInt(2))
		v.Add(v, chainIDMul)
	}
	msg.Data.V = v
	msg.Data.R = r
	msg.Data.S = s
}
func ( msg * MsgEthereumTx ) Sign ( chainID * big . Int , priv * ecdsa . PrivateKey ) { txHash := msg . RLPSignBytes ( chainID ) sig , err := ethcrypto . Sign ( txHash [ : ] , priv ) if err != nil { panic ( err ) } if len ( sig ) != 65 { panic ( fmt . Sprintf ( " " , len ( sig ) ) ) } r := new ( big . Int ) . SetBytes ( sig [ : 32 ] ) s := new ( big . Int ) . SetBytes ( sig [ 32 : 64 ] ) var v * big . Int if chainID . Sign ( ) == 0 { v = new ( big . Int ) . SetBytes ( [ ] byte { sig [ 64 ] + 27 } ) } else { v = big . NewInt ( int64 ( sig [ 64 ] + 35 ) ) chainIDMul := new ( big . Int ) . Mul ( chainID , big . NewInt ( 2 ) ) v . Add ( v , chainIDMul ) } msg . Data . V = v msg . Data . R = r msg . Data . S = s }
Sign calculates a secp256k1 ECDSA signature and signs the transaction.
Sign calculates a secp256k1 ECDSA signature and signs the transaction .