Added Tari gRPC definitions

This commit is contained in:
SChernykh 2024-01-27 21:29:12 +01:00
parent ab747d66ac
commit a60fba8c18
32 changed files with 67181 additions and 30 deletions

View file

@ -32,12 +32,12 @@ jobs:
- name: Install dependencies
shell: alpine.sh --root {0}
run: |
apk add git cmake gcc g++ make
apk add git cmake gcc g++ make linux-headers
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build libcurl
shell: alpine.sh {0}
@ -115,7 +115,7 @@ jobs:
strategy:
matrix:
config:
- {os: ubuntu-20.04, c: gcc-7, cpp: g++-7, flags: "-Wno-lto-type-mismatch"}
- {os: ubuntu-20.04, c: gcc, cpp: g++, flags: ""}
- {os: ubuntu-20.04, c: gcc-11, cpp: g++-11, flags: ""}
- {os: ubuntu-22.04, c: gcc-12, cpp: g++-12, flags: ""}
@ -129,7 +129,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build p2pool
run: |
@ -184,7 +184,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build libcurl
run: |
@ -261,12 +261,12 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build libcurl
run: |
cd external/src/curl
cmake . -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
cmake . -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS="-Os ${{ matrix.config.flags }}" -DBUILD_CURL_EXE=OFF -DBUILD_SHARED_LIBS=OFF -DCURL_ZLIB=OFF -DCURL_DISABLE_ALTSVC=ON -DCURL_DISABLE_COOKIES=ON -DCURL_DISABLE_DOH=ON -DCURL_DISABLE_GETOPTIONS=ON -DCURL_DISABLE_HSTS=ON -DCURL_DISABLE_LIBCURL_OPTION=ON -DCURL_DISABLE_MIME=ON -DCURL_DISABLE_NETRC=ON -DCURL_DISABLE_NTLM=ON -DCURL_DISABLE_PARSEDATE=ON -DCURL_DISABLE_PROGRESS_METER=ON -DCURL_DISABLE_SHUFFLE_DNS=ON -DCURL_DISABLE_SOCKETPAIR=ON -DCURL_DISABLE_VERBOSE_STRINGS=ON -DHTTP_ONLY=ON -DCURL_ENABLE_SSL=OFF -DUSE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF -DCURL_USE_LIBSSH2=OFF -DENABLE_UNIX_SOCKETS=OFF
make -j$(nproc)
cd lib && mkdir .libs && cp libcurl.a .libs
@ -275,7 +275,7 @@ jobs:
cd external/src/libuv
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DBUILD_TESTING=OFF -DLIBUV_BUILD_SHARED=OFF
make -j$(nproc)
- name: Build libzmq
@ -283,14 +283,14 @@ jobs:
cd external/src/libzmq
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
cmake .. -DCMAKE_TOOLCHAIN_FILE=../../../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='-Os ${{ matrix.config.flags }}' -DCMAKE_CXX_FLAGS='-Os ${{ matrix.config.flags }}' -DWITH_LIBSODIUM=OFF -DWITH_LIBBSD=OFF -DBUILD_TESTS=OFF -DWITH_DOCS=OFF -DENABLE_DRAFTS=OFF -DBUILD_SHARED=OFF
make -j$(nproc)
- name: Build p2pool
run: |
mkdir build
cd build
cmake .. -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ -DCMAKE_STRIP=/usr/bin/aarch64-linux-gnu-strip -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/aarch64_toolchain.cmake -DCMAKE_C_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DCMAKE_CXX_FLAGS='${{ matrix.config.flags }} -Wl,-s -Wl,--gc-sections' -DSTATIC_LIBS=ON -DARCH_ID=aarch64
make -j$(nproc)
- name: Run RandomX tests
@ -449,7 +449,7 @@ jobs:
cd tests
mkdir build
cd build
cmake .. -G "${{ matrix.config.vs }}"
cmake .. -G "${{ matrix.config.vs }}" -DDEV_WITH_ASAN=ON
& "${{ matrix.config.vspath }}\\MSBuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool_tests.vcxproj
- name: Run tests
@ -579,7 +579,7 @@ jobs:
build-freebsd:
timeout-minutes: 75
timeout-minutes: 90
runs-on: ${{ matrix.os.host }}
strategy:
@ -596,6 +596,11 @@ jobs:
with:
submodules: recursive
- name: Delete unused files
run: |
rm -rf .git
rm -rf external/lib
- name: Build p2pool
uses: cross-platform-actions/action@v0.22.0
with:
@ -642,7 +647,7 @@ jobs:
build-openbsd:
timeout-minutes: 75
timeout-minutes: 90
runs-on: ${{ matrix.os.host }}
strategy:
@ -650,7 +655,7 @@ jobs:
os:
- name: openbsd
architecture: x86-64
version: '7.2'
version: '7.4'
host: ubuntu-22.04
steps:
@ -659,6 +664,11 @@ jobs:
with:
submodules: recursive
- name: Delete unused files
run: |
rm -rf .git
rm -rf external/lib
- name: Build p2pool
uses: cross-platform-actions/action@v0.22.0
with:

View file

@ -25,7 +25,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: cmake p2pool
run: |

View file

@ -49,7 +49,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL

View file

@ -22,7 +22,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Checkout cppcheck
uses: actions/checkout@v4
@ -68,7 +68,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Checkout cppcheck
uses: actions/checkout@v4

View file

@ -35,7 +35,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Configure CMake
run: cmake -B ${{ env.build }} -DCMAKE_BUILD_TYPE=${{ env.config }}

View file

@ -10,7 +10,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Compress source code
run: |

