diff --git a/CMakeLists.txt b/CMakeLists.txt index 630925c807c9cf73aae30d3f80b7c5c6d34d7a99..e26e9fc7e3e3d861c49c036a7ea2d635ce0c8dd9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -38,6 +38,8 @@ set(DAP_CHAIN_HEADERS dap_chain_section_tx.h dap_chain_section_tx_in.h dap_chain_section_tx_out.h + dap_chain_section_tx_pkey.h + dap_chain_section_tx_sig.h dap_hash.h dap_hash_fusion.h dap_hash_keccak.h diff --git a/dap_chain_block_txs.c b/dap_chain_block_txs.c index a672942990f0be23844bfe82c8fbee1b3ce386ce..eb69d9a7d00e43eb2b2ffd62aa1b90b9b25d8f95 100644 --- a/dap_chain_block_txs.c +++ b/dap_chain_block_txs.c @@ -21,3 +21,4 @@ You should have received a copy of the GNU General Public License along with any DAP based project. If not, see <http://www.gnu.org/licenses/>. */ +#include "dap_chain_block_txs.h" diff --git a/dap_chain_common.h b/dap_chain_common.h index 6cc1da25c34c10903d1e9f488987e8144ff4819b..078a0edd9ad3d299377f1dab1182cbf01d46345b 100644 --- a/dap_chain_common.h +++ b/dap_chain_common.h @@ -44,6 +44,7 @@ typedef enum dap_chain_hash_kind { typedef union dap_chain_sig_type{ enum { SIG_TYPE_NEWHOPE = 0x0000, + SIG_TYPE_KEY_IMAGE = 0xf000, /// @brief key image for anonymous transaction SIG_TYPE_MULTI = 0xffff /// @brief Has inside subset of different signatures and sign composed with all of them } type: 16; diff --git a/dap_chain_section_tx.h b/dap_chain_section_tx.h index 9d52a97b98da94727c0e8848886fc08746e562ba..3e4c27c441e5e5ef4876bd673430fc8c529e680d 100644 --- a/dap_chain_section_tx.h +++ b/dap_chain_section_tx.h @@ -26,8 +26,10 @@ #include "dap_chain_section.h" typedef enum dap_chain_tx_item_type{ - TX_ITEM_TYPE_IN = 0x00, - TX_ITEM_TYPE_OUT = 0x10, + TX_ITEM_TYPE_IN = 0x00, /// @brief Transaction inputs + TX_ITEM_TYPE_OUT = 0x10, /// @brief Transaction outputs + TX_ITEM_TYPE_PKEY = 0x20, + TX_ITEM_TYPE_SIG = 0x30, } dap_chain_tx_item_type_t; /** diff --git a/dap_chain_section_tx_pkey.h b/dap_chain_section_tx_pkey.h new file mode 100644 index 0000000000000000000000000000000000000000..abf7ab628d49b8d6a0ba24ce0f53fb84290b970d --- /dev/null +++ b/dap_chain_section_tx_pkey.h @@ -0,0 +1,42 @@ +/* + * Authors: + * Dmitriy A. Gearasimov <kahovski@gmail.com> + * DeM Labs Inc. https://demlabs.net + * DeM Labs Open source community https://github.com/demlabsinc + * Copyright (c) 2017-2018 + * All rights reserved. + + This file is part of DAP (Deus Applications Prototypes) the open source project + + DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DAP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with any DAP based project. If not, see <http://www.gnu.org/licenses/>. +*/ +#pragma once + +#include <stdint.h> +#include "dap_common.h" +#include "dap_chain_common.h" +#include "dap_chain_section_tx.h" +/** + * @struct dap_chain_tx_pkey + * @brief TX item with one of the transaction's public keys + */ +typedef struct dap_chain_tx_pkey{ + struct { + dap_chain_tx_item_type_t type:8; /// @param type @brief Transaction item type + dap_chain_sig_type_t sig_type; /// Signature type + uint32_t sig_size; /// Signature size + } header; /// Only header's hash is used for verification + uint32_t seq_no; /// Sequence number, out of the header so could be changed during reorganization + uint8_t pkey[]; /// @param sig @brief raw pkey dat +} DAP_ALIGN_PACKED dap_chain_tx_pkey_t; diff --git a/dap_chain_section_tx_sig.h b/dap_chain_section_tx_sig.h new file mode 100644 index 0000000000000000000000000000000000000000..cfeb8503f9c0efb750d5293cb18b3656d7237bf0 --- /dev/null +++ b/dap_chain_section_tx_sig.h @@ -0,0 +1,43 @@ +/* + * Authors: + * Dmitriy A. Gearasimov <kahovski@gmail.com> + * DeM Labs Inc. https://demlabs.net + * DeM Labs Open source community https://github.com/demlabsinc + * Copyright (c) 2017-2018 + * All rights reserved. + + This file is part of DAP (Deus Applications Prototypes) the open source project + + DAP (Deus Applicaions Prototypes) is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + DAP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with any DAP based project. If not, see <http://www.gnu.org/licenses/>. +*/ +#pragma once + +#include <stdint.h> +#include "dap_common.h" +#include "dap_chain_common.h" +#include "dap_chain_section_tx.h" + + +/** + * @struct dap_chain_tx_sig + * @brief Section with set of transaction signatures + */ +typedef struct dap_chain_tx_sig{ + struct { + dap_chain_tx_item_type_t type:8; /// @param type @brief Transaction item type + dap_chain_sig_type_t sig_type; /// Signature type + uint32_t sig_size; /// Signature size + } header; /// Only header's hash is used for verification + uint8_t sig[]; /// @param sig @brief raw signature data +} DAP_ALIGN_PACKED dap_chain_tx_sig_t;