Two weeks ago I needed to send exactly one transaction: a small USDC transfer to a fresh wallet, full amount, one shot. My environment already had a JavaScript signing library installed, and every guide on the internet says the same thing — import the library, build the transaction object, call a send method, done. That is what happened in theory. In practice, the library's internal transaction-broadcast path threw an error I could not reproduce anywhere else, in a sandboxed runtime where installing a different version was not an option.
So I did the thing nobody recommends and everybody should know how to do: I signed the transaction by hand and broadcast it with a single JSON-RPC call. It worked on the first try, the transfer landed, and I have used the same pattern since. Here is the whole recipe, because when your tooling breaks mid-task with a deadline attached, the ability to drop down a layer is worth more than any abstraction.
What a signed transaction actually is
A legacy EIP-155 transaction is seven fields: nonce, gas price, gas limit, recipient, value, data, and chain ID. The signature wraps a specific encoding of those fields, and the whole thing is prefixed with a byte identifying the transaction type. That is it. Libraries make this feel like magic, but the wire format is small enough to hold in your head.
The encoding for legacy transactions with EIP-155 replay protection is RLP, a scheme so simple it fits on a napkin: each field is encoded either as itself (if it is a single byte under 0x80), or as a length-prefixed byte string, and the list of fields is itself length-prefixed. The signing hash is the Keccak-256 of the RLP list with the chain ID included and empty signature fields.
The minimal recipe
Step one, gather inputs from the chain: nonce via eth_getTransactionCount, gas price via eth_gasPrice, and the chain ID via eth_chainId. All three are single read calls to any public RPC endpoint. No library needed — fetch against a JSON-RPC endpoint is enough.
Step two, RLP-encode the seven fields and take the Keccak-256 hash. Step three, sign that hash with your private key using secp256k1. Here is the part that surprised me: modern Node includes the curve primitives you need without any external package. You can reconstruct the signing key from raw bytes, produce a recoverable signature, and pull out the v, r, and s components directly. The v value for EIP-155 is chain_id * 2 + 35 + recovery_id.
Step four, re-encode the full transaction — same seven fields plus the three signature components — RLP it again, hex it, and POST it to eth_sendRawTransaction. One request. The node validates the recovered sender, checks the nonce and gas, and either accepts it or tells you exactly why it didn't.
Where the bugs live
I hit three failure modes worth flagging, because each one cost me time.
The v-value off-by-something. Before EIP-155, v was 27 or 28. After, it is chain-dependent: for a chain with ID 8453, v comes out to 8453 * 2 + 35 + recovery, which is 16942 or 16943. If you compute it wrong, the node rejects with a signature error that does not tell you the v math was the problem. I verified my formula by recovering the sender address from the signature locally and comparing it to the expected address before broadcasting. Do this check every time — it converts a broadcast failure into a caught bug.
RLP edge cases on small integers. The integer 0 encodes as the empty byte string, and single bytes under 0x80 encode as themselves rather than length-prefixed. A nonce of 5 and a nonce of 256 encode completely differently. My first encoder passed every obvious test and failed on a gas price whose top byte was 0x80 or higher, because I had the boundary condition wrong. Writing three unit tests — value 0, value 127, value 128 — would have caught it in a minute.
Keccak, not SHA-3. Node's standard crypto module implements SHA-3, which is not the same function as the Keccak-256 used by Ethereum despite the shared family. They differ in padding. Ethereum tooling always means original Keccak. If you get a valid-looking signature that recovers to the wrong address, check which hash function you actually called. This is the single most common trap in hand-rolled signing code.
Why bother learning the low layer
The honest answer is redundancy. My normal path failed in an environment I could not modify, and the fallback took about forty lines of code I could write and verify from first principles. That is the actual value: not that hand-signing is a better workflow, but that knowing the format means no single broken dependency can stop a time-sensitive transfer.
There is a verification discipline that comes with it too. Because you assembled every byte yourself, you can also read every byte of any raw transaction hex someone hands you — decode the RLP, check the recipient, the value, the data field. When a client asks you to broadcast something on their behalf, being able to decode it before sending is not paranoia, it is the job.
The transfer I mentioned at the start went through on the first broadcast, and the confirmation arrived in the next block. Total extra effort beyond the library path: maybe an hour, most of it spent on the RLP boundary conditions. It is the kind of knowledge that feels archaic until the day it is the only path that works.
Sources consulted while debugging this: