OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
signature.hpp
Go to the documentation of this file.
1// Copyright (c) 2022 MIT Digital Currency Initiative,
2// Federal Reserve Bank of Boston
3// Distributed under the MIT software license, see the accompanying
4// file COPYING or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef OPENCBDC_TX_SRC_PARSEC_AGENT_RUNNERS_EVM_SIGNATURE_H_
7#define OPENCBDC_TX_SRC_PARSEC_AGENT_RUNNERS_EVM_SIGNATURE_H_
8
9#include "messages.hpp"
11#include "util/common/hash.hpp"
12#include "util/common/keys.hpp"
13
14#include <evmc/evmc.hpp>
15#include <evmc/hex.hpp>
16#include <memory>
17#include <secp256k1.h>
18#include <secp256k1_extrakeys.h>
19#include <secp256k1_recovery.h>
20
30 auto eth_sign(const privkey_t& key,
31 hash_t& hash,
32 evm_tx_type type,
33 const std::shared_ptr<secp256k1_context>& ctx,
34 uint64_t chain_id = opencbdc_chain_id) -> evm_sig;
35
43 const std::shared_ptr<secp256k1_context>& ctx,
44 uint64_t chain_id = opencbdc_chain_id)
45 -> std::optional<evmc::address>;
46
52 uint64_t chain_id = opencbdc_chain_id) -> hash_t;
53
54}
55#endif
auto eth_sign(const privkey_t &key, hash_t &hash, evm_tx_type type, const std::shared_ptr< secp256k1_context > &ctx, uint64_t chain_id) -> evm_sig
Signs a hash using a privkey_t using ecdsa and produces an evm_sig struct Used primarily in unit test...
Definition signature.cpp:85
auto check_signature(const cbdc::parsec::agent::runner::evm_tx &tx, const std::shared_ptr< secp256k1_context > &ctx, uint64_t chain_id) -> std::optional< evmc::address >
Checks the signature of an EVM transaction.
auto sig_hash(const cbdc::parsec::agent::runner::evm_tx &tx, uint64_t chain_id) -> hash_t
Calculates the hash for creating / validating the signature.
std::array< unsigned char, cbdc::hash_size > hash_t
SHA256 hash container.
std::array< unsigned char, pubkey_len > privkey_t
A private key of a public/private keypair.
Definition keys.hpp:23