This commit is contained in:
2026-04-03 17:02:46 +02:00
parent 7aafaa4196
commit 24f20c81f8
8 changed files with 37 additions and 37 deletions

View File

@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
project(miniboinc project(skalacoin
VERSION 0.1.0 VERSION 0.1.0
LANGUAGES C CXX LANGUAGES C CXX
) )
@@ -44,10 +44,10 @@ if(NOT SECP256K1_FOUND)
endif() endif()
# Autolykos2 CPU reference backend (optional) # Autolykos2 CPU reference backend (optional)
option(MINICOIN_ENABLE_AUTOLYKOS2_REF "Enable Autolykos2 CPU reference backend" ON) option(SKALACOIN_ENABLE_AUTOLYKOS2_REF "Enable Autolykos2 CPU reference backend" ON)
set(MINICOIN_AUTOLYKOS2_REF_AVAILABLE OFF) set(SKALACOIN_AUTOLYKOS2_REF_AVAILABLE OFF)
if(MINICOIN_ENABLE_AUTOLYKOS2_REF) if(SKALACOIN_ENABLE_AUTOLYKOS2_REF)
FetchContent_Declare( FetchContent_Declare(
autolykos2_ref_src autolykos2_ref_src
GIT_REPOSITORY https://github.com/mhssamadani/Autolykos2_NV_Miner.git GIT_REPOSITORY https://github.com/mhssamadani/Autolykos2_NV_Miner.git
@@ -88,7 +88,7 @@ if(MINICOIN_ENABLE_AUTOLYKOS2_REF)
OpenSSL::SSL OpenSSL::SSL
OpenSSL::Crypto OpenSSL::Crypto
) )
set(MINICOIN_AUTOLYKOS2_REF_AVAILABLE ON) set(SKALACOIN_AUTOLYKOS2_REF_AVAILABLE ON)
endif() endif()
# --------------------------------------------------------- # ---------------------------------------------------------
@@ -121,7 +121,7 @@ else()
target_link_libraries(node PRIVATE ${SECP256K1_LIBRARY}) target_link_libraries(node PRIVATE ${SECP256K1_LIBRARY})
endif() endif()
if(MINICOIN_AUTOLYKOS2_REF_AVAILABLE) if(SKALACOIN_AUTOLYKOS2_REF_AVAILABLE)
target_link_libraries(node PRIVATE autolykos2_ref) target_link_libraries(node PRIVATE autolykos2_ref)
endif() endif()
@@ -136,6 +136,6 @@ target_compile_options(node PRIVATE
) )
target_compile_definitions(node PRIVATE target_compile_definitions(node PRIVATE
CHAIN_DATA_DIR="${CMAKE_BINARY_DIR}/chain_data" CHAIN_DATA_DIR="${CMAKE_BINARY_DIR}/chain_data"
$<$<BOOL:${MINICOIN_AUTOLYKOS2_REF_AVAILABLE}>:MINICOIN_AUTOLYKOS2_REF_AVAILABLE> $<$<BOOL:${SKALACOIN_AUTOLYKOS2_REF_AVAILABLE}>:SKALACOIN_AUTOLYKOS2_REF_AVAILABLE>
) )
set_target_properties(node PROPERTIES OUTPUT_NAME "minicoin_node") set_target_properties(node PROPERTIES OUTPUT_NAME "skalacoin_node")

View File

@@ -1,4 +1,4 @@
# MiniCoin # Skalacoin
Privacy coin made in C. One day hopefully with a purpose beyond "educational" :) Privacy coin made in C. One day hopefully with a purpose beyond "educational" :)
@@ -13,7 +13,7 @@ Build with clang/clang++ (I don't want to deal with the gcc/MSVC shenangans righ
Use: Use:
```bash ```bash
./bin/minicoin_node <-mine> ./bin/skalacoin_node <-mine>
``` ```
Main Hashing Algorithm: SHA256d (double SHA256) for now. Main Hashing Algorithm: SHA256d (double SHA256) for now.

View File

@@ -1,5 +1,5 @@
#ifndef MINICOIN_AUTOLYKOS2_H #ifndef SKALACOIN_AUTOLYKOS2_H
#define MINICOIN_AUTOLYKOS2_H #define SKALACOIN_AUTOLYKOS2_H
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>

View File

@@ -1,12 +1,12 @@
#ifndef MINICOIN_BLAKE2_H #ifndef SKALACOIN_BLAKE2_H
#define MINICOIN_BLAKE2_H #define SKALACOIN_BLAKE2_H
#include <stdbool.h> #include <stdbool.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#define MINICOIN_BLAKE2B_OUTBYTES 64 #define SKALACOIN_BLAKE2B_OUTBYTES 64
#define MINICOIN_BLAKE2S_OUTBYTES 32 #define SKALACOIN_BLAKE2S_OUTBYTES 32
bool Blake2b_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen); bool Blake2b_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen);
bool Blake2s_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen); bool Blake2s_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen);

View File