View file

@ -25,7 +25,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build libcurl
run: |
@ -113,7 +113,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build libcurl
run: |
@ -185,7 +185,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build p2pool
run: |
@ -234,7 +234,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: true
submodules: recursive
- name: Build p2pool
run: |
@ -357,7 +357,7 @@ jobs:
run: |
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -DDEV_TEST_SYNC=ON
cmake .. -G "Visual Studio 17 2022" -DDEV_TEST_SYNC=ON -DDEV_WITH_ASAN=ON
& "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\Msbuild\\Current\\Bin\\amd64\\msbuild" -v:m /m /p:Configuration=Debug p2pool.vcxproj
- name: Run p2pool

3
.gitmodules vendored
View file

@ -25,3 +25,6 @@
[submodule "external/src/miniupnp"]
path = external/src/miniupnp
url = https://github.com/SChernykh/miniupnp
[submodule "external/src/protobuf"]
path = external/src/protobuf
url = https://github.com/SChernykh/protobuf

View file

@ -1,6 +1,14 @@
cmake_minimum_required(VERSION 3.5)
project(p2pool)
message(STATUS "Build environment:
System processor: ${CMAKE_SYSTEM_PROCESSOR}
C compiler: ${CMAKE_C_COMPILER} (${CMAKE_C_COMPILER_ID})
CXX compiler: ${CMAKE_CXX_COMPILER} (${CMAKE_CXX_COMPILER_ID})
")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
option(STATIC_BINARY "Build static binary" OFF)
option(STATIC_LIBS "Link libuv and libzmq statically" OFF)
option(WITH_RANDOMX "Include the RandomX library in the build. If this is turned off, p2pool will rely on monerod for verifying RandomX hashes" ON)
@ -15,12 +23,16 @@ option(DEV_WITH_ASAN "[Developer only] Compile with address sanitizer" OFF)
option(DEV_CLANG_TIDY "[Developer only] Compile for clang-tidy" OFF)
option(DEV_TRACK_MEMORY "[Developer only] Track memory allocations" OFF)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
if (${CMAKE_VERSION} VERSION_GREATER "3.5.2")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT p2pool)
endif()
add_subdirectory(external/src/protobuf)
set(LIBS ${LIBS} libprotobuf)
add_subdirectory(external/src/Tari)
set(LIBS ${LIBS} Tari_gRPC)
if (WITH_RANDOMX)
add_definitions(-DWITH_RANDOMX)
add_subdirectory(external/src/RandomX)
@ -131,6 +143,9 @@ if (WITH_RANDOMX)
set(SOURCES ${SOURCES} src/miner.cpp)
endif()
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Header Files" FILES ${HEADERS})
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "Source Files" FILES ${SOURCES})
if (NOT ((CMAKE_CXX_COMPILER_ID MATCHES MSVC) OR STATIC_BINARY OR STATIC_LIBS))
include(FindCURL)
endif()
@ -164,6 +179,7 @@ include_directories(external/src/robin-hood-hashing/src/include)
if (WITH_UPNP)
include_directories(external/src/miniupnp/miniupnpc/include)
endif()
include_directories(external/src/protobuf/src)
if (WIN32)
set(LIBS ${LIBS} ws2_32 iphlpapi userenv psapi dnsapi dbghelp)
@ -235,7 +251,7 @@ add_definitions(/DZMQ_STATIC)
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("int main(){ return __builtin_clzll(1);}" HAVE_BUILTIN_CLZLL)
check_cxx_source_compiles("#include <intrin.h>\n#pragma intrinsic(_BitScanReverse64)\nint main(){unsigned long r;_BitScanReverse64(&r,1);return r;}" HAVE_BITSCANREVERSE64)
check_cxx_source_compiles("#include <intrin.h>\n#pragma intrinsic(_BitScanReverse64)\nint main(){unsigned long r;_BitScanReverse64(&r,1);return static_cast<int>(r);}" HAVE_BITSCANREVERSE64)
check_cxx_source_compiles("#include <sched.h>\nint main(){sched_param param;return sched_setscheduler(0, SCHED_IDLE, &param);}" HAVE_SCHED)
include(CheckCSourceCompiles)

View file

@ -0,0 +1,8 @@
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_CROSSCOMPILING TRUE)
set(CMAKE_SYSTEM_PROCESSOR aarch64)
set(CMAKE_C_COMPILER /usr/bin/aarch64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER /usr/bin/aarch64-linux-gnu-g++)
set(CMAKE_STRIP /usr/bin/aarch64-linux-gnu-strip)

View file

