cryptnox-pos
1.0.0
Standalone USDC payment terminal firmware (ESP32 + Cryptnox smart card)
Toggle main menu visibility
Loading...
Searching...
No Matches
eth_rlp.h
Go to the documentation of this file.
1
/*
2
* SPDX-License-Identifier: LGPL-3.0-or-later
3
* Copyright (c) 2026 Cryptnox SA
4
*/
5
11
12
#ifndef ETH_RLP_H
13
#define ETH_RLP_H
14
15
/******************************************************************
16
* 1. Included files
17
******************************************************************/
18
19
#include <stdint.h>
20
#include <stddef.h>
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/******************************************************************
27
* 2. Types
28
******************************************************************/
29
31
typedef
struct
{
32
uint64_t
chain_id
;
33
uint64_t
nonce
;
34
uint64_t
max_priority_fee
;
35
uint64_t
max_fee
;
36
uint64_t
gas_limit
;
37
uint8_t
to
[20];
38
uint64_t
eth_value
;
40
const
uint8_t *
calldata
;
41
size_t
calldata_len
;
42
}
eth_tx_t
;
43
44
/******************************************************************
45
* 3. Public API
46
******************************************************************/
47
58
size_t
eth_rlp_encode_unsigned
(
const
eth_tx_t
*tx, uint8_t *out,
size_t
out_max);
59
73
size_t
eth_rlp_encode_signed
(
const
eth_tx_t
*tx, uint8_t v,
74
const
uint8_t r[32],
const
uint8_t s[32],
75
uint8_t *out,
size_t
out_max);
76
77
#ifdef __cplusplus
78
}
79
#endif
80
81
#endif
// ETH_RLP_H
eth_rlp_encode_signed
size_t eth_rlp_encode_signed(const eth_tx_t *tx, uint8_t v, const uint8_t r[32], const uint8_t s[32], uint8_t *out, size_t out_max)
Encode a signed EIP-1559 transaction: 0x02 || RLP([..., v, r, s]).
Definition
eth_rlp.cpp:268
eth_rlp_encode_unsigned
size_t eth_rlp_encode_unsigned(const eth_tx_t *tx, uint8_t *out, size_t out_max)
Encode an unsigned EIP-1559 transaction: 0x02 || RLP([chainId, nonce, ...]).
Definition
eth_rlp.cpp:244
eth_tx_t
EIP-1559 (type 2) transaction parameters.
Definition
eth_rlp.h:31
eth_tx_t::calldata_len
size_t calldata_len
Definition
eth_rlp.h:41
eth_tx_t::gas_limit
uint64_t gas_limit
Definition
eth_rlp.h:36
eth_tx_t::eth_value
uint64_t eth_value
Definition
eth_rlp.h:38
eth_tx_t::calldata
const uint8_t * calldata
Definition
eth_rlp.h:40
eth_tx_t::max_fee
uint64_t max_fee
Definition
eth_rlp.h:35
eth_tx_t::max_priority_fee
uint64_t max_priority_fee
Definition
eth_rlp.h:34
eth_tx_t::chain_id
uint64_t chain_id
Definition
eth_rlp.h:32
eth_tx_t::to
uint8_t to[20]
Definition
eth_rlp.h:37
eth_tx_t::nonce
uint64_t nonce
Definition
eth_rlp.h:33
main
eth_rlp.h
Generated by
1.17.0