func (self *Value) EncodeRLP(w io.Writer) error { if self == nil { w.Write(rlp.EmptyList) return nil } else { return rlp.Encode(w, self.Val) } }
func Broadcast(tx *Transaction) (interface{}, error) { w := new(bytes.Buffer) if err := rlp.Encode(w, tx); err != nil { return nil, err } txHex := fmt.Sprintf("%X", w.Bytes()) logger.Debugln("Broadcasting transaction bytes", txHex) r, err := EthClient.RequestResponse("eth", "sendRawTransaction", txHex) if err != nil { return nil, err } return r, nil }
// rlp encode and hash (for tx sign bytes) func rlpHash(x interface{}) (h common.Hash) { hw := sha3.NewKeccak256() rlp.Encode(hw, x) hw.Sum(h[:0]) return h }
func rlpEncode(x interface{}) []byte { w := new(bytes.Buffer) rlp.Encode(w, x) return w.Bytes() }