Skip to content
Snippets Groups Projects
Commit a4aa4c0c authored by Dmitriy Gerasimov's avatar Dmitriy Gerasimov
Browse files

[+] Declarations for all base objects - block, block secion, transaction, coin, service

parent 98d083be
No related branches found
No related tags found
1 merge request!24Support 3689
cmake_minimum_required(VERSION 2.8)
project (libdap-chain)
set(DAP_CHAIN_SRCS dap_chain.c)
add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_SRCS})
set(DAP_CHAIN_SRCS dap_chain_block.c dap_chain_block_section.c dap_chain.c dap_chain_coin.c dap_chain_srv.c dap_chain_tx.c)
set(DAP_CHAIN_HEADERS
dap_chain_block.h
dap_chain_block_section.h
dap_chain.h
dap_chain_coin.h
dap_chain_srv.h
dap_chain_tx.h
)
include_directories("${dap_core_INCLUDE_DIRS}")
add_definitions ("${dap_core_DEFINITIONS}")
include_directories("${dap_crypto_INCLUDE_DIRS}")
add_definitions ("${dap_crypto_DEFINITIONS}")
add_library(${PROJECT_NAME} STATIC ${DAP_CHAIN_SRCS} ${DAP_CHAIN_HEADERS})
set(${PROJECT_NAME}_DEFINITIONS CACHE INTERNAL "${PROJECT_NAME}: Definitions" FORCE)
......
/*
Copyright (c) 2017-2018 (c) Project "DeM Labs Inc" https://github.com/demlabsinc
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/>.
*/
#include "dap_chain_block.h"
/**
* @brief dap_chain_block_init
* @return
*/
int dap_chain_block_init()
{
}
/**
* @brief dap_chain_block_deinit
*/
void dap_chain_block_deinit()
{
}
/*
Copyright (c) 2017-2018 (c) Project "DeM Labs Inc" https://github.com/demlabsinc
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/>.
*/
#ifndef _DAP_CHAIN_BLOCK_H_
#define _DAP_CHAIN_BLOCK_H_
#include <stdalign.h>
#include <stdint.h>
#include <stddef.h>
#include "dap_common.h"
#include "dap_math_ops.h"
#include "dap_chain_block_section.h"
/**
* @brief The dap_chain_block struct
*/
typedef struct dap_chain_block{
struct {
dap_uint128_t id; /// @param Block ID uniqie identificator of the block
size_t size;
} header;
dap_chain_block_section_t section[];
} DAP_ALIGN_PACKED dap_chain_block_t;
int dap_chain_block_init();
void dap_chain_block_deinit();
#endif
/**
* @struct dap_chain_block_section
* @brief section inside the block
*/
#ifndef _DAP_CHAIN_BLOCK_SECTION_H_
#define _DAP_CHAIN_BLOCK_SECTION_H_
#include <stdint.h>
#include "dap_common.h"
#include "dap_math_ops.h"
/// End section, means all the rest of the block is empty
#define DAP_CHAIN_BLOCK_SECTION_END 0x0000
/// Transaction section
#define DAP_CHAIN_BLOCK_SECTION_TX 0x0100
/// Smart contract: code section
#define DAP_CHAIN_BLOCK_SECTION_TX 0x0200
/// Smart contract: data section
#define DAP_CHAIN_BLOCK_SECTION_TX 0x0201
/// Public key
#define DAP_CHAIN_BLOCK_SECTION_PKEY 0x0300
/// Coin: gold
#define DAP_CHAIN_BLOCK_SECTION_COIN_GOLD 0xff00
/// Coin: copper
#define DAP_CHAIN_BLOCK_SECTION_COIN_COPPER 0xff01
/// Coin: silver
#define DAP_CHAIN_BLOCK_SECTION_COIN_SILVER 0xff02
typedef struct dap_chain_block_section{
struct{
uint16_t type; // Section type
size_t size; // section size
} header;
uint8_t data[]; // data
} DAP_ALIGN_PACKED dap_chain_block_section_t;
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment