OpenCBDC Transaction Processor
Loading...
Searching...
No Matches
address.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_ADDRESS_H_
7#define OPENCBDC_TX_SRC_PARSEC_AGENT_RUNNERS_EVM_ADDRESS_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
27 auto contract_address(const evmc::address& sender,
28 const evmc::uint256be& nonce) -> evmc::address;
29
36 auto contract_address2(const evmc::address& sender,
37 const evmc::bytes32& salt,
38 const cbdc::hash_t& bytecode_hash) -> evmc::address;
39
44 auto eth_addr(const cbdc::privkey_t& key,
45 const std::shared_ptr<secp256k1_context>& ctx)
46 -> evmc::address;
47
52 auto eth_addr(const std::unique_ptr<secp256k1_pubkey>& pk,
53 const std::shared_ptr<secp256k1_context>& ctx)
54 -> evmc::address;
55}
56
57#endif
auto eth_addr(const std::unique_ptr< secp256k1_pubkey > &pk, const std::shared_ptr< secp256k1_context > &ctx) -> evmc::address
Calculates an eth address from a public key.
Definition address.cpp:56
auto contract_address2(const evmc::address &sender, const evmc::bytes32 &salt, const cbdc::hash_t &bytecode_hash) -> evmc::address
Calculates a contract address for the CREATE2 call keccak256(0xFF | sender | salt | keccak256(bytecod...
Definition address.cpp:33
auto contract_address(const evmc::address &sender, const evmc::uint256be &nonce) -> evmc::address
Calculates a contract address for the CREATE call keccak256(rlp([sender,nonce]))
Definition address.cpp:20
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