ex_wire v0.1.1 ExWire.Packet.Transactions

Eth Wire Packet for communicating new transactions.

**Transactions** [`+0x02`: `P`, [`nonce`: `P`, `receivingAddress`: `B_20`, `value`: `P`, ...], ...]

Specify (a) transaction(s) that the peer should make sure is included on
its transaction queue. The items in the list (following the first item 0x12)
are transactions in the format described in the main Ethereum specification.
Nodes must not resend the same transaction to a peer in the same session. This
packet must contain at least one (new) transaction.

Link to this section Summary

Functions

Given an RLP-encoded Transactions packet from Eth Wire Protocol, decodes into a Tranasctions struct

Handles a Transactions message. We should try to add the transaction to a queue and process it. Or, right now, do nothing

Given a Transactions packet, serializes for transport over Eth Wire Protocol

Link to this section Types

Link to this type t()
t() :: %ExWire.Packet.Transactions{transactions: [any]}

Link to this section Functions

Link to this function deserialize(rlp)
deserialize(ExRLP.t) :: t

Given an RLP-encoded Transactions packet from Eth Wire Protocol, decodes into a Tranasctions struct.

Examples

iex> ExWire.Packet.Transactions.deserialize([ [1, 2, 3], [4, 5, 6] ])
%ExWire.Packet.Transactions{
  transactions: [
    [1, 2, 3],
    [4, 5, 6],
  ]
}

Handles a Transactions message. We should try to add the transaction to a queue and process it. Or, right now, do nothing.

Examples

iex> %ExWire.Packet.Transactions{transactions: []}
...> |> ExWire.Packet.Transactions.handle()
:ok
Link to this function serialize(packet)
serialize(t) :: ExRLP.t

Given a Transactions packet, serializes for transport over Eth Wire Protocol.

Examples

iex> %ExWire.Packet.Transactions{
...>   transactions: [
...>     [1, 2, 3],
...>     [4, 5, 6]
...>   ]
...> }
...> |> ExWire.Packet.Transactions.serialize
[ [1, 2, 3], [4, 5, 6] ]