@ -41,6 +41,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
set(WARNING_FLAGS "${WARNING_FLAGS} -Wstrict-overflow=2")
endif()
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_TSAN OR DEV_WITH_UBSAN OR DEV_WITH_ASAN)
set(OPTIMIZATION_FLAGS "-Og -g")
else()
@ -76,8 +80,17 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
set(SECURITY_FLAGS "/GS /guard:cf")
set(OPTIMIZATION_FLAGS "/O2 /Oi /Ob2 /Ot /DNDEBUG /GL")
set(CMAKE_C_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd /fsanitize=address")
set(CMAKE_CXX_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd /fsanitize=address")
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "/W0")
endif()
set(CMAKE_C_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
set(CMAKE_CXX_FLAGS_DEBUG "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} /Od /Ob0 /Zi /MTd")
if (DEV_WITH_ASAN)
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /fsanitize=address")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /fsanitize=address")
endif()
set(CMAKE_C_FLAGS_RELEASE "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} ${OPTIMIZATION_FLAGS} /MT")
set(CMAKE_CXX_FLAGS_RELEASE "${GENERAL_FLAGS} ${WARNING_FLAGS} ${SECURITY_FLAGS} ${OPTIMIZATION_FLAGS} /MT")
@ -100,6 +113,10 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set(WARNING_FLAGS "-Wall -Wextra -Wno-undefined-internal -Wunreachable-code-aggressive -Wmissing-prototypes -Wmissing-variable-declarations -Werror")
if (DISABLE_WARNINGS)
set(WARNING_FLAGS "-w")
endif()
if (DEV_WITH_MSAN)
set(OPTIMIZATION_FLAGS "-Og -g")
else()

30
external/src/Tari/CMakeLists.txt vendored Normal file
View file

@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.5)
project(Tari_gRPC)
set(HEADERS
proto/gRPC/base_node.pb.h
proto/gRPC/block.pb.h
proto/gRPC/network.pb.h
proto/gRPC/sidechain_types.pb.h
proto/gRPC/transaction.pb.h
proto/gRPC/types.pb.h
proto.h
)
set(SOURCES
proto/gRPC/base_node.pb.cc
proto/gRPC/block.pb.cc
proto/gRPC/network.pb.cc
proto/gRPC/sidechain_types.pb.cc
proto/gRPC/transaction.pb.cc
proto/gRPC/types.pb.cc
)
include_directories(../protobuf/src)
include_directories(../protobuf/third_party/abseil-cpp)
set(DISABLE_WARNINGS ON)
include(../../../cmake/flags.cmake)
add_library(Tari_gRPC ${HEADERS} ${SOURCES})

14
external/src/Tari/proto.h vendored Normal file
View file

@ -0,0 +1,14 @@
#ifdef _MSC_VER
#pragma warning(push, 0)
#endif
#include "proto/gRPC/base_node.pb.h"
#include "proto/gRPC/block.pb.h"
#include "proto/gRPC/network.pb.h"
#include "proto/gRPC/sidechain_types.pb.h"
#include "proto/gRPC/transaction.pb.h"
#include "proto/gRPC/types.pb.h"
#ifdef _MSC_VER
#pragma warning(pop)
#endif

File diff suppressed because it is too large Load diff