@@ -16,10 +16,10 @@ struct Autolykos2Context {
void* backend; void* backend;
}; };
#ifdef MINICOIN_AUTOLYKOS2_REF_AVAILABLE #ifdef SKALACOIN_AUTOLYKOS2_REF_AVAILABLE
extern void* minicoin_autolykos2_ref_create(void); extern void* skalacoin_autolykos2_ref_create(void);
extern void minicoin_autolykos2_ref_destroy(void* handle); extern void skalacoin_autolykos2_ref_destroy(void* handle);
extern bool minicoin_autolykos2_ref_check_target( extern bool skalacoin_autolykos2_ref_check_target(
void* handle, void* handle,
const uint8_t message32[32], const uint8_t message32[32],
uint64_t nonce, uint64_t nonce,
@@ -247,8 +247,8 @@ Autolykos2Context* Autolykos2_Create(void) {
return NULL; return NULL;
} }
#ifdef MINICOIN_AUTOLYKOS2_REF_AVAILABLE #ifdef SKALACOIN_AUTOLYKOS2_REF_AVAILABLE
ctx->backend = minicoin_autolykos2_ref_create(); ctx->backend = skalacoin_autolykos2_ref_create();
#endif #endif
return ctx; return ctx;
@@ -259,9 +259,9 @@ void Autolykos2_Destroy(Autolykos2Context* ctx) {
return; return;
} }
#ifdef MINICOIN_AUTOLYKOS2_REF_AVAILABLE #ifdef SKALACOIN_AUTOLYKOS2_REF_AVAILABLE
if (ctx->backend) { if (ctx->backend) {
minicoin_autolykos2_ref_destroy(ctx->backend); skalacoin_autolykos2_ref_destroy(ctx->backend);
ctx->backend = NULL; ctx->backend = NULL;
} }
#endif #endif
@@ -430,9 +430,9 @@ bool Autolykos2_CheckTarget(
return false; return false;
} }
#ifdef MINICOIN_AUTOLYKOS2_REF_AVAILABLE #ifdef SKALACOIN_AUTOLYKOS2_REF_AVAILABLE
if (ctx->backend) { if (ctx->backend) {
const bool ok = minicoin_autolykos2_ref_check_target(ctx->backend, message32, nonce, height, target32); const bool ok = skalacoin_autolykos2_ref_check_target(ctx->backend, message32, nonce, height, target32);
if (Autolykos2_Hash(ctx, message32, 32, nonce, height, outHash)) { if (Autolykos2_Hash(ctx, message32, 32, nonce, height, outHash)) {
return ok; return ok;
} }

View File

@@ -28,27 +28,27 @@ uint32_t calcN(uint32_t Hblock) {
return newN; return newN;
} }
struct minicoin_autolykos2_ref_handle { struct skalacoin_autolykos2_ref_handle {
AutolykosAlg* alg; AutolykosAlg* alg;
}; };
extern "C" void* minicoin_autolykos2_ref_create(void) { extern "C" void* skalacoin_autolykos2_ref_create(void) {
minicoin_autolykos2_ref_handle* h = new minicoin_autolykos2_ref_handle(); skalacoin_autolykos2_ref_handle* h = new skalacoin_autolykos2_ref_handle();
h->alg = new AutolykosAlg(); h->alg = new AutolykosAlg();
return h; return h;
} }
extern "C" void minicoin_autolykos2_ref_destroy(void* handle) { extern "C" void skalacoin_autolykos2_ref_destroy(void* handle) {
if (!handle) { if (!handle) {
return; return;
} }
auto* h = static_cast<minicoin_autolykos2_ref_handle*>(handle); auto* h = static_cast<skalacoin_autolykos2_ref_handle*>(handle);
delete h->alg; delete h->alg;
delete h; delete h;
} }
extern "C" bool minicoin_autolykos2_ref_check_target( extern "C" bool skalacoin_autolykos2_ref_check_target(
void* handle, void* handle,
const uint8_t message32[32], const uint8_t message32[32],
uint64_t nonce, uint64_t nonce,
@@ -59,7 +59,7 @@ extern "C" bool minicoin_autolykos2_ref_check_target(
return false; return false;
} }
auto* h = static_cast<minicoin_autolykos2_ref_handle*>(handle); auto* h = static_cast<skalacoin_autolykos2_ref_handle*>(handle);
if (!h->alg) { if (!h->alg) {
return false; return false;
} }

View File

@@ -42,9 +42,9 @@ static bool Blake2_HashInternal(
} }
bool Blake2b_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen) { bool Blake2b_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen) {
return Blake2_HashInternal(EVP_blake2b512(), MINICOIN_BLAKE2B_OUTBYTES, input, inputLen, out, outLen); return Blake2_HashInternal(EVP_blake2b512(), SKALACOIN_BLAKE2B_OUTBYTES, input, inputLen, out, outLen);
} }
bool Blake2s_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen) { bool Blake2s_Hash(const uint8_t* input, size_t inputLen, uint8_t* out, size_t outLen) {
return Blake2_HashInternal(EVP_blake2s256(), MINICOIN_BLAKE2S_OUTBYTES, input, inputLen, out, outLen); return Blake2_HashInternal(EVP_blake2s256(), SKALACOIN_BLAKE2S_OUTBYTES, input, inputLen, out, outLen);
} }

View File

@@ -52,7 +52,7 @@ static bool GenerateTestMinerIdentity(uint8_t privateKey[32], uint8_t compressed
secp256k1_pubkey pubkey; secp256k1_pubkey pubkey;
for (uint64_t counter = 0; counter < 1024; ++counter) { for (uint64_t counter = 0; counter < 1024; ++counter) {
const char* base = "minicoin-test-miner-key"; const char* base = "skalacoin-test-miner-key";
size_t baseLen = strlen(base); size_t baseLen = strlen(base);
memcpy(seed, base, baseLen); memcpy(seed, base, baseLen);
memcpy(seed + baseLen, &counter, sizeof(counter)); memcpy(seed + baseLen, &counter, sizeof(counter));
@@ -85,7 +85,7 @@ static void MakeTestRecipientAddress(uint8_t outAddress[32]) {
return; return;
} }
const char* label = "minicoin-test-recipient-address"; const char* label = "skalacoin-test-recipient-address";
SHA256((const unsigned char*)label, strlen(label), outAddress); SHA256((const unsigned char*)label, strlen(label), outAddress);
} }