16737
external/src/Tari/proto/gRPC/base_node.pb.h vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,488 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
import "types.proto";
import "transaction.proto";
import "block.proto";
import "network.proto";
import "sidechain_types.proto";
package tari.rpc;
// The gRPC interface for interacting with the base node.
service BaseNode {
// Lists headers in the current best chain
rpc ListHeaders(ListHeadersRequest) returns (stream BlockHeaderResponse);
// Get header by hash
rpc GetHeaderByHash(GetHeaderByHashRequest) returns (BlockHeaderResponse);
// Returns blocks in the current best chain. Currently only supports querying by height
rpc GetBlocks(GetBlocksRequest) returns (stream HistoricalBlock);
// Returns the block timing for the chain heights
rpc GetBlockTiming(HeightRequest) returns (BlockTimingResponse);
// Returns the network Constants
rpc GetConstants(BlockHeight) returns (ConsensusConstants);
// Returns Block Sizes
rpc GetBlockSize (BlockGroupRequest) returns (BlockGroupResponse);
// Returns Block Fees
rpc GetBlockFees (BlockGroupRequest) returns (BlockGroupResponse);
// Get Version
rpc GetVersion(Empty) returns (StringValue);
// Check for new updates
rpc CheckForUpdates(Empty) returns (SoftwareUpdate);
// Get coins in circulation
rpc GetTokensInCirculation(GetBlocksRequest) returns (stream ValueAtHeightResponse);
// Get network difficulties
rpc GetNetworkDifficulty(HeightRequest) returns (stream NetworkDifficultyResponse);
// Get the block template
rpc GetNewBlockTemplate(NewBlockTemplateRequest) returns (NewBlockTemplateResponse);
// Construct a new block from a provided template
rpc GetNewBlock(NewBlockTemplate) returns (GetNewBlockResult);
// Construct a new block and header blob from a provided template
rpc GetNewBlockBlob(NewBlockTemplate) returns (GetNewBlockBlobResult);
// Submit a new block for propagation
rpc SubmitBlock(Block) returns (SubmitBlockResponse);
// Submit a new mined block blob for propagation
rpc SubmitBlockBlob(BlockBlobRequest) returns (SubmitBlockResponse);
// Submit a transaction for propagation
rpc SubmitTransaction(SubmitTransactionRequest) returns (SubmitTransactionResponse);
// Get the base node sync information
rpc GetSyncInfo(Empty) returns (SyncInfoResponse);
// Get the base node sync information
rpc GetSyncProgress(Empty) returns (SyncProgressResponse);
// Get the base node tip information
rpc GetTipInfo(Empty) returns (TipInfoResponse);
// Search for blocks containing the specified kernels
rpc SearchKernels(SearchKernelsRequest) returns (stream HistoricalBlock);
// Search for blocks containing the specified commitments
rpc SearchUtxos(SearchUtxosRequest) returns (stream HistoricalBlock);
// Fetch any utxos that exist in the main chain
rpc FetchMatchingUtxos(FetchMatchingUtxosRequest) returns (stream FetchMatchingUtxosResponse);
// get all peers from the base node
rpc GetPeers(GetPeersRequest) returns (stream GetPeersResponse);
rpc GetMempoolTransactions(GetMempoolTransactionsRequest) returns (stream GetMempoolTransactionsResponse);
rpc TransactionState(TransactionStateRequest) returns (TransactionStateResponse);
// This returns the node's network identity
rpc Identify (Empty) returns (NodeIdentity);
// Get Base Node network connectivity status
rpc GetNetworkStatus(Empty) returns (NetworkStatusResponse);
// List currently connected peers
rpc ListConnectedPeers(Empty) returns (ListConnectedPeersResponse);
// Get mempool stats
rpc GetMempoolStats(Empty) returns (MempoolStatsResponse);
// Get VNs
rpc GetActiveValidatorNodes(GetActiveValidatorNodesRequest) returns (stream GetActiveValidatorNodesResponse);
rpc GetShardKey(GetShardKeyRequest) returns (GetShardKeyResponse);
// Get templates
rpc GetTemplateRegistrations(GetTemplateRegistrationsRequest) returns (stream GetTemplateRegistrationResponse);
rpc GetSideChainUtxos(GetSideChainUtxosRequest) returns (stream GetSideChainUtxosResponse);
}
message GetAssetMetadataRequest {
bytes asset_public_key = 1;
}
message GetAssetMetadataResponse {
string name = 2;
string description =3;
string image = 4;
bytes owner_commitment = 5;
OutputFeatures features = 6;
uint64 mined_height = 7;
bytes mined_in_block = 8;
}
message ListAssetRegistrationsRequest {
uint64 offset = 2;
uint64 count = 3;
}
message ListAssetRegistrationsResponse {
bytes asset_public_key = 1;
bytes unique_id = 2;
bytes owner_commitment = 3;
uint64 mined_height = 4;
bytes mined_in_block = 5;
OutputFeatures features = 6;
bytes script = 7;
}
message GetTokensRequest {
bytes asset_public_key = 1;
// Optionally get a set of specific unique_ids
repeated bytes unique_ids = 2;
}
message GetTokensResponse {
bytes unique_id = 1;
bytes asset_public_key = 2;
bytes owner_commitment = 3;
bytes mined_in_block = 4;
uint64 mined_height = 5;
OutputFeatures features = 6;
bytes script = 7;
}
message SubmitBlockResponse {
bytes block_hash = 1;
}
message BlockBlobRequest{
bytes header_blob = 1;
bytes body_blob = 2;
}
/// return type of GetTipInfo
message TipInfoResponse {
MetaData metadata = 1;
bool initial_sync_achieved = 2;
BaseNodeState base_node_state = 3;
}
enum BaseNodeState{
START_UP = 0;
HEADER_SYNC = 1;
HORIZON_SYNC = 2;
CONNECTING = 3;
BLOCK_SYNC = 4;
LISTENING = 5;
SYNC_FAILED = 6;
}
/// return type of GetNewBlockTemplate
message NewBlockTemplateResponse {
NewBlockTemplate new_block_template = 1;
bool initial_sync_achieved = 3;
MinerData miner_data = 4;
}
/// return type of NewBlockTemplateRequest
message NewBlockTemplateRequest{
PowAlgo algo = 1;
//This field should be moved to optional once optional keyword is standard
uint64 max_weight = 2;
}
// Network difficulty response
message NetworkDifficultyResponse {
uint64 difficulty = 1;
uint64 estimated_hash_rate = 2;
uint64 height = 3;
uint64 timestamp = 4;
uint64 pow_algo = 5;
uint64 sha3x_estimated_hash_rate = 6;
uint64 randomx_estimated_hash_rate = 7;
}
// A generic single value response for a specific height
message ValueAtHeightResponse {
uint64 value= 1;
uint64 height = 2;
}
// A generic uint value
message IntegerValue {
uint64 value = 1;
}
// A generic String value
message StringValue {
string value = 1;
}
/// GetBlockSize / GetBlockFees Request
/// Either the starting and ending heights OR the from_tip param must be specified
message BlockGroupRequest {
// The height from the chain tip (optional)
uint64 from_tip = 1;
// The starting height (optional)
uint64 start_height = 2;
// The ending height (optional)
uint64 end_height = 3;
/// The type of calculation required (optional)
/// Defaults to median
/// median, mean, quartile, quantile
CalcType calc_type = 4;
}
/// GetBlockSize / GetBlockFees Response
message BlockGroupResponse {
repeated double value = 1;
CalcType calc_type = 2;
}
enum CalcType {
MEAN = 0;
MEDIAN = 1;
QUANTILE = 2;
QUARTILE = 3;
}
// The request used for querying a function that requires a height, either between 2 points or from the chain tip
// If start_height and end_height are set and > 0, they take precedence, otherwise from_tip is used
message HeightRequest {
// The height from the chain tip (optional)
uint64 from_tip = 1;
// The starting height (optional)
uint64 start_height = 2;
// The ending height (optional)
uint64 end_height = 3;
}
// The return type of the rpc GetBlockTiming
message BlockTimingResponse {
uint64 max = 1;
uint64 min = 2;
double avg = 3;
}
// Request that returns a header based by hash
message GetHeaderByHashRequest {
// The hash of the block header
bytes hash = 1;
}
message BlockHeaderResponse {
// The block header
BlockHeader header = 1;
// The number of blocks from the tip of this block (a.k.a depth)
uint64 confirmations = 2;
// The block reward i.e mining reward + fees
uint64 reward = 3;
// Achieved difficulty
uint64 difficulty = 4;
// The number of transactions contained in the block
uint32 num_transactions = 5;
}
// The request used for querying headers from the base node. The parameters `from_height` and `num_headers` can be used
// to page through the current best chain.
message ListHeadersRequest {
// The height to start at. Depending on sorting, will either default to use the tip or genesis block, for `SORTING_DESC`
// and `SORTING_ASC` respectively, if a value is not provided. The first header returned will be at this height
// followed by `num_headers` - 1 headers in the direction specified by `sorting`. If greater than the current tip,
// the current tip will be used.
uint64 from_height = 1;
// The number of headers to return. If not specified, it will default to 10
uint64 num_headers = 2;
// The ordering to return the headers in. If not specified will default to SORTING_DESC. Note that if `from_height`
// is not specified or is 0, if `sorting` is SORTING_DESC, the tip will be used as `from_height`, otherwise the
// block at height 0 will be used.
Sorting sorting = 3;
}
// The request used for querying blocks in the base node's current best chain. Currently only querying by height is
// available. Multiple blocks may be queried.e.g. [189092,100023,122424]. The order in which they are returned is not
// guaranteed.
message GetBlocksRequest {
repeated uint64 heights = 1;
}
// The return type of the rpc GetBlocks. Blocks are not guaranteed to be returned in the order requested.
message GetBlocksResponse {
repeated HistoricalBlock blocks = 1;
}
enum Sorting {
SORTING_DESC = 0;
SORTING_ASC = 1;
}
message MetaData {
// The current chain height, or the block number of the longest valid chain, or `None` if there is no chain
uint64 height_of_longest_chain = 1;
// The block hash of the current tip of the longest valid chain, or `None` for an empty chain
bytes best_block = 2;
// This is the min height this node can provide complete blocks for. A 0 here means this node is archival and can provide complete blocks for every height.
uint64 pruned_height = 6;
// The current geometric mean of the pow of the chain tip, or `None` if there is no chain
bytes accumulated_difficulty = 5;
}
message SyncInfoResponse {
uint64 tip_height = 1;
uint64 local_height = 2;
repeated bytes peer_node_id = 3;
}
message SyncProgressResponse {
uint64 tip_height = 1;
uint64 local_height = 2;
SyncState state = 3;
}
enum SyncState {
STARTUP = 0;
HEADER_STARTING = 1;
HEADER = 2;
BLOCK_STARTING = 3;
BLOCK = 4;
DONE = 5;
}
// This is the message that is returned for a miner after it asks for a new block.
message GetNewBlockResult{
// This is the header hash of the completed block
bytes block_hash = 1;
// This is the completed block
Block block = 2;
bytes merge_mining_hash =3;
}
// This is the message that is returned for a miner after it asks for a new block.
message GetNewBlockBlobResult{
// This is the header hash of the completed block
bytes block_hash = 1;
// This is the completed block's header
bytes header = 2;
// This is the completed block's body
bytes block_body = 3;
bytes merge_mining_hash =4;
bytes utxo_mr = 5;
}
// This is mining data for the miner asking for a new block
message MinerData{
PowAlgo algo = 1;
uint64 target_difficulty = 2;
uint64 reward = 3;
// bytes merge_mining_hash =4;
uint64 total_fees = 5;
}
// This is the request type for the Search Kernels rpc
message SearchKernelsRequest{
repeated Signature signatures = 1;
}
// This is the request type for the Search Utxo rpc
message SearchUtxosRequest{
repeated bytes commitments = 1;
}
message FetchMatchingUtxosRequest {
repeated bytes hashes = 1;
}
message FetchMatchingUtxosResponse {
TransactionOutput output = 1;
}
// This is the request type of the get all peers rpc call
message GetPeersResponse{
Peer peer = 1;
}
message GetPeersRequest{}
message SubmitTransactionRequest {
Transaction transaction = 1;
}
message SubmitTransactionResponse {
SubmitTransactionResult result =1;
}
enum SubmitTransactionResult {
NONE = 0;
ACCEPTED = 1;
NOT_PROCESSABLE_AT_THIS_TIME = 2;
ALREADY_MINED = 3;
REJECTED = 4;
}
message GetMempoolTransactionsRequest {
}
message GetMempoolTransactionsResponse {
Transaction transaction = 1;
}
message TransactionStateRequest {
Signature excess_sig = 1;
}
message TransactionStateResponse {
TransactionLocation result =1;
}
enum TransactionLocation {
UNKNOWN = 0;
MEMPOOL = 1;
MINED = 2;
NOT_STORED = 3;
}
message MempoolStatsResponse {
uint64 unconfirmed_txs = 2;
uint64 reorg_txs = 3;
uint64 unconfirmed_weight = 4;
}
message GetActiveValidatorNodesRequest {
uint64 height = 1;
}
message GetActiveValidatorNodesResponse {
bytes shard_key = 1;
bytes public_key = 2;
}
message GetShardKeyRequest {
uint64 height = 1;
bytes public_key = 2;
}
message GetShardKeyResponse {
bytes shard_key = 1;
bool found = 2;
}
message GetTemplateRegistrationsRequest {
bytes start_hash = 1;
uint64 count = 2;
}
message GetTemplateRegistrationResponse {
bytes utxo_hash = 1;
TemplateRegistration registration = 2;
}
message BlockInfo {
uint64 height = 1;
bytes hash = 2;
bytes next_block_hash = 3;
}
message GetSideChainUtxosRequest {
bytes start_hash = 1;
uint64 count = 2;
}
message GetSideChainUtxosResponse {
BlockInfo block_info = 1;
repeated TransactionOutput outputs = 2;
}

2567
external/src/Tari/proto/gRPC/block.pb.cc vendored Normal file

File diff suppressed because it is too large Load diff

3416
external/src/Tari/proto/gRPC/block.pb.h vendored Normal file

File diff suppressed because it is too large Load diff

137
external/src/Tari/proto/gRPC/block.proto vendored Normal file
View file

@ -0,0 +1,137 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package tari.rpc;
import "transaction.proto";
// The BlockHeader contains all the metadata for the block, including proof of work, a link to the previous block
// and the transaction kernels.
message BlockHeader {
// The hash of the block
bytes hash = 1;
// Version of the block
uint32 version = 2;
// Height of this block since the genesis block (height 0)
uint64 height = 3;
// Hash of the block previous to this in the chain.
bytes prev_hash = 4;
// Timestamp at which the block was built.
uint64 timestamp = 5;
// This is the UTXO merkle root of the outputs
// This is calculated as Hash (txo MMR root || roaring bitmap hash of UTXO indices)
bytes output_mr = 6;
// This is the MMR root of the kernels
bytes kernel_mr = 8;
// This is the Merkle root of the inputs in this block
bytes input_mr = 9;
// Total accumulated sum of kernel offsets since genesis block. We can derive the kernel offset sum for *this*
// block from the total kernel offset of the previous block header.
bytes total_kernel_offset = 10;
// Nonce increment used to mine this block.
uint64 nonce = 11;
// Proof of work metadata
ProofOfWork pow = 12;
// Kernel MMR size
uint64 kernel_mmr_size = 13;
// Output MMR size
uint64 output_mmr_size = 14;
// Sum of script offsets for all kernels in this block.
bytes total_script_offset = 15;
// Merkle root of validator nodes
bytes validator_node_mr = 16;
// Validator size
uint64 validator_node_size = 17;
}
// The proof of work data structure that is included in the block header.
message ProofOfWork {
// The algorithm used to mine this block
// 0 = Monero
// 1 = Sha3X
uint64 pow_algo = 1;
// Supplemental proof of work data. For example for Sha3x, this would be empty (only the block header is
// required), but for Monero merge mining we need the Monero block header and RandomX seed hash.
bytes pow_data = 4;
}
//This is used to request the which pow algo should be used with the block template
message PowAlgo {
// The permitted pow algorithms
enum PowAlgos {
POW_ALGOS_RANDOMX = 0; // Accessible as `grpc::pow_algo::PowAlgos::Randomx`
POW_ALGOS_SHA3X = 1; // Accessible as `grpc::pow_algo::PowAlgos::Sha3x`
}
// The pow algo to use
PowAlgos pow_algo = 1;
}
// A Minotari block. Blocks are linked together into a blockchain.
message Block {
// The BlockHeader contains all the metadata for the block, including proof of work, a link to the previous block
// and the transaction kernels.
BlockHeader header = 1;
// The components of the block or transaction. The same struct can be used for either, since in Mimblewimble,
// blocks consist of inputs, outputs and kernels, rather than transactions.
AggregateBody body = 2;
}
// The representation of a historical block in the blockchain. It is essentially identical to a protocol-defined
// block but contains some extra metadata that clients such as Block Explorers will find interesting.
message HistoricalBlock {
// The number of blocks that have been mined since this block, including this one. The current tip will have one
// confirmation.
uint64 confirmations = 1;
// The underlying block
Block block = 2;
}
// The NewBlockHeaderTemplate is used for the construction of a new mine-able block. It contains all the metadata for the block that the Base Node is able to complete on behalf of a Miner.
message NewBlockHeaderTemplate {
// Version of the block
uint32 version = 1;
// Height of this block since the genesis block (height 0)
uint64 height = 2;
// Hash of the block previous to this in the chain.
bytes prev_hash = 3;
// Total accumulated sum of kernel offsets since genesis block. We can derive the kernel offset sum for *this*
// block from the total kernel offset of the previous block header.
bytes total_kernel_offset = 4;
// Proof of work metadata
ProofOfWork pow = 5;
// Sum of script offsets for all kernels in this block.
bytes total_script_offset = 7;
}
// The new block template is used constructing a new partial block, allowing a miner to added the coinbase utxo and as a final step the Base node to add the MMR roots to the header.
message NewBlockTemplate {
// The NewBlockHeaderTemplate is used for the construction of a new mineable block. It contains all the metadata for
// the block that the Base Node is able to complete on behalf of a Miner.
NewBlockHeaderTemplate header = 1;
// This flag indicates if the inputs, outputs and kernels have been sorted internally, that is, the sort() method
// has been called. This may be false even if all components are sorted.
AggregateBody body = 2;
}

2375
external/src/Tari/proto/gRPC/network.pb.cc vendored Normal file

File diff suppressed because it is too large Load diff

3263
external/src/Tari/proto/gRPC/network.pb.h vendored Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,93 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package tari.rpc;
import "google/protobuf/timestamp.proto";
message NodeIdentity {
bytes public_key = 1;
repeated string public_addresses = 2;
bytes node_id = 3;
}
message Peer {
/// Public key of the peer
bytes public_key =1;
/// NodeId of the peer
bytes node_id =2;
/// Peer's addresses
repeated Address addresses = 3;
/// Last connection attempt to peer
uint64 last_connection = 4;
/// Flags for the peer.
uint32 flags = 5;
uint64 banned_until= 6;
string banned_reason= 7;
uint64 offline_at = 8;
/// Features supported by the peer
uint32 features = 9;
/// used as information for more efficient protocol negotiation.
repeated bytes supported_protocols = 11;
/// User agent advertised by the peer
string user_agent = 12;
}
enum ConnectivityStatus {
Initializing = 0;
Online = 1;
Degraded = 2;
Offline = 3;
}
message NetworkStatusResponse {
ConnectivityStatus status = 1;
uint32 avg_latency_ms = 2;
uint32 num_node_connections = 3;
}
message Address{
bytes address =1;
string last_seen = 2;
uint32 connection_attempts = 3;
uint64 avg_latency = 5;
}
message ListConnectedPeersResponse {
repeated Peer connected_peers = 1;
}
message SoftwareUpdate {
bool has_update = 1;
string version = 2;
string sha = 3;
string download_url = 4;
}
message GetIdentityRequest { }
message GetIdentityResponse {
bytes public_key = 1;
string public_address = 2;
bytes node_id = 3;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,77 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package tari.rpc;
import "types.proto";
message SideChainFeature {
oneof side_chain_feature {
ValidatorNodeRegistration validator_node_registration = 1;
TemplateRegistration template_registration = 2;
ConfidentialOutputData confidential_output = 3;
}
}
message ValidatorNodeRegistration {
bytes public_key = 1;
Signature signature = 2;
}
message TemplateRegistration {
bytes author_public_key = 1;
Signature author_signature = 2;
string template_name = 3;
uint32 template_version = 4;
TemplateType template_type = 5;
BuildInfo build_info = 6;
bytes binary_sha = 7;
string binary_url = 8;
}
message ConfidentialOutputData {
bytes claim_public_key = 1;
}
message TemplateType {
oneof template_type {
WasmInfo wasm = 1;
FlowInfo flow = 2;
ManifestInfo manifest = 3;
}
}
message WasmInfo {
uint32 abi_version = 1;
}
message FlowInfo {
}
message ManifestInfo {
}
message BuildInfo {
string repo_url = 1;
bytes commit_hash = 2;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,182 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package tari.rpc;
import "types.proto";
import "sidechain_types.proto";
// The transaction kernel tracks the excess for a given transaction. For an explanation of what the excess is, and
// why it is necessary, refer to the
// [Mimblewimble TLU post](https://tlu.tarilabs.com/protocols/mimblewimble-1/sources/PITCHME.link.html?highlight=mimblewimble#mimblewimble).
// The kernel also tracks other transaction metadata, such as the lock height for the transaction (i.e. the earliest
// this transaction can be mined) and the transaction fee, in cleartext.
message TransactionKernel {
// Options for a kernel's structure or use
uint32 features = 1;
/// Fee originally included in the transaction this proof is for (in MicroMinotari)
uint64 fee = 2;
// This kernel is not valid earlier than lock_height blocks
// The max lock_height of all *inputs* to this transaction
uint64 lock_height = 3;
// Remainder of the sum of all transaction commitments. If the transaction
// is well formed, amounts components should sum to zero and the excess
// is hence a valid public key.
bytes excess = 6;
// The signature proving the excess is a valid public key, which signs
// the transaction fee.
Signature excess_sig = 7;
// The hash of the kernel, as it appears in the MMR
bytes hash = 8;
// Version
uint32 version = 9;
// Optional burned commitment
bytes burn_commitment = 10;
}
// A transaction input.
//
// Primarily a reference to an output being spent by the transaction.
message TransactionInput {
// The features of the output being spent. We will check maturity for all outputs.
OutputFeatures features = 1;
// The commitment referencing the output being spent.
bytes commitment = 2;
// Hash of the input, as it appears in the MMR
bytes hash = 3;
// The serialised script
bytes script = 4;
// The script input data, if any
bytes input_data = 5;
// A signature with k_s, signing the script, input data, and mined height
ComAndPubSignature script_signature = 7;
// The offset public key, K_O
bytes sender_offset_public_key = 8;
// The hash of the output this input is spending
bytes output_hash = 9;
// Covenant
bytes covenant = 10;
// Version
uint32 version = 11;
// The encrypted data
bytes encrypted_data = 12;
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
uint64 minimum_value_promise = 13;
// The metadata signature for output this input is spending
ComAndPubSignature metadata_signature = 14;
// The rangeproof hash for output this input is spending
bytes rangeproof_hash = 15;
}
// Output for a transaction, defining the new ownership of coins that are being transferred. The commitment is a
// blinded value for the output while the range proof guarantees the commitment includes a positive value without
// overflow and the ownership of the private key.
message TransactionOutput {
// Options for an output's structure or use
OutputFeatures features = 1;
// The homomorphic commitment representing the output amount
bytes commitment = 2;
// A proof that the commitment is in the right range
RangeProof range_proof = 3;
// The hash of the output, as it appears in the MMR
bytes hash = 4;
// Tari script serialised script
bytes script = 5;
// Tari script offset public key, K_O
bytes sender_offset_public_key = 6;
// Metadata signature with the homomorphic commitment private values (amount and blinding factor) and the sender
// offset private key
ComAndPubSignature metadata_signature = 7;
// Covenant
bytes covenant = 8;
// Version
uint32 version = 9;
// Encrypted Pedersen commitment openings (value and mask) for the output
bytes encrypted_data = 10;
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
uint64 minimum_value_promise = 11;
}
// Options for UTXOs
message OutputFeatures {
// Version
uint32 version = 1;
// The type of output, eg Coinbase, all of which have different consensus rules
uint32 output_type = 2;
// The maturity of the specific UTXO. This is the min lock height at which an UTXO can be spend. Coinbase UTXO
// require a min maturity of the Coinbase_lock_height, this should be checked on receiving new blocks.
uint64 maturity = 3;
// Additional arbitrary info in coinbase transactions supplied by miners
bytes coinbase_extra = 4;
// Features that are specific to a side chain
SideChainFeature sidechain_feature = 5;
// The type of range proof used in the output
uint32 range_proof_type = 6;
}
// The components of the block or transaction. The same struct can be used for either, since in Mimblewimble,
// cut-through means that blocks and transactions have the same structure. The inputs, outputs and kernels should
// be sorted by their Blake2b-256bit digest hash
message AggregateBody {
// List of inputs spent by the transaction.
repeated TransactionInput inputs = 1;
// List of outputs the transaction produces.
repeated TransactionOutput outputs = 2;
// Kernels contain the excesses and their signatures for transaction
repeated TransactionKernel kernels = 3;
}
// A transaction which consists of a kernel offset and an aggregate body made up of inputs, outputs and kernels.
message Transaction {
bytes offset = 1;
AggregateBody body = 2;
bytes script_offset = 3;
}
message UnblindedOutput {
// Value of the output
uint64 value = 1;
// Spending key of the output
bytes spending_key = 2;
// Options for an output's structure or use
OutputFeatures features = 3;
// Tari script serialised script
bytes script = 4;
// Tari script input data for spending
bytes input_data = 5;
// Tari script private key
bytes script_private_key = 7;
// Tari script offset pubkey, K_O
bytes sender_offset_public_key = 8;
// UTXO signature with the script offset private key, k_O
ComAndPubSignature metadata_signature = 9;
// The minimum height the script allows this output to be spent
uint64 script_lock_height = 10;
// Covenant
bytes covenant = 11;
// Encrypted data
bytes encrypted_data = 12;
// The minimum value of the commitment that is proven by the range proof (in MicroMinotari)
uint64 minimum_value_promise = 13;
}

4010
external/src/Tari/proto/gRPC/types.pb.cc vendored Normal file

File diff suppressed because it is too large Load diff

5282
external/src/Tari/proto/gRPC/types.pb.h vendored Normal file

File diff suppressed because it is too large Load diff

144
external/src/Tari/proto/gRPC/types.proto vendored Normal file
View file

@ -0,0 +1,144 @@
// Copyright 2020. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
// following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
// products derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
syntax = "proto3";
package tari.rpc;
/// An unsigned range interface to more accurately represent Rust native Range's
message Range {
uint64 min = 1;
uint64 max = 2;
}
/// An Empty placeholder for endpoints without request parameters
message Empty {}
/// Define an interface for block height
message BlockHeight {
uint64 block_height = 1;
}
// Define the explicit Signature implementation for the Minotari base layer. A different signature scheme can be
// employed by redefining this type.
message Signature {
bytes public_nonce = 1;
bytes signature = 2;
}
// Define the explicit ComAndPubSignature implementation for the Minotari base layer. A different signature scheme can be
// employed by redefining this type.
message ComAndPubSignature {
bytes ephemeral_commitment = 1;
bytes ephemeral_pubkey = 2;
bytes u_a = 3;
bytes u_x = 4;
bytes u_y = 5;
}
// Define the explicit CommitmentSignature implementation for the Minotari base layer. A different signature scheme can be
// employed by redefining this type
message CommitmentSignature {
bytes public_nonce = 1;
bytes u = 2;
bytes v = 3;
}
/// PoW Algorithm constants
message PowAlgorithmConstants {
uint64 min_difficulty = 2;
uint64 max_difficulty = 3;
uint64 target_time = 4;
}
/// Weight params
message WeightParams {
uint64 kernel_weight = 1;
uint64 input_weight = 2;
uint64 output_weight = 3;
uint64 features_and_scripts_bytes_per_gram = 4;
}
/// Output version
message OutputsVersion {
Range outputs = 1;
Range features = 2;
}
/// Output types
enum OutputType {
STANDARD = 0;
COINBASE = 1;
BURN = 2;
VALIDATOR_NODE_REGISTRATION = 3;
CODE_TEMPLATE_REGISTRATION = 4;
}
/// Range proof types
enum RangeProofType {
BULLETPROOF_PLUS = 0;
REVEALED_VALUE = 1;
}
message PermittedRangeProofs {
OutputType output_type = 1;
repeated RangeProofType range_proof_types = 2;
}
/// Range proof
message RangeProof {
bytes proof_bytes = 1;
}
/// Consensus Constants response
message ConsensusConstants {
uint64 coinbase_min_maturity = 1;
uint32 blockchain_version = 2;
uint64 future_time_limit = 3;
uint64 difficulty_block_window = 5;
uint64 max_block_transaction_weight = 7;
uint64 pow_algo_count = 8;
uint64 median_timestamp_count = 9;
uint64 emission_initial = 10;
repeated uint64 emission_decay = 11;
uint64 emission_tail = 12;
uint64 min_sha3x_pow_difficulty = 13;
uint64 block_weight_inputs = 14;
uint64 block_weight_outputs = 15;
uint64 block_weight_kernels = 16;
uint64 faucet_value = 17;
uint64 max_script_byte_size = 18;
uint64 validator_node_validity_period = 19;
uint64 effective_from_height = 20;
Range valid_blockchain_version_range = 21;
uint64 max_randomx_seed_height = 22;
map<uint32, PowAlgorithmConstants> proof_of_work = 23;
WeightParams transaction_weight = 24;
Range input_version_range = 26;
OutputsVersion output_version_range = 27;
Range kernel_version_range = 28;
repeated OutputType permitted_output_types = 29;
uint64 epoch_length = 30;
uint64 validator_node_registration_min_deposit_amount = 31;
uint64 validator_node_registration_min_lock_height = 32;
uint64 validator_node_registration_shuffle_interval_epoch = 33;
repeated PermittedRangeProofs permitted_range_proof_types = 34;
}

1
external/src/protobuf vendored Submodule

@ -0,0 +1 @@
Subproject commit b052f432fa7162f5ad946dc7b6c62969e0172610