├── .gitattributes
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ └── bug_report.md
├── dependabot.yml
├── stale.yml
└── workflows
│ └── dotnet.yml
├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── build-debian-11.sh
├── build-ubuntu-20.04.sh
├── build-ubuntu-21.04.sh
├── build-ubuntu-22.04.sh
├── build-windows.bat
├── examples
├── callisto_pool.json
├── dash_pool.json
├── dash_pool_no_polling.json
├── digibyte_scrypt_pool.json
├── digibyte_sha256_pool.json
├── ethereum_pool.json
├── flo_pool.json
├── litecoin_dash_pool.json
├── litecoin_pool.json
├── monero_pool.json
├── pakcoin_pool.json
└── zcash_pool.json
├── libs
├── WebSocketManager.Common.dll
├── WebSocketManager.dll
├── ZeroMQ.dll
└── runtimes
│ └── win-x64
│ ├── libcryptonight.dll
│ ├── libcryptonote.dll
│ ├── libethhash.dll
│ ├── libkawpow.dll
│ ├── libmultihash.dll
│ ├── librandomarq.dll
│ ├── librandomx.dll
│ └── libzmq.dll
├── logo.png
├── miningcore.code-workspace
└── src
├── .editorconfig
├── .idea
└── .idea.Miningcore
│ └── .idea
│ ├── .gitignore
│ ├── .name
│ ├── dataSources.xml
│ ├── indexLayout.xml
│ ├── inspectionProfiles
│ └── Project_Default.xml
│ ├── sqldialects.xml
│ └── vcs.xml
├── Miningcore.Tests
├── Banning
│ └── IntegratedBanManagerTests.cs
├── Benchmarks
│ ├── BenchmarkRunner.cs
│ └── Stratum
│ │ └── StratumConnectionBenchmarks.cs
├── Blockchain
│ └── Bitcoin
│ │ └── BitcoinJobTests.cs
├── Coins
│ └── CoinTemplateValidationTest.cs
├── Crypto
│ ├── CryptonightTests.cs
│ ├── CrytonoteTests.cs
│ ├── HashingTests.cs
│ ├── MerkleTreeTests.cs
│ ├── RandomARQTests.cs
│ └── RandomXTests.cs
├── Extensions
│ └── SerializationExtensionsTests.cs
├── Miningcore.Tests.csproj
├── ModuleInitializer.cs
├── Stratum
│ └── StratumConnectionTests.cs
├── TestBase.cs
├── Util
│ ├── Globals.cs
│ ├── MockMasterClock.cs
│ └── PrivateObjectPrivateType.cs
└── xunit.runner.json
├── Miningcore.sln
├── Miningcore.sln.DotSettings
├── Miningcore
├── Api
│ ├── ApiException.cs
│ ├── Controllers
│ │ ├── AdminApiController.cs
│ │ ├── ApiControllerBase.cs
│ │ ├── ClusterApiController.cs
│ │ └── PoolApiController.cs
│ ├── Extensions
│ │ └── MiningPoolExtensions.cs
│ ├── Middlewares
│ │ ├── ApiExceptionHandlingMiddleware.cs
│ │ ├── ApiRequestMetricsMiddleware.cs
│ │ └── IPAccessWhitelistMiddleware.cs
│ ├── NSwagDocumentProcessor.cs
│ ├── Requests
│ │ └── UpdateMinerSettingsRequest.cs
│ ├── Responses
│ │ ├── GetAdminStatsResponse.cs
│ │ ├── GetBalanceChangesResponse.cs
│ │ ├── GetBlocksResponse.cs
│ │ ├── GetMinerSettingsResponse.cs
│ │ ├── GetMinerStatsResponse.cs
│ │ ├── GetPaymentsResponse.cs
│ │ ├── GetPoolResponse.cs
│ │ ├── GetPoolStatsResponse.cs
│ │ ├── GetPoolsResponse.cs
│ │ ├── PagedResultResponse.cs
│ │ └── ResultResponse.cs
│ └── WebSocketNotifications
│ │ ├── NotificationType.cs
│ │ └── WebSocketNotificationsRelay.cs
├── AutoMapperProfile.cs
├── AutofacMetadata.cs
├── AutofacModule.cs
├── Banning
│ ├── Abstractions.cs
│ └── IntegratedBanManager.cs
├── Blockchain
│ ├── Abstractions.cs
│ ├── Bitcoin
│ │ ├── BitcoinConstants.cs
│ │ ├── BitcoinExtraNonceProvider.cs
│ │ ├── BitcoinJob.cs
│ │ ├── BitcoinJobManager.cs
│ │ ├── BitcoinJobManagerBase.cs
│ │ ├── BitcoinPayoutHandler.cs
│ │ ├── BitcoinPool.cs
│ │ ├── BitcoinStratumExtensions.cs
│ │ ├── BitcoinStratumMethods.cs
│ │ ├── BitcoinUtils.cs
│ │ ├── BitcoinWorkerContext.cs
│ │ ├── Configuration
│ │ │ ├── BitcoinDaemonEndpointConfigExtra.cs
│ │ │ ├── BitcoinPoolConfigExtra.cs
│ │ │ └── BitcoinPoolPaymentProcessingConfigExtra.cs
│ │ └── DaemonResponses
│ │ │ ├── Founder.cs
│ │ │ ├── GetAddressInfoResponse.cs
│ │ │ ├── GetBlockResponse.cs
│ │ │ ├── GetBlockTemplateResponse.cs
│ │ │ ├── GetBlockchainInfoResponse.cs
│ │ │ ├── GetInfoResponse.cs
│ │ │ ├── GetMiningInfoResponse.cs
│ │ │ ├── GetNetworkInfoResponse.cs
│ │ │ ├── GetPeerInfoResponse.cs
│ │ │ ├── GetTransactionResponse.cs
│ │ │ ├── Masternode.cs
│ │ │ ├── MinerFund.cs
│ │ │ ├── Payee.cs
│ │ │ ├── Utxo.cs
│ │ │ └── ValidateAddressResponse.cs
│ ├── CoinMetaData.cs
│ ├── Constants.cs
│ ├── Cryptonote
│ │ ├── Configuration
│ │ │ ├── CryptonoteDaemonEndpointConfigExtra.cs
│ │ │ ├── CryptonotePoolConfigExtra.cs
│ │ │ └── CryptonotePoolPaymentProcessingConfigExtra.cs
│ │ ├── CryptonoteConstants.cs
│ │ ├── CryptonoteJob.cs
│ │ ├── CryptonoteJobManager.cs
│ │ ├── CryptonotePayoutHandler.cs
│ │ ├── CryptonotePool.cs
│ │ ├── CryptonoteStratumMethods.cs
│ │ ├── CryptonoteWorkerContext.cs
│ │ ├── CryptonoteWorkerJob.cs
│ │ ├── DaemonRequests
│ │ │ ├── GetBlockHeaderByHashRequest.cs
│ │ │ ├── GetBlockHeaderByHeightRequest.cs
│ │ │ ├── GetBlockTemplateRequest.cs
│ │ │ └── TransferRequest.cs
│ │ ├── DaemonResponses
│ │ │ ├── GetAddressResponse.cs
│ │ │ ├── GetBalanceResponse.cs
│ │ │ ├── GetBlockHeaderResponse.cs
│ │ │ ├── GetBlockTemplateResponse.cs
│ │ │ ├── GetInfoResponse.cs
│ │ │ ├── SplitIntegratedAddressResponse.cs
│ │ │ ├── SubmitResponse.cs
│ │ │ ├── TransferResponse.cs
│ │ │ └── TransferSplitResponse.cs
│ │ ├── StratumRequests
│ │ │ ├── CryptonoteGetJobRequest.cs
│ │ │ ├── CryptonoteLoginRequest.cs
│ │ │ └── CryptonoteSubmitShareRequest.cs
│ │ └── StratumResponses
│ │ │ ├── CryptonoteLoginResponse.cs
│ │ │ └── CryptonoteResponseBase.cs
│ ├── Equihash
│ │ ├── Configuration
│ │ │ └── EquihashPoolConfigExtra.cs
│ │ ├── Custom
│ │ │ ├── BitcoinGold
│ │ │ │ └── BitcoinGoldJob.cs
│ │ │ └── Minexcoin
│ │ │ │ └── MinexcoinJob.cs
│ │ ├── DaemonRequests
│ │ │ └── ZSendMany.cs
│ │ ├── DaemonResponses
│ │ │ ├── GetBlockSubsidyResponse.cs
│ │ │ ├── GetBlockTemplateResponse.cs
│ │ │ ├── ZCashAsyncOperationStatus.cs
│ │ │ └── ZCashShieldingResponse.cs
│ │ ├── EquihashBlockHeader.cs
│ │ ├── EquihashConstants.cs
│ │ ├── EquihashExtraNonceProvider.cs
│ │ ├── EquihashJob.cs
│ │ ├── EquihashJobManager.cs
│ │ ├── EquihashPayoutHandler.cs
│ │ ├── EquihashPool.cs
│ │ ├── EquihashStratumMethods.cs
│ │ └── EquihashUtils.cs
│ ├── Ergo
│ │ ├── Configuration
│ │ │ ├── ErgoDaemonEndpointConfigExtra.cs
│ │ │ ├── ErgoPaymentProcessingConfigExtra.cs
│ │ │ └── ErgoPoolConfigExtra.cs
│ │ ├── ErgoClientExtensions.cs
│ │ ├── ErgoClientFactory.cs
│ │ ├── ErgoConstants.cs
│ │ ├── ErgoExtraNonceProvider.cs
│ │ ├── ErgoJob.cs
│ │ ├── ErgoJobManager.cs
│ │ ├── ErgoPayoutHandler.cs
│ │ ├── ErgoPool.cs
│ │ ├── ErgoWorkerContext.cs
│ │ └── RPC
│ │ │ ├── ErgoClient.cs
│ │ │ └── ergo.nswag
│ ├── Ethereum
│ │ ├── Configuration
│ │ │ ├── EthereumDaemonEndpointConfigExtra.cs
│ │ │ ├── EthereumPoolConfigExtra.cs
│ │ │ └── EthereumPoolPaymentProcessingConfigExtra.cs
│ │ ├── DaemonRequests
│ │ │ └── SendTransactionRequest.cs
│ │ ├── DaemonResponses
│ │ │ ├── GetBlockResponse.cs
│ │ │ ├── GetSyncStateResponse.cs
│ │ │ └── GetTransactionReceiptResponse.cs
│ │ ├── EthereumBlockTemplate.cs
│ │ ├── EthereumConstants.cs
│ │ ├── EthereumExtraNonceProvider.cs
│ │ ├── EthereumJob.cs
│ │ ├── EthereumJobManager.cs
│ │ ├── EthereumPayoutHandler.cs
│ │ ├── EthereumPool.cs
│ │ ├── EthereumStratumMethods.cs
│ │ ├── EthereumUtils.cs
│ │ └── EthereumWorkerContext.cs
│ ├── ExtraNonceProviderBase.cs
│ ├── JobManagerBase.cs
│ └── Share.cs
├── Configuration
│ ├── ClusterConfig.cs
│ ├── ClusterConfigExtensions.cs
│ ├── ClusterConfigValidation.cs
│ └── CoinTemplateLoader.cs
├── Contracts
│ └── Contract.cs
├── Crypto
│ ├── Abstractions.cs
│ ├── HashAlgorithmFactory.cs
│ ├── Hashing
│ │ ├── Algorithms
│ │ │ ├── Blake.cs
│ │ │ ├── Blake2b.cs
│ │ │ ├── Blake2s.cs
│ │ │ ├── DigestReverser.cs
│ │ │ ├── Geek.cs
│ │ │ ├── Ghostrider.cs
│ │ │ ├── Groestl.cs
│ │ │ ├── GroestlMyriad.cs
│ │ │ ├── HeavyHash.cs
│ │ │ ├── Hmq17.cs
│ │ │ ├── Kezzak.cs
│ │ │ ├── Lyra2Rev2.cs
│ │ │ ├── Lyra2Rev3.cs
│ │ │ ├── NeoScrypt.cs
│ │ │ ├── NullHasher.cs
│ │ │ ├── Phi.cs
│ │ │ ├── Qubit.cs
│ │ │ ├── Scrypt.cs
│ │ │ ├── ScryptN.cs
│ │ │ ├── Sha256Csm.cs
│ │ │ ├── Sha256D.cs
│ │ │ ├── Sha256DT.cs
│ │ │ ├── Sha256S.cs
│ │ │ ├── Sha3_256.cs
│ │ │ ├── Sha3_256d.cs
│ │ │ ├── Sha3_512.cs
│ │ │ ├── Sha3_512d.cs
│ │ │ ├── Sha512256D.cs
│ │ │ ├── Skein.cs
│ │ │ ├── Verthash.cs
│ │ │ ├── X11.cs
│ │ │ ├── X13.cs
│ │ │ ├── X13BCD.cs
│ │ │ ├── X16R.cs
│ │ │ ├── X16RV2.cs
│ │ │ ├── X16S.cs
│ │ │ ├── X17.cs
│ │ │ ├── X21s.cs
│ │ │ └── X22i.cs
│ │ ├── Equihash
│ │ │ ├── EquihashSolver.cs
│ │ │ └── EquihashSolverFactory.cs
│ │ └── Ethash
│ │ │ ├── Dag.cs
│ │ │ └── EthashFull.cs
│ └── MerkleTree.cs
├── Extensions
│ ├── ArrayExtensions.cs
│ ├── ConnectionFactoryExtensions.cs
│ ├── DateExtensions.cs
│ ├── DictionaryExtensions.cs
│ ├── HttpContextExtensions.cs
│ ├── IpAddressExtensions.cs
│ ├── MessageBusExtensions.cs
│ ├── NumberExtensions.cs
│ ├── ObservableExtensions.cs
│ ├── PipelineExtensions.cs
│ ├── SerializationExtensions.cs
│ ├── StringExtensions.cs
│ ├── WebSocketExtensions.cs
│ └── ZmqExtensions.cs
├── GitVersion.yml
├── GlobalSuppressions.cs
├── JsonRpc
│ ├── JsonRpcError.cs
│ ├── JsonRpcRequest.cs
│ └── JsonRpcResponse.cs
├── Messaging
│ ├── Abstractions.cs
│ └── MessageBus.cs
├── Mining
│ ├── Abstractions.cs
│ ├── BtStreamReceiver.cs
│ ├── PoolBase.cs
│ ├── PoolStartupException.cs
│ ├── PoolStats.cs
│ ├── ShareReceiver.cs
│ ├── ShareRecorder.cs
│ ├── ShareRelay.cs
│ ├── StatsRecorder.cs
│ ├── StratumShare.cs
│ └── WorkerContextBase.cs
├── Miningcore.csproj
├── Native
│ ├── Cryptonight.cs
│ ├── Cryptonote.cs
│ ├── EthHash.cs
│ ├── KawPow.cs
│ ├── Multihash.cs
│ ├── RandomARQ.cs
│ └── RandomX.cs
├── Nicehash
│ ├── API
│ │ ├── NicehashConstants.cs
│ │ └── NicehashMiningAlgorithms.cs
│ └── NicehashService.cs
├── Notifications
│ ├── Messages
│ │ ├── AdminNotification.cs
│ │ ├── BlockNotification.cs
│ │ ├── BtStreamMessage.cs
│ │ ├── HashrateNotification.cs
│ │ ├── PaymentNotification.cs
│ │ ├── PoolStatusNotification.cs
│ │ └── TelemetryEvent.cs
│ ├── MetricsPublisher.cs
│ └── NotificationService.cs
├── Payments
│ ├── Abstractions.cs
│ ├── PaymentSchemes
│ │ ├── PPLNSPaymentScheme.cs
│ │ ├── PROPPaymentScheme.cs
│ │ └── SOLOPaymentScheme.cs
│ ├── PayoutConstants.cs
│ ├── PayoutHandlerBase.cs
│ └── PayoutManager.cs
├── Persistence
│ ├── Dummy
│ │ └── DummyConnectionFactory.cs
│ ├── IConnectionFactory.cs
│ ├── Model
│ │ ├── Balance.cs
│ │ ├── BalanceChange.cs
│ │ ├── Block.cs
│ │ ├── BlockStatus.cs
│ │ ├── MinerSettings.cs
│ │ ├── MinerWorkerPerformanceStats.cs
│ │ ├── Payment.cs
│ │ ├── PoolStats.cs
│ │ ├── Projections
│ │ │ ├── AmountByDate.cs
│ │ │ ├── MinerStats.cs
│ │ │ └── MinerWorkerHashes.cs
│ │ ├── SampleInterval.cs
│ │ ├── SampleRange.cs
│ │ └── Share.cs
│ ├── Postgres
│ │ ├── Entities
│ │ │ ├── Balance.cs
│ │ │ ├── BalanceChange.cs
│ │ │ ├── Block.cs
│ │ │ ├── MinerSettings.cs
│ │ │ ├── MinerWorkerPerformanceStats.cs
│ │ │ ├── Payment.cs
│ │ │ ├── PoolStats.cs
│ │ │ └── Share.cs
│ │ ├── PgConnectionFactory.cs
│ │ ├── Repositories
│ │ │ ├── BalanceRepository.cs
│ │ │ ├── BlockRepository.cs
│ │ │ ├── MinerRepository.cs
│ │ │ ├── PaymentRepository.cs
│ │ │ ├── ShareRepository.cs
│ │ │ └── StatsRepository.cs
│ │ └── Scripts
│ │ │ ├── cleandb.sql
│ │ │ ├── createdb.sql
│ │ │ ├── createdb_postgresql_11_appendix.sql
│ │ │ └── legacy_timestamp_migration.sql
│ └── Repositories
│ │ ├── IBalanceRepository.cs
│ │ ├── IBlockRepository.cs
│ │ ├── IMinerRepository.cs
│ │ ├── IPaymentRepository.cs
│ │ ├── IShareRepository.cs
│ │ └── IStatsRepository.cs
├── Program.cs
├── Properties
│ ├── PublishProfiles
│ │ └── FolderProfile.pubxml
│ └── launchSettings.json
├── Pushover
│ ├── PushoverClient.cs
│ ├── PushoverConstants.cs
│ ├── PushoverRequest.cs
│ └── PushoverResponse.cs
├── Rest
│ └── SimpleRestClient.cs
├── Rpc
│ ├── RpcClient.cs
│ ├── RpcRequest.cs
│ └── RpcResponse.cs
├── Serialization
│ └── HexToIntegralTypeJsonConverter.cs
├── Stratum
│ ├── StratumConnection.cs
│ ├── StratumEndpoint.cs
│ ├── StratumError.cs
│ └── StratumServer.cs
├── Time
│ ├── Abstractions.cs
│ └── StandardClock.cs
├── Util
│ ├── ActionUtils.cs
│ ├── BigRational.cs
│ ├── CorrelationIdGenerator.cs
│ ├── FormatUtil.cs
│ ├── IPUtils.cs
│ ├── LogUtil.cs
│ ├── ScheduledSubject.cs
│ ├── StaticRandom.cs
│ └── TimingUtils.cs
├── VarDiff
│ ├── VarDiffContext.cs
│ └── VarDiffManager.cs
├── build-libs-linux.sh
├── coins.json
└── config.schema.json
└── Native
├── check_cpu.sh
├── libcryptonight
├── Makefile
├── c29.h
├── c29
│ ├── blake2-impl.h
│ ├── blake2.h
│ ├── blake2b-ref.c
│ ├── int-util.h
│ └── portable_endian.h
├── c29b.cc
├── c29i.cc
├── c29s.cc
├── c29v.cc
├── dllmain.cpp
├── exports.cpp
├── libcryptonight.sln
├── libcryptonight.vcxproj
├── targetver.h
├── xmrig-override
│ ├── backend
│ │ └── cpu
│ │ │ ├── Cpu.cpp
│ │ │ ├── Cpu.h
│ │ │ ├── interfaces
│ │ │ └── ICpuInfo.h
│ │ │ └── platform
│ │ │ ├── BasicCpuInfo.cpp
│ │ │ ├── BasicCpuInfo.h
│ │ │ └── BasicCpuInfo_arm.cpp
│ ├── base
│ │ ├── crypto
│ │ │ └── Algorithm.h
│ │ └── io
│ │ │ └── log
│ │ │ ├── Log.h
│ │ │ └── Tags.h
│ └── crypto
│ │ ├── common
│ │ └── Assembly.h
│ │ ├── ghostrider
│ │ ├── ghostrider.cpp
│ │ └── ghostrider.h
│ │ └── kawpow
│ │ ├── KPHash.cpp
│ │ └── KPHash.h
└── xmrig
│ ├── 3rdparty
│ ├── argon2.h
│ ├── argon2
│ │ ├── CMakeLists.txt
│ │ ├── LICENSE
│ │ ├── README.md
│ │ ├── arch
│ │ │ ├── generic
│ │ │ │ └── lib
│ │ │ │ │ └── argon2-arch.c
│ │ │ └── x86_64
│ │ │ │ ├── lib
│ │ │ │ ├── argon2-arch.c
│ │ │ │ ├── argon2-avx2.c
│ │ │ │ ├── argon2-avx2.h
│ │ │ │ ├── argon2-avx512f.c
│ │ │ │ ├── argon2-avx512f.h
│ │ │ │ ├── argon2-sse2.c
│ │ │ │ ├── argon2-sse2.h
│ │ │ │ ├── argon2-ssse3.c
│ │ │ │ ├── argon2-ssse3.h
│ │ │ │ ├── argon2-template-128.h
│ │ │ │ ├── argon2-xop.c
│ │ │ │ └── argon2-xop.h
│ │ │ │ └── src
│ │ │ │ ├── test-feature-avx2.c
│ │ │ │ ├── test-feature-avx512f.c
│ │ │ │ ├── test-feature-sse2.c
│ │ │ │ ├── test-feature-ssse3.c
│ │ │ │ └── test-feature-xop.c
│ │ ├── include
│ │ │ └── argon2.h
│ │ └── lib
│ │ │ ├── argon2-template-64.h
│ │ │ ├── argon2.c
│ │ │ ├── blake2
│ │ │ ├── blake2-impl.h
│ │ │ ├── blake2.c
│ │ │ └── blake2.h
│ │ │ ├── core.c
│ │ │ ├── core.h
│ │ │ ├── encoding.c
│ │ │ ├── encoding.h
│ │ │ ├── genkat.c
│ │ │ ├── genkat.h
│ │ │ ├── impl-select.c
│ │ │ └── impl-select.h
│ └── libethash
│ │ ├── CMakeLists.txt
│ │ ├── data_sizes.h
│ │ ├── endian.h
│ │ ├── ethash.h
│ │ ├── ethash_internal.c
│ │ ├── ethash_internal.h
│ │ ├── fnv.h
│ │ └── keccakf800.c
│ ├── backend
│ └── common
│ │ └── interfaces
│ │ └── IMemoryPool.h
│ ├── base
│ ├── crypto
│ │ ├── keccak.cpp
│ │ ├── keccak.h
│ │ ├── sha3.cpp
│ │ └── sha3.h
│ └── tools
│ │ ├── Chrono.h
│ │ ├── Object.h
│ │ ├── Profiler.h
│ │ ├── bswap_64.h
│ │ └── cryptonote
│ │ └── umul128.h
│ └── crypto
│ ├── argon2
│ └── Hash.h
│ ├── astrobwt
│ ├── AstroBWT.cpp
│ ├── AstroBWT.h
│ ├── Salsa20.cpp
│ ├── Salsa20.hpp
│ ├── salsa20_ref
│ │ ├── ecrypt-config.h
│ │ ├── ecrypt-machine.h
│ │ ├── ecrypt-portable.h
│ │ ├── ecrypt-sync.h
│ │ └── salsa20.c
│ ├── sha3_256_avx2.S
│ ├── sha3_256_avx2.asm
│ ├── sha3_256_avx2.inc
│ └── sha3_256_keccakf1600_avx2.inc
│ ├── cn
│ ├── CnAlgo.h
│ ├── CnCtx.cpp
│ ├── CnCtx.h
│ ├── CnHash.cpp
│ ├── CnHash.h
│ ├── CryptoNight.h
│ ├── CryptoNight_arm.h
│ ├── CryptoNight_monero.h
│ ├── CryptoNight_test.h
│ ├── CryptoNight_x86.h
│ ├── CryptoNight_x86_vaes.cpp
│ ├── CryptoNight_x86_vaes.h
│ ├── SSE2NEON.h
│ ├── asm
│ │ ├── CryptonightR_soft_aes_template.inc
│ │ ├── CryptonightR_soft_aes_template_win.inc
│ │ ├── CryptonightR_template.S
│ │ ├── CryptonightR_template.asm
│ │ ├── CryptonightR_template.h
│ │ ├── CryptonightR_template.inc
│ │ ├── CryptonightR_template_win.inc
│ │ ├── cn2
│ │ │ ├── cnv2_double_main_loop_sandybridge.inc
│ │ │ ├── cnv2_main_loop_bulldozer.inc
│ │ │ ├── cnv2_main_loop_ivybridge.inc
│ │ │ ├── cnv2_main_loop_ryzen.inc
│ │ │ ├── cnv2_rwz_double_main_loop.inc
│ │ │ ├── cnv2_rwz_main_loop.inc
│ │ │ └── cnv2_upx_double_mainloop_zen3.inc
│ │ ├── cn_main_loop.S
│ │ ├── cn_main_loop.asm
│ │ └── win64
│ │ │ ├── CryptonightR_soft_aes_template_win.inc
│ │ │ ├── CryptonightR_template.asm
│ │ │ ├── CryptonightR_template_win.inc
│ │ │ ├── cn2
│ │ │ ├── cnv2_double_main_loop_sandybridge.inc
│ │ │ ├── cnv2_main_loop_bulldozer.inc
│ │ │ ├── cnv2_main_loop_ivybridge.inc
│ │ │ ├── cnv2_main_loop_ryzen.inc
│ │ │ ├── cnv2_rwz_double_main_loop.inc
│ │ │ ├── cnv2_rwz_main_loop.inc
│ │ │ └── cnv2_upx_double_mainloop_zen3.inc
│ │ │ ├── cn_main_loop.S
│ │ │ └── cn_main_loop.asm
│ ├── c_blake256.c
│ ├── c_blake256.h
│ ├── c_groestl.c
│ ├── c_groestl.h
│ ├── c_jh.c
│ ├── c_jh.h
│ ├── c_skein.c
│ ├── c_skein.h
│ ├── gpu
│ │ ├── cn_gpu_arm.cpp
│ │ ├── cn_gpu_avx.cpp
│ │ └── cn_gpu_ssse3.cpp
│ ├── groestl_tables.h
│ ├── hash.h
│ ├── r
│ │ ├── CryptonightR_gen.cpp
│ │ └── variant4_random_math.h
│ ├── skein_port.h
│ └── soft_aes.h
│ ├── common
│ ├── Assembly.cpp
│ ├── HugePagesInfo.h
│ ├── MemoryPool.cpp
│ ├── MemoryPool.h
│ ├── Nonce.cpp
│ ├── Nonce.h
│ ├── VirtualMemory.cpp
│ ├── VirtualMemory.h
│ ├── VirtualMemory_unix.cpp
│ ├── VirtualMemory_win.cpp
│ └── portable
│ │ └── mm_malloc.h
│ └── ghostrider
│ ├── CMakeLists.txt
│ ├── README.md
│ ├── aes_helper.c
│ ├── md_helper.c
│ ├── sph_blake.c
│ ├── sph_blake.h
│ ├── sph_bmw.c
│ ├── sph_bmw.h
│ ├── sph_cubehash.c
│ ├── sph_cubehash.h
│ ├── sph_echo.c
│ ├── sph_echo.h
│ ├── sph_fugue.c
│ ├── sph_fugue.h
│ ├── sph_groestl.c
│ ├── sph_groestl.h
│ ├── sph_hamsi.c
│ ├── sph_hamsi.h
│ ├── sph_hamsi_helper.c
│ ├── sph_jh.c
│ ├── sph_jh.h
│ ├── sph_keccak.c
│ ├── sph_keccak.h
│ ├── sph_luffa.c
│ ├── sph_luffa.h
│ ├── sph_sha2.c
│ ├── sph_sha2.h
│ ├── sph_shabal.c
│ ├── sph_shabal.h
│ ├── sph_shavite.c
│ ├── sph_shavite.h
│ ├── sph_simd.c
│ ├── sph_simd.h
│ ├── sph_skein.c
│ ├── sph_skein.h
│ ├── sph_types.h
│ ├── sph_whirlpool.c
│ └── sph_whirlpool.h
├── libcryptonote
├── Makefile
├── Makefile.MSys2
├── common
│ ├── base58.cpp
│ ├── base58.h
│ ├── int-util.h
│ ├── pod-class.h
│ ├── util.h
│ └── varint.h
├── contrib
│ └── epee
│ │ ├── LICENSE.txt
│ │ ├── README.md
│ │ └── include
│ │ ├── file_io_utils.h
│ │ ├── fnv1.h
│ │ ├── hex.h
│ │ ├── include_base_utils.h
│ │ ├── int-util.h
│ │ ├── math_helper.h
│ │ ├── memwipe.h
│ │ ├── misc_language.h
│ │ ├── misc_log_ex.h
│ │ ├── misc_os_dependent.h
│ │ ├── mlocker.h
│ │ ├── pragma_comp_defs.h
│ │ ├── serialization
│ │ ├── enableable.h
│ │ ├── keyvalue_serialization.h
│ │ └── keyvalue_serialization_overloads.h
│ │ ├── span.h
│ │ ├── static_initializer.h
│ │ ├── storages
│ │ ├── crypted_storage.h
│ │ ├── gzipped_inmemstorage.h
│ │ ├── http_abstract_invoke.h
│ │ ├── levin_abstract_invoke2.h
│ │ ├── parserse_base_utils.h
│ │ ├── portable_storage.h
│ │ ├── portable_storage_base.h
│ │ ├── portable_storage_bin_utils.h
│ │ ├── portable_storage_from_bin.h
│ │ ├── portable_storage_from_json.h
│ │ ├── portable_storage_template_helper.h
│ │ ├── portable_storage_to_bin.h
│ │ ├── portable_storage_to_json.h
│ │ └── portable_storage_val_converters.h
│ │ ├── string_tools.h
│ │ ├── syncobj.h
│ │ ├── time_helper.h
│ │ ├── warnings.h
│ │ └── wipeable_string.h
├── crypto
│ ├── chacha8.h
│ ├── crypto-ops-data.c
│ ├── crypto-ops.c
│ ├── crypto-ops.h
│ ├── crypto.cpp
│ ├── crypto.h
│ ├── generic-ops.h
│ ├── hash-ops.h
│ ├── hash.c
│ ├── hash.h
│ ├── keccak.c
│ ├── keccak.h
│ ├── random.h
│ └── tree-hash.c
├── cryptonote_config.h
├── cryptonote_core
│ ├── account.h
│ ├── cryptonote_basic.h
│ ├── cryptonote_basic_impl.h
│ ├── cryptonote_format_utils.cpp
│ ├── cryptonote_format_utils.h
│ ├── difficulty.h
│ ├── miner.h
│ └── tx_extra.h
├── cryptonote_protocol
│ ├── blobdatatype.h
│ └── cryptonote_protocol_defs.h
├── exports.cpp
├── mingw_stubs.cpp
├── offshore
│ ├── asset_types.h
│ ├── pricing_record.cpp
│ └── pricing_record.h
├── p2p
│ └── p2p_protocol_defs.h
├── ringct
│ └── rctTypes.h
├── serialization
│ ├── binary_archive.h
│ ├── binary_utils.h
│ ├── crypto.h
│ ├── pricing_record.h
│ ├── serialization.h
│ ├── string.h
│ ├── variant.h
│ └── vector.h
└── targetver.h
├── libethhash
├── Makefile
├── compiler.h
├── data_sizes.h
├── dllmain.cpp
├── endian.h
├── ethash.h
├── exports.cpp
├── fnv.h
├── internal.c
├── internal.h
├── io.c
├── io.h
├── io_posix.c
├── io_win32.c
├── libethhash.sln
├── libethhash.vcxproj
├── mmap.h
├── mmap_win32.c
├── sha3.c
├── sha3.h
├── sha3_cryptopp.cpp
├── sha3_cryptopp.h
├── stdafx.cpp
├── stdafx.h
├── stdint.h
├── targetver.h
├── util.h
├── util_win32.c
└── windows
│ ├── include
│ └── libsodium
│ │ ├── sodium.h
│ │ └── sodium
│ │ ├── core.h
│ │ ├── crypto_aead_aes256gcm.h
│ │ ├── crypto_aead_chacha20poly1305.h
│ │ ├── crypto_aead_xchacha20poly1305.h
│ │ ├── crypto_auth.h
│ │ ├── crypto_auth_hmacsha256.h
│ │ ├── crypto_auth_hmacsha512.h
│ │ ├── crypto_auth_hmacsha512256.h
│ │ ├── crypto_box.h
│ │ ├── crypto_box_curve25519xchacha20poly1305.h
│ │ ├── crypto_box_curve25519xsalsa20poly1305.h
│ │ ├── crypto_core_hchacha20.h
│ │ ├── crypto_core_hsalsa20.h
│ │ ├── crypto_core_salsa20.h
│ │ ├── crypto_core_salsa2012.h
│ │ ├── crypto_core_salsa208.h
│ │ ├── crypto_generichash.h
│ │ ├── crypto_generichash_blake2b.h
│ │ ├── crypto_hash.h
│ │ ├── crypto_hash_sha256.h
│ │ ├── crypto_hash_sha512.h
│ │ ├── crypto_kdf.h
│ │ ├── crypto_kdf_blake2b.h
│ │ ├── crypto_kx.h
│ │ ├── crypto_onetimeauth.h
│ │ ├── crypto_onetimeauth_poly1305.h
│ │ ├── crypto_pwhash.h
│ │ ├── crypto_pwhash_argon2i.h
│ │ ├── crypto_pwhash_argon2id.h
│ │ ├── crypto_pwhash_scryptsalsa208sha256.h
│ │ ├── crypto_scalarmult.h
│ │ ├── crypto_scalarmult_curve25519.h
│ │ ├── crypto_secretbox.h
│ │ ├── crypto_secretbox_xchacha20poly1305.h
│ │ ├── crypto_secretbox_xsalsa20poly1305.h
│ │ ├── crypto_shorthash.h
│ │ ├── crypto_shorthash_siphash24.h
│ │ ├── crypto_sign.h
│ │ ├── crypto_sign_ed25519.h
│ │ ├── crypto_sign_edwards25519sha512batch.h
│ │ ├── crypto_stream.h
│ │ ├── crypto_stream_aes128ctr.h
│ │ ├── crypto_stream_chacha20.h
│ │ ├── crypto_stream_salsa20.h
│ │ ├── crypto_stream_salsa2012.h
│ │ ├── crypto_stream_salsa208.h
│ │ ├── crypto_stream_xchacha20.h
│ │ ├── crypto_stream_xsalsa20.h
│ │ ├── crypto_verify_16.h
│ │ ├── crypto_verify_32.h
│ │ ├── crypto_verify_64.h
│ │ ├── export.h
│ │ ├── randombytes.h
│ │ ├── randombytes_salsa20_random.h
│ │ ├── randombytes_sysrandom.h
│ │ ├── runtime.h
│ │ ├── utils.h
│ │ └── version.h
│ └── lib
│ ├── x64
│ └── libsodium.lib
│ └── x86
│ └── libsodium.lib
├── libkawpow
├── Makefile
├── attributes.h
├── dllmain.cpp
├── ethash
│ ├── CMakeLists.txt
│ ├── bit_manipulation.h
│ ├── builtins.h
│ ├── endianness.hpp
│ ├── ethash-internal.hpp
│ ├── ethash.cpp
│ ├── ethash.h
│ ├── ethash.hpp
│ ├── hash_types.h
│ ├── hash_types.hpp
│ ├── keccak.h
│ ├── keccak.hpp
│ ├── kiss99.hpp
│ ├── managed.cpp
│ ├── primes.c
│ ├── primes.h
│ ├── progpow.cpp
│ ├── progpow.hpp
│ └── version.h
├── exports.cpp
├── keccak
│ ├── CMakeLists.txt
│ ├── keccak.c
│ ├── keccakf1600.c
│ └── keccakf800.c
├── libkawpow.sln
├── liblibkawpow.vcxproj
├── stdafx.cpp
├── stdafx.h
├── support
│ └── attributes.h
└── targetver.h
├── libmultihash
├── KeccakP-800-SnP.h
├── KeccakP-800-reference.c
├── Lyra2.c
├── Lyra2.h
├── Lyra2RE.c
├── Lyra2RE.h
├── Makefile
├── Sponge.c
├── Sponge.h
├── bcrypt.c
├── bcrypt.h
├── blake.c
├── blake.h
├── blake2
│ ├── ref
│ │ ├── blake2-impl.h
│ │ ├── blake2.h
│ │ ├── blake2b-ref.c
│ │ ├── blake2bp-ref.c
│ │ ├── blake2s-ref.c
│ │ ├── blake2sp-ref.c
│ │ ├── blake2xb-ref.c
│ │ ├── blake2xs-ref.c
│ │ ├── genkat-c.c
│ │ ├── genkat-json.c
│ │ └── makefile
│ └── sse
│ │ ├── blake2-config.h
│ │ ├── blake2-impl.h
│ │ ├── blake2.h
│ │ ├── blake2b
│ │ ├── blake2b-load-sse2.h
│ │ ├── blake2b-load-sse41.h
│ │ ├── blake2b-round.h
│ │ ├── blake2b.c
│ │ ├── blake2bp
│ │ ├── blake2bp.c
│ │ ├── blake2s
│ │ ├── blake2s-load-sse2.h
│ │ ├── blake2s-load-sse41.h
│ │ ├── blake2s-load-xop.h
│ │ ├── blake2s-round.h
│ │ ├── blake2s.c
│ │ ├── blake2sp
│ │ ├── blake2sp.c
│ │ ├── blake2xb
│ │ ├── blake2xb.c
│ │ ├── blake2xs
│ │ ├── blake2xs.c
│ │ ├── genkat-c.c
│ │ └── genkat-json.c
├── boolberry.h
├── brg_endian.h
├── c11.c
├── c11.h
├── dcrypt.c
├── dcrypt.h
├── dllmain.cpp
├── equi
│ ├── arith_uint256.cpp
│ ├── arith_uint256.h
│ ├── crypto
│ │ ├── common.h
│ │ ├── equihash.cpp
│ │ ├── equihash.h
│ │ ├── equihash.tcc
│ │ ├── hmac_sha256.cpp
│ │ ├── hmac_sha256.h
│ │ ├── hmac_sha512.cpp
│ │ ├── hmac_sha512.h
│ │ ├── ripemd160.cpp
│ │ ├── ripemd160.h
│ │ ├── sha1.cpp
│ │ ├── sha1.h
│ │ ├── sha256.cpp
│ │ ├── sha256.h
│ │ ├── sha512.cpp
│ │ └── sha512.h
│ ├── equihashverify.cc
│ ├── equihashverify.h
│ ├── random.cpp
│ ├── random.h
│ ├── serialize.h
│ ├── support
│ │ ├── cleanse.cpp
│ │ └── cleanse.h
│ ├── tinyformat.h
│ ├── uint256.cpp
│ ├── uint256.h
│ ├── util.cpp
│ ├── util.h
│ ├── utilstrencodings.cpp
│ └── utilstrencodings.h
├── exports.cpp
├── fresh.c
├── fresh.h
├── fugue.c
├── fugue.h
├── geek.c
├── geek.h
├── groestl.c
├── groestl.h
├── hashodo.h
├── heavyhash
│ ├── heavyhash.c
│ ├── heavyhash.h
│ ├── keccak_tiny.c
│ └── keccak_tiny.h
├── hefty1.c
├── hefty1.h
├── hmq17.c
├── hmq17.h
├── jh.c
├── jh.h
├── keccak.c
├── keccak.h
├── lane.c
├── lane.h
├── libmultihash.sln
├── libmultihash.vcxproj
├── libmultihash.vcxproj.filters
├── neoscrypt.c
├── neoscrypt.h
├── net-core-test
│ ├── Program.cs
│ ├── net-core-test.csproj
│ └── net-core-test.sln
├── nist5.c
├── nist5.h
├── odocrypt.h
├── phi.c
├── phi.h
├── portable_endian.h
├── quark.c
├── quark.h
├── qubit.c
├── qubit.h
├── s3.c
├── s3.h
├── scryptjane.h
├── scryptn.c
├── scryptn.h
├── sha256.h
├── sha256csm.c
├── sha256csm.h
├── sha256dt.c
├── sha256dt.h
├── sha256t.h
├── sha3
│ ├── SWIFFTX.c
│ ├── SWIFFTX.h
│ ├── aes_helper.c
│ ├── extra.c
│ ├── extra.h
│ ├── gost_streebog.c
│ ├── gost_streebog.h
│ ├── hamsi.c
│ ├── hamsi_helper.c
│ ├── haval_helper.c
│ ├── md_helper.c
│ ├── panama.c
│ ├── sm3.c
│ ├── sph_blake.c
│ ├── sph_blake.h
│ ├── sph_blake2s.c
│ ├── sph_blake2s.h
│ ├── sph_bmw.c
│ ├── sph_bmw.h
│ ├── sph_cubehash.c
│ ├── sph_cubehash.h
│ ├── sph_echo.c
│ ├── sph_echo.h
│ ├── sph_fugue.c
│ ├── sph_fugue.h
│ ├── sph_groestl.c
│ ├── sph_groestl.h
│ ├── sph_hamsi.h
│ ├── sph_haval.c
│ ├── sph_haval.h
│ ├── sph_hefty1.c
│ ├── sph_hefty1.h
│ ├── sph_jh.c
│ ├── sph_jh.h
│ ├── sph_keccak.c
│ ├── sph_keccak.h
│ ├── sph_luffa.c
│ ├── sph_luffa.h
│ ├── sph_panama.h
│ ├── sph_sha2.c
│ ├── sph_sha2.h
│ ├── sph_sha2big.c
│ ├── sph_shabal.c
│ ├── sph_shabal.h
│ ├── sph_shavite.c
│ ├── sph_shavite.h
│ ├── sph_simd.c
│ ├── sph_simd.h
│ ├── sph_skein.c
│ ├── sph_skein.h
│ ├── sph_sm3.h
│ ├── sph_tiger.c
│ ├── sph_tiger.h
│ ├── sph_types.h
│ ├── sph_whirlpool.c
│ └── sph_whirlpool.h
├── sha512_256.c
├── sha512_256.h
├── shavite3.c
├── shavite3.h
├── skein.c
├── skein.h
├── stdafx.cpp
├── stdafx.h
├── stdint.h
├── targetver.h
├── verthash
│ ├── h2.c
│ ├── h2.h
│ └── tiny_sha3
│ │ ├── LICENSE
│ │ ├── sha3.c
│ │ └── sha3.h
├── windows
│ ├── include
│ │ └── libsodium
│ │ │ ├── sodium.h
│ │ │ └── sodium
│ │ │ ├── core.h
│ │ │ ├── crypto_aead_aes256gcm.h
│ │ │ ├── crypto_aead_chacha20poly1305.h
│ │ │ ├── crypto_aead_xchacha20poly1305.h
│ │ │ ├── crypto_auth.h
│ │ │ ├── crypto_auth_hmacsha256.h
│ │ │ ├── crypto_auth_hmacsha512.h
│ │ │ ├── crypto_auth_hmacsha512256.h
│ │ │ ├── crypto_box.h
│ │ │ ├── crypto_box_curve25519xchacha20poly1305.h
│ │ │ ├── crypto_box_curve25519xsalsa20poly1305.h
│ │ │ ├── crypto_core_hchacha20.h
│ │ │ ├── crypto_core_hsalsa20.h
│ │ │ ├── crypto_core_salsa20.h
│ │ │ ├── crypto_core_salsa2012.h
│ │ │ ├── crypto_core_salsa208.h
│ │ │ ├── crypto_generichash.h
│ │ │ ├── crypto_generichash_blake2b.h
│ │ │ ├── crypto_hash.h
│ │ │ ├── crypto_hash_sha256.h
│ │ │ ├── crypto_hash_sha512.h
│ │ │ ├── crypto_kdf.h
│ │ │ ├── crypto_kdf_blake2b.h
│ │ │ ├── crypto_kx.h
│ │ │ ├── crypto_onetimeauth.h
│ │ │ ├── crypto_onetimeauth_poly1305.h
│ │ │ ├── crypto_pwhash.h
│ │ │ ├── crypto_pwhash_argon2i.h
│ │ │ ├── crypto_pwhash_argon2id.h
│ │ │ ├── crypto_pwhash_scryptsalsa208sha256.h
│ │ │ ├── crypto_scalarmult.h
│ │ │ ├── crypto_scalarmult_curve25519.h
│ │ │ ├── crypto_secretbox.h
│ │ │ ├── crypto_secretbox_xchacha20poly1305.h
│ │ │ ├── crypto_secretbox_xsalsa20poly1305.h
│ │ │ ├── crypto_shorthash.h
│ │ │ ├── crypto_shorthash_siphash24.h
│ │ │ ├── crypto_sign.h
│ │ │ ├── crypto_sign_ed25519.h
│ │ │ ├── crypto_sign_edwards25519sha512batch.h
│ │ │ ├── crypto_stream.h
│ │ │ ├── crypto_stream_aes128ctr.h
│ │ │ ├── crypto_stream_chacha20.h
│ │ │ ├── crypto_stream_salsa20.h
│ │ │ ├── crypto_stream_salsa2012.h
│ │ │ ├── crypto_stream_salsa208.h
│ │ │ ├── crypto_stream_xchacha20.h
│ │ │ ├── crypto_stream_xsalsa20.h
│ │ │ ├── crypto_verify_16.h
│ │ │ ├── crypto_verify_32.h
│ │ │ ├── crypto_verify_64.h
│ │ │ ├── export.h
│ │ │ ├── randombytes.h
│ │ │ ├── randombytes_salsa20_random.h
│ │ │ ├── randombytes_sysrandom.h
│ │ │ ├── runtime.h
│ │ │ ├── utils.h
│ │ │ └── version.h
│ └── lib
│ │ ├── x64
│ │ └── libsodium.lib
│ │ └── x86
│ │ └── libsodium.lib
├── x11.c
├── x11.h
├── x13.c
├── x13.h
├── x14.c
├── x14.h
├── x15.c
├── x15.h
├── x16r.c
├── x16r.h
├── x16rv2.c
├── x16rv2.h
├── x16s.c
├── x16s.h
├── x17.c
├── x17.h
├── x21s.c
├── x21s.h
├── x22i.c
└── x22i.h
├── librandomarq
└── Makefile
└── librandomx
└── Makefile
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | github: [oliverw]
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/src/Miningcore"
5 | schedule:
6 | interval: monthly
7 | open-pull-requests-limit: 10
8 | target-branch: dev
9 |
--------------------------------------------------------------------------------
/.github/stale.yml:
--------------------------------------------------------------------------------
1 | # Number of days of inactivity before an issue becomes stale
2 | daysUntilStale: 60
3 | # Number of days of inactivity before a stale issue is closed
4 | daysUntilClose: 7
5 | # Issues with these labels will never be considered stale
6 | exemptLabels:
7 | - pinned
8 | - security
9 | # Label to use when marking an issue as stale
10 | staleLabel: wontfix
11 | # Comment to post when marking an issue as stale. Set to `false` to disable
12 | markComment: >
13 | This issue has been automatically marked as stale because it has not had
14 | recent activity. It will be closed if no further activity occurs. Thank you
15 | for your contributions.
16 | # Comment to post when closing a stale issue. Set to `false` to disable
17 | closeComment: false
18 |
--------------------------------------------------------------------------------
/.github/workflows/dotnet.yml:
--------------------------------------------------------------------------------
1 | name: .NET
2 |
3 | on:
4 | push:
5 | branches: [ master, dev ]
6 | pull_request:
7 | branches: [ master, dev ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - name: Checkout
16 | uses: actions/checkout@v2
17 | with:
18 | fetch-depth: 0
19 | - name: Install Build dependencies
20 | run: sudo apt-get install -y cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
21 | - name: Setup .NET
22 | uses: actions/setup-dotnet@v1
23 | with:
24 | dotnet-version: 6.0.x
25 | - name: Restore dependencies
26 | run: dotnet restore src
27 | - name: Build
28 | run: dotnet build --no-restore src
29 | - name: Test
30 | run: dotnet test --logger:"console;verbosity=detailed" --no-build --verbosity normal src
31 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mcr.microsoft.com/dotnet/sdk:6.0-jammy as BUILDER
2 | WORKDIR /app
3 | RUN apt-get update && \
4 | apt-get -y install cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5 libzmq3-dev golang-go
5 | COPY . .
6 | WORKDIR /app/src/Miningcore
7 | RUN dotnet publish -c Release --framework net6.0 -o ../../build
8 |
9 | FROM mcr.microsoft.com/dotnet/aspnet:6.0-jammy
10 | WORKDIR /app
11 | RUN apt-get update && \
12 | apt-get install -y libzmq5 libzmq3-dev libsodium-dev curl && \
13 | apt-get clean
14 | EXPOSE 4000-4090
15 | COPY --from=BUILDER /app/build ./
16 | CMD ["./Miningcore", "-c", "config.json" ]
17 |
--------------------------------------------------------------------------------
/build-debian-11.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # install install-dependencies
4 | sudo apt-get update; \
5 | sudo apt-get -y install wget
6 |
7 | # add dotnet repo
8 | sudo wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
9 | sudo dpkg -i packages-microsoft-prod.deb
10 | rm packages-microsoft-prod.deb
11 |
12 | # install dev-dependencies
13 | sudo apt-get update; \
14 | sudo apt-get -y install dotnet-sdk-6.0 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5-dev
15 |
16 | (cd src/Miningcore && \
17 | BUILDIR=${1:-../../build} && \
18 | echo "Building into $BUILDIR" && \
19 | dotnet publish -c Release --framework net6.0 -o $BUILDIR)
20 |
--------------------------------------------------------------------------------
/build-ubuntu-20.04.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # install install-dependencies
4 | sudo apt-get update; \
5 | sudo apt-get -y install wget
6 |
7 | # add dotnet repo
8 | wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
9 | sudo dpkg -i packages-microsoft-prod.deb
10 | rm packages-microsoft-prod.deb
11 |
12 | # install dev-dependencies
13 | sudo apt-get update; \
14 | sudo apt-get -y install dotnet-sdk-6.0 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
15 |
16 | (cd src/Miningcore && \
17 | BUILDIR=${1:-../../build} && \
18 | echo "Building into $BUILDIR" && \
19 | dotnet publish -c Release --framework net6.0 -o $BUILDIR)
20 |
--------------------------------------------------------------------------------
/build-ubuntu-21.04.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # install install-dependencies
4 | sudo apt-get update; \
5 | sudo apt-get -y install wget
6 |
7 | # add dotnet repo
8 | wget https://packages.microsoft.com/config/ubuntu/21.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
9 | sudo dpkg -i packages-microsoft-prod.deb
10 | rm packages-microsoft-prod.deb
11 |
12 | # install dev-dependencies
13 | sudo apt-get update; \
14 | sudo apt-get -y install dotnet-sdk-6.0 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
15 |
16 | (cd src/Miningcore && \
17 | BUILDIR=${1:-../../build} && \
18 | echo "Building into $BUILDIR" && \
19 | dotnet publish -c Release --framework net6.0 -o $BUILDIR)
20 |
--------------------------------------------------------------------------------
/build-ubuntu-22.04.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # dotnet 6 or higher is included in Ubuntu 22.04 and up
4 |
5 | # install dev-dependencies
6 | sudo apt-get update; \
7 | sudo apt-get -y install dotnet-sdk-6.0 git cmake build-essential libssl-dev pkg-config libboost-all-dev libsodium-dev libzmq5
8 |
9 | (cd src/Miningcore && \
10 | BUILDIR=${1:-../../build} && \
11 | echo "Building into $BUILDIR" && \
12 | dotnet publish -c Release --framework net6.0 -o $BUILDIR)
13 |
--------------------------------------------------------------------------------
/build-windows.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | cd src\Miningcore
3 | dotnet publish -c Release --framework net6.0 -o ../../build
4 |
--------------------------------------------------------------------------------
/libs/WebSocketManager.Common.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/WebSocketManager.Common.dll
--------------------------------------------------------------------------------
/libs/WebSocketManager.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/WebSocketManager.dll
--------------------------------------------------------------------------------
/libs/ZeroMQ.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/ZeroMQ.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libcryptonight.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libcryptonight.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libcryptonote.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libcryptonote.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libethhash.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libethhash.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libkawpow.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libkawpow.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libmultihash.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libmultihash.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/librandomarq.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/librandomarq.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/librandomx.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/librandomx.dll
--------------------------------------------------------------------------------
/libs/runtimes/win-x64/libzmq.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/libs/runtimes/win-x64/libzmq.dll
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/logo.png
--------------------------------------------------------------------------------
/miningcore.code-workspace:
--------------------------------------------------------------------------------
1 | {
2 | "folders": [
3 | {
4 | "path": "."
5 | }
6 | ],
7 | "settings": {}
8 | }
--------------------------------------------------------------------------------
/src/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | # Unix-style newlines with a newline ending every file
4 | [*]
5 | end_of_line = lf
6 | insert_final_newline = true
7 | charset = utf-8
8 | indent_style = space
9 | indent_size = 4
10 | trim_trailing_whitespace = true
11 |
12 | # ReSharper properties
13 | resharper_continuous_indent_multiplier = 1
14 | resharper_csharp_indent_size = 4
15 |
16 | [*.cs]
17 | csharp_space_after_cast = true
18 | csharp_space_after_keywords_in_control_flow_statements = false
19 | csharp_space_between_method_declaration_parameter_list_parentheses = false
20 | csharp_space_between_method_call_parameter_list_parentheses = false
21 | csharp_space_around_binary_operators = true
22 | indent_style = space
23 | indent_size = 4
24 | tab_width = 4
25 |
26 | # Tab indentation (no size specified)
27 | [Makefile]
28 | indent_style = tab
29 |
30 | # Matches the exact files either package.json or .travis.yml
31 | [{package.json,.travis.yml}]
32 | indent_style = space
33 | indent_size = 2
34 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/.gitignore:
--------------------------------------------------------------------------------
1 | # Default ignored files
2 | /shelf/
3 | /workspace.xml
4 | # Rider ignored files
5 | /modules.xml
6 | /contentModel.xml
7 | /projectSettingsUpdater.xml
8 | /.idea.Miningcore.iml
9 | # Editor-based HTTP Client requests
10 | /httpRequests/
11 | # Datasource local storage ignored files
12 | /dataSources/
13 | /dataSources.local.xml
14 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/.name:
--------------------------------------------------------------------------------
1 | Miningcore
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/dataSources.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | postgresql
6 | true
7 | org.postgresql.Driver
8 | jdbc:postgresql://localhost:5432/postgres
9 | $ProjectFileDir$
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/indexLayout.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/inspectionProfiles/Project_Default.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/sqldialects.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/.idea/.idea.Miningcore/.idea/vcs.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/Miningcore.Tests/TestBase.cs:
--------------------------------------------------------------------------------
1 | using Autofac;
2 | using Newtonsoft.Json;
3 |
4 | namespace Miningcore.Tests;
5 |
6 | public abstract class TestBase
7 | {
8 | protected TestBase()
9 | {
10 | ModuleInitializer.Initialize();
11 |
12 | container = ModuleInitializer.Container;
13 | jsonSerializerSettings = container.Resolve();
14 | }
15 |
16 | protected readonly IContainer container;
17 | protected readonly JsonSerializerSettings jsonSerializerSettings;
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore.Tests/Util/Globals.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Serialization;
3 |
4 | namespace Miningcore.Tests.Util;
5 |
6 | public class Globals
7 | {
8 | public static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings
9 | {
10 | ContractResolver = new CamelCasePropertyNamesContractResolver()
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore.Tests/Util/MockMasterClock.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Miningcore.Time;
3 |
4 | namespace Miningcore.Tests.Util;
5 |
6 | public class MockMasterClock : IMasterClock
7 | {
8 | public DateTime CurrentTime { get; set; }
9 |
10 | public DateTime Now => CurrentTime;
11 |
12 | public static MockMasterClock FromTicks(long value)
13 | {
14 | return new MockMasterClock
15 | {
16 | CurrentTime = new DateTime(value, DateTimeKind.Utc)
17 | };
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore.Tests/xunit.runner.json:
--------------------------------------------------------------------------------
1 | {
2 | "methodDisplay": "method"
3 | }
4 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/ApiException.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Miningcore.Api;
4 |
5 | class ApiException : Exception
6 | {
7 | public ApiException(string message, HttpStatusCode? responseStatusCode = null) : base(message)
8 | {
9 | if(responseStatusCode.HasValue)
10 | ResponseStatusCode = (int) responseStatusCode.Value;
11 | }
12 |
13 | public ApiException(HttpStatusCode responseStatusCode) : base(string.Empty)
14 | {
15 | ResponseStatusCode = (int) responseStatusCode;
16 | }
17 |
18 | public ApiException()
19 | {
20 | }
21 |
22 | public int? ResponseStatusCode { get; }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Requests/UpdateMinerSettingsRequest.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Api.Responses;
2 |
3 | namespace Miningcore.Api.Requests;
4 |
5 | public class UpdateMinerSettingsRequest
6 | {
7 | public string IpAddress { get; set; }
8 | public MinerSettings Settings { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetAdminStatsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class AdminGcStats
4 | {
5 | ///
6 | /// Number of Generation 0 collections
7 | ///
8 | public int GcGen0 { get; set; }
9 |
10 | ///
11 | /// Number of Generation 1 collections
12 | ///
13 | public int GcGen1 { get; set; }
14 |
15 | ///
16 | /// Number of Generation 2 collections
17 | ///
18 | public int GcGen2 { get; set; }
19 |
20 | ///
21 | /// Assumed amount of allocated memory
22 | ///
23 | public string MemAllocated { get; set; }
24 |
25 | ///
26 | /// Maximum time in seconds spent in full GC
27 | ///
28 | public double MaxFullGcDuration { get; set; } = 0;
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetBalanceChangesResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class BalanceChange
4 | {
5 | public string PoolId { get; set; }
6 | public string Address { get; set; }
7 | public decimal Amount { get; set; }
8 | public string Usage { get; set; }
9 | public DateTime Created { get; set; }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetBlocksResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class Block
4 | {
5 | public string PoolId { get; set; }
6 | public ulong BlockHeight { get; set; }
7 | public double NetworkDifficulty { get; set; }
8 | public string Status { get; set; }
9 | public string Type { get; set; }
10 | public double ConfirmationProgress { get; set; }
11 | public double? Effort { get; set; }
12 | public string TransactionConfirmationData { get; set; }
13 | public decimal Reward { get; set; }
14 | public string InfoLink { get; set; }
15 | public string Hash { get; set; }
16 | public string Miner { get; set; }
17 | public string Source { get; set; }
18 | public DateTime Created { get; set; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetMinerSettingsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class MinerSettings
4 | {
5 | public decimal PaymentThreshold { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetPaymentsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class Payment
4 | {
5 | public string Coin { get; set; }
6 | public string Address { get; set; }
7 | public string AddressInfoLink { get; set; }
8 | public decimal Amount { get; set; }
9 | public string TransactionConfirmationData { get; set; }
10 | public string TransactionInfoLink { get; set; }
11 | public DateTime Created { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetPoolResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class GetPoolResponse
4 | {
5 | public PoolInfo Pool { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/GetPoolStatsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public partial class AggregatedPoolStats
4 | {
5 | public float PoolHashrate { get; set; }
6 | public int ConnectedMiners { get; set; }
7 | public int ValidSharesPerSecond { get; set; }
8 | public double NetworkHashrate { get; set; }
9 | public double NetworkDifficulty { get; set; }
10 |
11 | public DateTime Created { get; set; }
12 | }
13 |
14 | public class GetPoolStatsResponse
15 | {
16 | public AggregatedPoolStats[] Stats { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/PagedResultResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class PagedResultResponse : ResultResponse
4 | {
5 | public PagedResultResponse(T result, uint pageCount) : base(result)
6 | {
7 | PageCount = pageCount;
8 | }
9 |
10 | public uint PageCount { get; private set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/Responses/ResultResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.Responses;
2 |
3 | public class ResultResponse
4 | {
5 | public ResultResponse(T result)
6 | {
7 | Result = result;
8 | Success = result != null;
9 | }
10 |
11 | public ResultResponse()
12 | {
13 | Success = true;
14 | }
15 |
16 | public T Result { get; set; }
17 | public bool Success { get; set; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Api/WebSocketNotifications/NotificationType.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Api.WebSocketNotifications;
2 |
3 | public enum WsNotificationType
4 | {
5 | Greeting,
6 | BlockFound,
7 | NewChainHeight,
8 | Payment,
9 | BlockUnlocked,
10 | BlockUnlockProgress,
11 | HashrateUpdated
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/AutofacMetadata.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 |
3 | namespace Miningcore;
4 |
5 | public class CoinFamilyAttribute : Attribute
6 | {
7 | public CoinFamilyAttribute(IDictionary values)
8 | {
9 | if(values.ContainsKey(nameof(SupportedFamilies)))
10 | SupportedFamilies = (CoinFamily[]) values[nameof(SupportedFamilies)];
11 | }
12 |
13 | public CoinFamilyAttribute(params CoinFamily[] supportedFamilies)
14 | {
15 | SupportedFamilies = supportedFamilies;
16 | }
17 |
18 | public CoinFamily[] SupportedFamilies { get; }
19 | }
20 |
21 | public class IdentifierAttribute : Attribute
22 | {
23 | public IdentifierAttribute(string name)
24 | {
25 | Name = name;
26 | }
27 |
28 | public string Name { get; }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Banning/Abstractions.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Miningcore.Banning;
4 |
5 | public interface IBanManager
6 | {
7 | bool IsBanned(IPAddress address);
8 | void Ban(IPAddress address, TimeSpan duration);
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Abstractions.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain;
2 |
3 | public class BlockchainStats
4 | {
5 | public string NetworkType { get; set; }
6 | public double NetworkHashrate { get; set; }
7 | public double NetworkDifficulty { get; set; }
8 | public string NextNetworkTarget { get; set; }
9 | public string NextNetworkBits { get; set; }
10 | public DateTime? LastNetworkBlockTime { get; set; }
11 | public ulong BlockHeight { get; set; }
12 | public int ConnectedPeers { get; set; }
13 | public string RewardType { get; set; }
14 | }
15 |
16 | public interface IExtraNonceProvider
17 | {
18 | int ByteSize { get; }
19 | string Next();
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/BitcoinExtraNonceProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin;
2 |
3 | public class BitcoinExtraNonceProvider : ExtraNonceProviderBase
4 | {
5 | public BitcoinExtraNonceProvider(string poolId, byte? clusterInstanceId) : base(poolId, 4, clusterInstanceId)
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/BitcoinStratumExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin;
2 |
3 | ///
4 | /// The client uses the message to advertise its features and to request/allow some protocol extensions.
5 | /// https://github.com/slushpool/stratumprotocol/blob/master/stratum-extensions.mediawiki#Request_miningconfigure
6 | ///
7 | public class BitcoinStratumExtensions
8 | {
9 | public const string VersionRolling = "version-rolling";
10 | public const string MinimumDiff = "minimum-difficulty";
11 | public const string SubscribeExtranonce = "subscribe-extranonce";
12 |
13 | public const string VersionRollingMask = VersionRolling + "." + "mask";
14 | public const string VersionRollingBits = VersionRolling + "." + "min-bit-count";
15 |
16 | public const string MinimumDiffValue = MinimumDiff + "." + "value";
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/BitcoinWorkerContext.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Mining;
2 |
3 | namespace Miningcore.Blockchain.Bitcoin;
4 |
5 | public class BitcoinWorkerContext : WorkerContextBase
6 | {
7 | ///
8 | /// Usually a wallet address
9 | ///
10 | public string Miner { get; set; }
11 |
12 | ///
13 | /// Arbitrary worker identififer for miners using multiple rigs
14 | ///
15 | public string Worker { get; set; }
16 |
17 | ///
18 | /// Unique value assigned per worker
19 | ///
20 | public string ExtraNonce1 { get; set; }
21 |
22 | ///
23 | /// Mask for version-rolling (Overt ASIC-Boost)
24 | ///
25 | public uint? VersionRollingMask { get; internal set; }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/Configuration/BitcoinDaemonEndpointConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.Configuration;
2 |
3 | public class BitcoinDaemonEndpointConfigExtra
4 | {
5 | public int? MinimumConfirmations { get; set; }
6 |
7 | ///
8 | /// Address of ZeroMQ block notify socket
9 | /// Should match the value of -zmqpubhashblock daemon start parameter
10 | ///
11 | public string ZmqBlockNotifySocket { get; set; }
12 |
13 | ///
14 | /// Optional: ZeroMQ block notify topic
15 | /// Defaults to "hashblock" if left blank
16 | ///
17 | public string ZmqBlockNotifyTopic { get; set; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/Configuration/BitcoinPoolPaymentProcessingConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.Configuration;
2 |
3 | public class BitcoinPoolPaymentProcessingConfigExtra
4 | {
5 | ///
6 | /// Wallet Password if the daemon is running with an encrypted wallet (used for unlocking wallet during payment processing)
7 | ///
8 | public string WalletPassword { get; set; }
9 |
10 | ///
11 | /// if True, miners pay payment tx fees
12 | ///
13 | public bool MinersPayTxFees { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Founder.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses
5 | {
6 | public class Founder
7 | {
8 | public string Payee { get; set; }
9 | public string Script { get; set; }
10 | public long Amount { get; set; }
11 | }
12 |
13 | public class FounderBlockTemplateExtra
14 | {
15 | public JToken Founder { get; set; }
16 |
17 | [JsonProperty("founder_payments_started")]
18 | public bool FounderPaymentsStarted { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetAddressInfoResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
4 |
5 | public class AddressInfo
6 | {
7 | [JsonProperty("address")]
8 | public string Address { get; set; }
9 |
10 | [JsonProperty("scriptPubKey")]
11 | public string ScriptPubKey { get; set; }
12 |
13 | [JsonProperty("ismine")]
14 | public bool IsMine { get; set; }
15 |
16 | [JsonProperty("iswatchonly")]
17 | public bool IsWatchOnly { get; set; }
18 |
19 | [JsonProperty("isscript")]
20 | public bool IsScript { get; set; }
21 |
22 | [JsonProperty("ischange")]
23 | public bool IsChange { get; set; }
24 |
25 | [JsonProperty("iswitness")]
26 | public bool IsWitness { get; set; }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetBlockResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
4 |
5 | public class Block
6 | {
7 | public uint Version { get; set; }
8 | public string Hash { get; set; }
9 | public string PreviousBlockhash { get; set; }
10 | public ulong Time { get; set; }
11 | public uint Height { get; set; }
12 | public string Bits { get; set; }
13 | public double Difficulty { get; set; }
14 | public string Nonce { get; set; }
15 | public uint Weight { get; set; }
16 | public uint Size { get; set; }
17 | public int Confirmations { get; set; }
18 |
19 | [JsonProperty("tx")]
20 | public string[] Transactions { get; set; }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetBlockchainInfoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class BlockchainInfo
4 | {
5 | public string Chain { get; set; }
6 | public int Blocks { get; set; }
7 | public int Headers { get; set; }
8 | public string BestBlockHash { get; set; }
9 | public double Difficulty { get; set; }
10 | public long MedianTime { get; set; }
11 | public double VerificationProgress { get; set; }
12 | public bool Pruned { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetInfoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class DaemonInfo
4 | {
5 | public string Version { get; set; }
6 | public int ProtocolVersion { get; set; }
7 | public int WalletVersion { get; set; }
8 | public decimal Balance { get; set; }
9 | public ulong Blocks { get; set; }
10 | public bool Testnet { get; set; }
11 | public int Connections { get; set; }
12 | public double Difficulty { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetMiningInfoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class MiningInfo
4 | {
5 | public int Blocks { get; set; }
6 | public int CurrentBlockSize { get; set; }
7 | public int CurrentBlockWeight { get; set; }
8 | public double Difficulty { get; set; }
9 | public double NetworkHashps { get; set; }
10 | public string Chain { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetNetworkInfoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class NetworkInfo
4 | {
5 | public string Version { get; set; }
6 | public string SubVersion { get; set; }
7 | public int ProtocolVersion { get; set; }
8 | public bool LocalRelay { get; set; }
9 | public bool NetworkActive { get; set; }
10 | public int Connections { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/GetPeerInfoResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class PeerInfo
4 | {
5 | public int Id { get; set; }
6 | public string Addr { get; set; }
7 | public int Version { get; set; }
8 | public string SubVer { get; set; }
9 | public int Blocks { get; set; }
10 | public int StartingHeight { get; set; }
11 | public int TimeOffset { get; set; }
12 | public double BanScore { get; set; }
13 | public int ConnTime { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/MinerFund.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses
5 | {
6 | public class MinerFundTemplateExtra
7 | {
8 | public string[] Addresses { get; set; }
9 | public ulong MinimumValue { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Payee.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
4 |
5 | public class PayeeBlockTemplateExtra
6 | {
7 | public string Payee { get; set; }
8 |
9 | [JsonProperty("payee_amount")]
10 | public long? PayeeAmount { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/Utxo.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class Utxo
4 | {
5 | public string TxId { get; set; }
6 | public int Vout { get; set; }
7 | public string Address { get; set; }
8 | public decimal Amount { get; set; }
9 | public string ScriptPubKey { get; set; }
10 | public int Confirmations { get; set; }
11 | public bool Spendable { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Bitcoin/DaemonResponses/ValidateAddressResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Bitcoin.DaemonResponses;
2 |
3 | public class ValidateAddressResponse
4 | {
5 | public bool IsValid { get; set; }
6 | public bool IsMine { get; set; }
7 | public bool IsWatchOnly { get; set; }
8 | public bool IsScript { get; set; }
9 | public string Address { get; set; }
10 | public string PubKey { get; set; }
11 | public string ScriptPubKey { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/CoinMetaData.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain;
2 |
3 | public static class CoinMetaData
4 | {
5 | public const string BlockHeightPH = "$height$";
6 | public const string BlockHashPH = "$hash$";
7 | }
8 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Constants.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain;
2 |
3 | public static class JobRefreshBy
4 | {
5 | public const string Initial = "INIT";
6 | public const string Poll = "POLL";
7 | public const string PollRefresh = "POLL-R";
8 | public const string PubSub = "ZMQ";
9 | public const string BlockTemplateStream = "BTS";
10 | public const string BlockTemplateStreamRefresh = "BTS-R";
11 | public const string WebSocket = "WS";
12 | public const string BlockFound = "BLOCK";
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/Configuration/CryptonoteDaemonEndpointConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.Configuration;
2 |
3 | public class CryptonoteDaemonEndpointConfigExtra
4 | {
5 | ///
6 | /// Address of ZeroMQ block notify socket
7 | /// Should match the value of -zmqpubhashblock daemon start parameter
8 | ///
9 | public string ZmqBlockNotifySocket { get; set; }
10 |
11 | ///
12 | /// Optional: ZeroMQ block notify topic
13 | /// Defaults to "hashblock" if left blank
14 | ///
15 | public string ZmqBlockNotifyTopic { get; set; }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/Configuration/CryptonotePoolPaymentProcessingConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.Configuration;
2 |
3 | public class CryptonotePoolPaymentProcessingConfigExtra
4 | {
5 | public decimal MinimumPaymentToPaymentId { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/CryptonoteStratumMethods.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote;
2 |
3 | public class CryptonoteStratumMethods
4 | {
5 | ///
6 | /// Used to subscribe to work
7 | ///
8 | public const string Login = "login";
9 |
10 | ///
11 | /// New job notification
12 | ///
13 | public const string JobNotify = "job";
14 |
15 | ///
16 | /// Get Job request
17 | ///
18 | public const string GetJob = "getjob";
19 |
20 | ///
21 | /// Submit share request
22 | ///
23 | public const string Submit = "submit";
24 |
25 | ///
26 | /// Keep alive request
27 | ///
28 | public const string KeepAlive = "keepalived";
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/CryptonoteWorkerJob.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Concurrent;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote;
4 |
5 | public class CryptonoteWorkerJob
6 | {
7 | public CryptonoteWorkerJob(string jobId, double difficulty)
8 | {
9 | Id = jobId;
10 | Difficulty = difficulty;
11 | }
12 |
13 | public string Id { get; }
14 | public uint Height { get; set; }
15 | public uint ExtraNonce { get; set; }
16 | public double Difficulty { get; set; }
17 | public string SeedHash { get; set; }
18 |
19 | public readonly ConcurrentDictionary Submissions = new(StringComparer.OrdinalIgnoreCase);
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonRequests/GetBlockHeaderByHashRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.DaemonRequests;
2 |
3 | public class GetBlockHeaderByHashRequest
4 | {
5 | public string Hash { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonRequests/GetBlockHeaderByHeightRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.DaemonRequests;
2 |
3 | public class GetBlockHeaderByHeightRequest
4 | {
5 | public ulong Height { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonRequests/GetBlockTemplateRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.DaemonRequests;
4 |
5 | public class GetBlockTemplateRequest
6 | {
7 | ///
8 | /// Address of wallet to receive coinbase transactions if block is successfully mined.
9 | ///
10 | [JsonProperty("wallet_address")]
11 | public string WalletAddress { get; set; }
12 |
13 | [JsonProperty("reserve_size")]
14 | public uint ReserveSize { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/GetAddressResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
2 |
3 | public class GetAddressResponse
4 | {
5 | public string Address { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/GetBalanceResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
4 |
5 | public class GetBalanceResponse
6 | {
7 | public decimal Balance { get; set; }
8 |
9 | [JsonProperty("unlocked_balance")]
10 | public decimal UnlockedBalance { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/GetBlockTemplateResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
4 |
5 | public class GetBlockTemplateResponse
6 | {
7 | [JsonProperty("blocktemplate_blob")]
8 | public string Blob { get; set; }
9 |
10 | public long Difficulty { get; set; }
11 | public uint Height { get; set; }
12 |
13 | [JsonProperty("prev_hash")]
14 | public string PreviousBlockhash { get; set; }
15 |
16 | [JsonProperty("seed_hash")]
17 | public string SeedHash { get; set; }
18 |
19 | [JsonProperty("reserved_offset")]
20 | public int ReservedOffset { get; set; }
21 |
22 | public string Status { get; set; }
23 | }
24 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/SplitIntegratedAddressResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
4 |
5 | public class SplitIntegratedAddressResponse
6 | {
7 | [JsonProperty("standard_address")]
8 | public string StandardAddress { get; set; }
9 |
10 | public string Payment { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/SubmitResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
2 |
3 | public class SubmitResponse
4 | {
5 | public string Status { get; set; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/DaemonResponses/TransferSplitResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.DaemonResponses;
4 |
5 | public class TransferSplitResponse
6 | {
7 | ///
8 | /// List of tx fees charged for the txn (piconeros)
9 | ///
10 | [JsonProperty("fee_list")]
11 | public ulong[] FeeList { get; set; }
12 |
13 | ///
14 | /// Publically searchable transaction hash
15 | ///
16 | [JsonProperty("tx_hash_list")]
17 | public string[] TxHashList { get; set; }
18 |
19 | public string Status { get; set; }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/StratumRequests/CryptonoteGetJobRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.StratumRequests;
4 |
5 | public class CryptonoteGetJobRequest
6 | {
7 | [JsonProperty("id")]
8 | public string WorkerId { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/StratumRequests/CryptonoteLoginRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.StratumRequests;
4 |
5 | public class CryptonoteLoginRequest
6 | {
7 | [JsonProperty("login")]
8 | public string Login { get; set; }
9 |
10 | [JsonProperty("pass")]
11 | public string Password { get; set; }
12 |
13 | [JsonProperty("agent")]
14 | public string UserAgent { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/StratumRequests/CryptonoteSubmitShareRequest.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.StratumRequests;
4 |
5 | public class CryptonoteSubmitShareRequest
6 | {
7 | [JsonProperty("id")]
8 | public string WorkerId { get; set; }
9 |
10 | [JsonProperty("job_id")]
11 | public string JobId { get; set; }
12 |
13 | public string Nonce { get; set; }
14 |
15 | [JsonProperty("result")]
16 | public string Hash { get; set; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/StratumResponses/CryptonoteLoginResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Cryptonote.StratumResponses;
4 |
5 | public class CryptonoteJobParams
6 | {
7 | [JsonProperty("job_id")]
8 | public string JobId { get; set; }
9 |
10 | public string Blob { get; set; }
11 | public string Target { get; set; }
12 |
13 | [JsonProperty("seed_hash")]
14 | public string SeedHash { get; set; }
15 |
16 | [JsonProperty("algo")]
17 | public string Algorithm { get; set; }
18 |
19 | ///
20 | /// Introduced for CNv4 (aka CryptonightR)
21 | ///
22 | public ulong Height { get; set; }
23 | }
24 |
25 | public class CryptonoteLoginResponse : CryptonoteResponseBase
26 | {
27 | public string Id { get; set; }
28 | public CryptonoteJobParams Job { get; set; }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Cryptonote/StratumResponses/CryptonoteResponseBase.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Cryptonote.StratumResponses;
2 |
3 | public class CryptonoteResponseBase
4 | {
5 | public string Status { get; set; } = "OK";
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/Configuration/EquihashPoolConfigExtra.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 | using Newtonsoft.Json.Linq;
3 |
4 | namespace Miningcore.Blockchain.Equihash.Configuration;
5 |
6 | public class EquihashPoolConfigExtra
7 | {
8 | ///
9 | /// z-addr holding pool funds - required for payment processing
10 | ///
11 | [JsonProperty("z-address")]
12 | public string ZAddress { get; set; }
13 |
14 | ///
15 | /// Custom Arguments for getblocktemplate RPC
16 | ///
17 | public JToken GBTArgs { get; set; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/DaemonRequests/ZSendMany.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Equihash.DaemonRequests;
2 |
3 | public class ZSendManyRecipient
4 | {
5 | public string Address { get; set; }
6 | public decimal Amount { get; set; }
7 | public string Memo { get; set; }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/DaemonResponses/GetBlockSubsidyResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Equihash.DaemonResponses;
2 |
3 | public class ZCashBlockSubsidy
4 | {
5 | public decimal Miner { get; set; }
6 | public decimal? Founders { get; set; }
7 | public decimal? Community { get; set; }
8 | public decimal? Securenodes { get; set; }
9 | public decimal? Supernodes { get; set; }
10 | public List FundingStreams { get; set; }
11 | }
12 |
13 | public class FundingStream
14 | {
15 | public string Recipient { get; set; }
16 | public string Specification { get; set; }
17 | public decimal Value { get; set; }
18 | public decimal ValueZat { get; set; }
19 | public string Address { get; set; }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/DaemonResponses/ZCashAsyncOperationStatus.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.JsonRpc;
2 | using Newtonsoft.Json;
3 | using Newtonsoft.Json.Linq;
4 |
5 | namespace Miningcore.Blockchain.Equihash.DaemonResponses;
6 |
7 | public class ZCashAsyncOperationStatus
8 | {
9 | [JsonProperty("id")]
10 | public string OperationId { get; set; }
11 |
12 | public string Status { get; set; }
13 | public JToken Result { get; set; }
14 | public JsonRpcError Error { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/DaemonResponses/ZCashShieldingResponse.cs:
--------------------------------------------------------------------------------
1 | using Newtonsoft.Json;
2 |
3 | namespace Miningcore.Blockchain.Equihash.DaemonResponses;
4 |
5 | public class ZCashShieldingResponse
6 | {
7 | [JsonProperty("opid")]
8 | public string OperationId { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/EquihashExtraNonceProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Equihash;
2 |
3 | public class EquihashExtraNonceProvider : ExtraNonceProviderBase
4 | {
5 | public EquihashExtraNonceProvider(string poolId, byte? clusterInstanceId) : base(poolId, 3, clusterInstanceId)
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Equihash/EquihashStratumMethods.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Equihash;
2 |
3 | public class EquihashStratumMethods
4 | {
5 | ///
6 | /// Used to signal the miner to stop submitting shares under the new target
7 | ///
8 | public const string SetTarget = "mining.set_target";
9 |
10 | ///
11 | /// The target suggested by the miner for the next received job and all subsequent jobs (until the next time this message is sent)
12 | ///
13 | public const string SuggestTarget = "mining.suggest_target";
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/Configuration/ErgoDaemonEndpointConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ergo.Configuration;
2 |
3 | public class ErgoDaemonEndpointConfigExtra
4 | {
5 | ///
6 | /// The Ergo Node's API key in clear-text - not the hash
7 | ///
8 | public string ApiKey { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/Configuration/ErgoPaymentProcessingConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ergo.Configuration;
2 |
3 | public class ErgoPaymentProcessingConfigExtra
4 | {
5 | ///
6 | /// Password for unlocking wallet
7 | ///
8 | public string WalletPassword { get; set; }
9 |
10 | ///
11 | /// Minimum block confirmations
12 | ///
13 | public int? MinimumConfirmations { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/Configuration/ErgoPoolConfigExtra.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 |
3 | namespace Miningcore.Blockchain.Ergo.Configuration;
4 |
5 | public class ErgoPoolConfigExtra
6 | {
7 | ///
8 | /// Maximum number of tracked jobs.
9 | /// Default: 12 - you should increase this value if your blockrefreshinterval is higher than 300ms
10 | ///
11 | public int? MaxActiveJobs { get; set; }
12 |
13 | ///
14 | /// Blocktemplate stream published via ZMQ
15 | ///
16 | public ZmqPubSubEndpointConfig BtStream { get; set; }
17 |
18 | public int? ExtraNonce1Size { get; set; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/ErgoConstants.cs:
--------------------------------------------------------------------------------
1 | using System.Text.RegularExpressions;
2 |
3 | // ReSharper disable InconsistentNaming
4 |
5 | namespace Miningcore.Blockchain.Ergo;
6 |
7 | public static class ErgoConstants
8 | {
9 | public const uint ShareMultiplier = 256;
10 | public const decimal SmallestUnit = 1000000000;
11 | public static readonly Regex RegexChain = new("ergo-([^-]+)-.+", RegexOptions.Compiled);
12 |
13 | public static readonly byte[] M = Enumerable.Range(0, 1024)
14 | .Select(x => BitConverter.GetBytes((ulong) x).Reverse())
15 | .SelectMany(byteArr => byteArr)
16 | .ToArray();
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/ErgoExtraNonceProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ergo;
2 |
3 | public class ErgoExtraNonceProvider : ExtraNonceProviderBase
4 | {
5 | public ErgoExtraNonceProvider(string poolId, int size, byte? clusterInstanceId) : base(poolId, size, clusterInstanceId)
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ergo/ErgoWorkerContext.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Mining;
2 |
3 | namespace Miningcore.Blockchain.Ergo;
4 |
5 | public class ErgoWorkerContext : WorkerContextBase
6 | {
7 | ///
8 | /// Usually a wallet address
9 | ///
10 | public string Miner { get; set; }
11 |
12 | ///
13 | /// Arbitrary worker identififer for miners using multiple rigs
14 | ///
15 | public string Worker { get; set; }
16 |
17 | ///
18 | /// Unique value assigned per worker
19 | ///
20 | public string ExtraNonce1 { get; set; }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/Configuration/EthereumDaemonEndpointConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ethereum.Configuration;
2 |
3 | public class EthereumDaemonEndpointConfigExtra
4 | {
5 | ///
6 | /// Optional port for streaming WebSocket data
7 | ///
8 | public int? PortWs { get; set; }
9 |
10 | ///
11 | /// Optional http-path for streaming WebSocket data
12 | ///
13 | public string HttpPathWs { get; set; }
14 |
15 | ///
16 | /// Optional: Use SSL to for daemon websocket streaming
17 | ///
18 | public bool SslWs { get; set; }
19 |
20 | ///
21 | /// Optional: port for getWork push-notifications
22 | /// (should match with geth --miner.notify or openethereum --notify-work)
23 | ///
24 | public string NotifyWorkUrl { get; set; }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/Configuration/EthereumPoolConfigExtra.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 |
3 | namespace Miningcore.Blockchain.Ethereum.Configuration;
4 |
5 | public class EthereumPoolConfigExtra
6 | {
7 | ///
8 | /// Base directory for generated DAGs
9 | ///
10 | public string DagDir { get; set; }
11 |
12 | ///
13 | /// Useful to specify the real chain type when running geth
14 | ///
15 | public string ChainTypeOverride { get; set; }
16 |
17 | ///
18 | /// getWork stream published via ZMQ
19 | ///
20 | public ZmqPubSubEndpointConfig BtStream { get; set; }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/Configuration/EthereumPoolPaymentProcessingConfigExtra.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ethereum.Configuration;
2 |
3 | public class EthereumPoolPaymentProcessingConfigExtra
4 | {
5 | ///
6 | /// True to exempt transaction fees from miner rewards
7 | ///
8 | public bool KeepTransactionFees { get; set; }
9 |
10 | ///
11 | /// True to exempt uncle rewards from miner rewards
12 | ///
13 | public bool KeepUncles { get; set; }
14 |
15 | ///
16 | /// Gas amount for payout tx (advanced users only)
17 | ///
18 | public ulong Gas { get; set; }
19 |
20 | ///
21 | /// maximum amount you’re willing to pay
22 | ///
23 | public ulong MaxFeePerGas { get; set; }
24 |
25 | ///
26 | /// Search offset to start looking for uncles
27 | ///
28 | public uint BlockSearchOffset { get; set; } = 50;
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/EthereumBlockTemplate.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ethereum;
2 |
3 | public record EthereumBlockTemplate
4 | {
5 | ///
6 | /// The block number
7 | ///
8 | public ulong Height { get; init; }
9 |
10 | ///
11 | /// current block header pow-hash (32 Bytes)
12 | ///
13 | public string Header { get; init; }
14 |
15 | ///
16 | /// the seed hash used for the DAG. (32 Bytes)
17 | ///
18 | public string Seed { get; init; }
19 |
20 | ///
21 | /// the boundary condition ("target"), 2^256 / difficulty. (32 Bytes)
22 | ///
23 | public string Target { get; init; }
24 |
25 | ///
26 | /// integer of the difficulty for this block
27 | ///
28 | public ulong Difficulty { get; init; }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/EthereumExtraNonceProvider.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Blockchain.Ethereum;
2 |
3 | public class EthereumExtraNonceProvider : ExtraNonceProviderBase
4 | {
5 | public EthereumExtraNonceProvider(string poolId, byte? clusterInstanceId) : base(poolId, 2, clusterInstanceId)
6 | {
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Blockchain/Ethereum/EthereumWorkerContext.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Mining;
2 |
3 | namespace Miningcore.Blockchain.Ethereum;
4 |
5 | public class EthereumWorkerContext : WorkerContextBase
6 | {
7 | ///
8 | /// Usually a wallet address
9 | ///
10 | public string Miner { get; set; }
11 |
12 | ///
13 | /// Arbitrary worker identififer for miners using multiple rigs
14 | ///
15 | public string Worker { get; set; }
16 |
17 | ///
18 | /// Stratum protocol version
19 | ///
20 | public int ProtocolVersion { get; set; }
21 |
22 | ///
23 | /// Unique value assigned per worker
24 | ///
25 | public string ExtraNonce1 { get; set; }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Abstractions.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 |
3 | namespace Miningcore.Crypto;
4 |
5 | public interface IHashAlgorithm
6 | {
7 | void Digest(ReadOnlySpan data, Span result, params object[] extra);
8 | }
9 |
10 | public interface IHashAlgorithmInit
11 | {
12 | bool DigestInit(PoolConfig poolConfig);
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Blake.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("blake")]
7 |
8 | public unsafe class Blake : IHashAlgorithm
9 | {
10 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
11 | {
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.blake(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Blake2b.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("blake2b")]
7 | public unsafe class Blake2b : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.blake2b(input, output, (uint) data.Length, result.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Blake2s.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("blake2s")]
7 | public unsafe class Blake2s : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.blake2s(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/DigestReverser.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Crypto.Hashing.Algorithms;
2 |
3 | [Identifier("reverse")]
4 | public class DigestReverser : IHashAlgorithm
5 | {
6 | public DigestReverser(IHashAlgorithm upstream)
7 | {
8 | this.upstream = upstream;
9 | }
10 |
11 | private readonly IHashAlgorithm upstream;
12 |
13 | public IHashAlgorithm Upstream => upstream;
14 |
15 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
16 | {
17 | upstream.Digest(data, result, extra);
18 | result.Reverse();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Geek.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("geek")]
7 | public unsafe class Geek : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.geek(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Ghostrider.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Native;
2 | using static Miningcore.Native.Cryptonight.Algorithm;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("ghostrider")]
7 | public class Ghostrider : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Cryptonight.CryptonightHash(data, result, GHOSTRIDER_RTM, 0);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Groestl.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("groestl")]
7 | public unsafe class Groestl : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.groestl(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/GroestlMyriad.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("groestl-myriad")]
7 | public unsafe class GroestlMyriad : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.groestl_myriad(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/HeavyHash.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("heavyhash")]
7 | public unsafe class HeavyHash : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.heavyhash(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Hmq17.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("hmq17")]
7 | public unsafe class HMMQ17 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.hmq17(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Lyra2Rev2.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("lyra2-rev2")]
7 | public unsafe class Lyra2Rev2 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.lyra2rev2(input, output);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Lyra2Rev3.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("lyra2-rev3")]
7 | public unsafe class Lyra2Rev3 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.lyra2rev3(input, output);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/NeoScrypt.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("neoscrypt")]
7 | public unsafe class NeoScrypt : IHashAlgorithm
8 | {
9 | public NeoScrypt(uint profile)
10 | {
11 | this.profile = profile;
12 | }
13 |
14 | private readonly uint profile;
15 |
16 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
17 | {
18 | Contract.Requires(data.Length == 80);
19 | Contract.Requires(result.Length >= 32);
20 |
21 | fixed (byte* input = data)
22 | {
23 | fixed (byte* output = result)
24 | {
25 | Multihash.neoscrypt(input, output, (uint) data.Length, profile);
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/NullHasher.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Crypto.Hashing.Algorithms;
2 |
3 | [Identifier("null")]
4 | public class Null : IHashAlgorithm
5 | {
6 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
7 | {
8 | throw new InvalidOperationException("Don't call me");
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Phi.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("phi")]
7 | public unsafe class Phi : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.phi(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Qubit.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("qubit")]
7 | public unsafe class Qubit : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.qubit(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Scrypt.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("scrypt")]
7 | public unsafe class Scrypt : IHashAlgorithm
8 | {
9 | public Scrypt(uint n, uint r)
10 | {
11 | this.n = n;
12 | this.r = r;
13 | }
14 |
15 | private readonly uint n;
16 | private readonly uint r;
17 |
18 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
19 | {
20 | Contract.Requires(result.Length >= 32);
21 |
22 | fixed (byte* input = data)
23 | {
24 | fixed (byte* output = result)
25 | {
26 | Multihash.scrypt(input, output, n, r, (uint) data.Length);
27 | }
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha256Csm.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("sha256csm")]
7 | public unsafe class Sha256Csm : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.sha256csm(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha256D.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | ///
7 | /// Sha-256 double round
8 | ///
9 | [Identifier("sha256d")]
10 | public class Sha256D : IHashAlgorithm
11 | {
12 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
13 | {
14 | Contract.Requires(result.Length >= 32);
15 |
16 | using(var hasher = SHA256.Create())
17 | {
18 | hasher.TryComputeHash(data, result, out _);
19 | hasher.TryComputeHash(result, result, out _);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha256DT.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("sha256dt")]
7 | public unsafe class Sha256DT : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.sha256dt(input, output);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha256S.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | ///
7 | /// Sha-256 single round
8 | ///
9 | [Identifier("sha256s")]
10 | public class Sha256S : IHashAlgorithm
11 | {
12 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
13 | {
14 | Contract.Requires(result.Length >= 32);
15 |
16 | using(var hasher = SHA256.Create())
17 | {
18 | hasher.TryComputeHash(data, result, out _);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha3_256.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 | using Miningcore.Native;
4 |
5 | namespace Miningcore.Crypto.Hashing.Algorithms;
6 |
7 | [Identifier("sha3-256")]
8 | public unsafe class Sha3_256 : IHashAlgorithm
9 | {
10 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
11 | {
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.sha3_256(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha3_256d.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 | using Miningcore.Native;
4 |
5 | namespace Miningcore.Crypto.Hashing.Algorithms;
6 |
7 | [Identifier("sha3-256d")]
8 | public unsafe class Sha3_256d : IHashAlgorithm
9 | {
10 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
11 | {
12 | Contract.Requires(result.Length >= 32);
13 |
14 | Span tmp = stackalloc byte[32];
15 |
16 | fixed(byte* input = data)
17 | {
18 | fixed(byte* _tmp = tmp)
19 | {
20 | fixed(byte* output = result)
21 | {
22 | Multihash.sha3_256(input, _tmp, (uint) data.Length);
23 | Multihash.sha3_256(_tmp, output, 32);
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha3_512.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 | using Miningcore.Native;
4 |
5 | namespace Miningcore.Crypto.Hashing.Algorithms;
6 |
7 | [Identifier("sha3-512")]
8 | public unsafe class Sha3_512 : IHashAlgorithm
9 | {
10 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
11 | {
12 | Contract.Requires(result.Length >= 64);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.sha3_512(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha3_512d.cs:
--------------------------------------------------------------------------------
1 | using System.Security.Cryptography;
2 | using Miningcore.Contracts;
3 | using Miningcore.Native;
4 |
5 | namespace Miningcore.Crypto.Hashing.Algorithms;
6 |
7 | [Identifier("sha3-512d")]
8 | public unsafe class Sha3_512d : IHashAlgorithm
9 | {
10 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
11 | {
12 | Contract.Requires(result.Length >= 64);
13 |
14 | Span tmp = stackalloc byte[64];
15 |
16 | fixed(byte* input = data)
17 | {
18 | fixed(byte* _tmp = tmp)
19 | {
20 | fixed(byte* output = result)
21 | {
22 | Multihash.sha3_512(input, _tmp, (uint) data.Length);
23 | Multihash.sha3_512(_tmp, output, 64);
24 | }
25 | }
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Sha512256D.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("sha512/256d")]
7 | public unsafe class Sha512256D : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.sha512_256(input, output, (uint) data.Length);
18 | Multihash.sha512_256(output, output, 32);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/Skein.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("skein")]
7 | public unsafe class Skein : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.skein(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X11.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x11")]
7 | public unsafe class X11 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x11(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X13.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x13")]
7 | public unsafe class X13 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.x13(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X13BCD.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x13bcd")]
7 | public unsafe class X13BCD : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.x13_bcd(input, output);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X16R.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x16r")]
7 | public unsafe class X16R : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x16r(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X16RV2.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x16r-v2")]
7 | public unsafe class X16RV2 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(data.Length == 80);
12 | Contract.Requires(result.Length >= 32);
13 |
14 | fixed (byte* input = data)
15 | {
16 | fixed (byte* output = result)
17 | {
18 | Multihash.x16rv2(input, output, (uint) data.Length);
19 | }
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X16S.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x16s")]
7 | public unsafe class X16S : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x16s(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X17.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x17")]
7 | public unsafe class X17 : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x17(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X21s.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x21s")]
7 | public unsafe class X21S : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x21s(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Crypto/Hashing/Algorithms/X22i.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Contracts;
2 | using Miningcore.Native;
3 |
4 | namespace Miningcore.Crypto.Hashing.Algorithms;
5 |
6 | [Identifier("x22i")]
7 | public unsafe class X22I : IHashAlgorithm
8 | {
9 | public void Digest(ReadOnlySpan data, Span result, params object[] extra)
10 | {
11 | Contract.Requires(result.Length >= 32);
12 |
13 | fixed (byte* input = data)
14 | {
15 | fixed (byte* output = result)
16 | {
17 | Multihash.x22i(input, output, (uint) data.Length);
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/DateExtensions.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Extensions;
2 |
3 | public static class DateExtensions
4 | {
5 | public static double ToUnixSeconds(this DateTime dt)
6 | {
7 | return ((DateTimeOffset) dt).ToUnixTimeMilliseconds() / 1000d;
8 | }
9 |
10 | public static double ToUnixSeconds(this DateTimeOffset dto)
11 | {
12 | return dto.ToUnixTimeMilliseconds() / 1000d;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/DictionaryExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using System.Globalization;
3 |
4 | namespace Miningcore.Extensions
5 | {
6 | public static class DictionaryExtensions
7 | {
8 | public static void StripValue(this IDictionary dict, string key)
9 | {
10 | if(dict == null)
11 | return;
12 |
13 | key = key.ToLower(CultureInfo.InvariantCulture);
14 |
15 | var keyActual = dict.Keys.FirstOrDefault(x => x.ToLower(CultureInfo.InvariantCulture) == key);
16 |
17 | if(keyActual != null)
18 | {
19 | var result = dict.Remove(keyActual);
20 | Debug.Assert(result);
21 | }
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/HttpContextExtensions.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Http;
2 |
3 | namespace Miningcore.Extensions;
4 |
5 | public static class HttpContextExtensions
6 | {
7 | public static T GetQueryParameter(this HttpContext ctx, string name, T defaultValue)
8 | {
9 | var stringVal = ctx.Request.Query[name].FirstOrDefault();
10 | if(string.IsNullOrEmpty(stringVal))
11 | return defaultValue;
12 |
13 | return (T) Convert.ChangeType(stringVal, typeof(T));
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/NumberExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Miningcore.Extensions;
4 |
5 | public static class NumberExtensions
6 | {
7 | public static uint ToBigEndian(this uint value)
8 | {
9 | if(BitConverter.IsLittleEndian)
10 | return (uint) IPAddress.NetworkToHostOrder((int) value);
11 |
12 | return value;
13 | }
14 |
15 | public static uint ToLittleEndian(this uint value)
16 | {
17 | if(!BitConverter.IsLittleEndian)
18 | return (uint) IPAddress.HostToNetworkOrder((int) value);
19 |
20 | return value;
21 | }
22 |
23 | public static uint ReverseByteOrder(this uint value)
24 | {
25 | var bytes = BitConverter.GetBytes(value);
26 | Array.Reverse(bytes);
27 | value = BitConverter.ToUInt32(bytes, 0);
28 | return value;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/PipelineExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Buffers;
2 |
3 | namespace Miningcore.Extensions;
4 |
5 | public static class PipelineExtensions
6 | {
7 | public static ReadOnlySpan ToSpan(this ReadOnlySequence buffer)
8 | {
9 | if(buffer.IsSingleSegment)
10 | return buffer.First.Span;
11 |
12 | return buffer.ToArray();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Extensions/WebSocketExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Net.WebSockets;
2 | using System.Text;
3 |
4 | namespace Miningcore.Extensions;
5 |
6 | public static class WebSocketExtensions
7 | {
8 | public static async Task SendAsync(this WebSocket socket, string msg, CancellationToken ct)
9 | {
10 | var bytes = Encoding.UTF8.GetBytes(msg);
11 | await socket.SendAsync(bytes, WebSocketMessageType.Text, true, ct);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/GitVersion.yml:
--------------------------------------------------------------------------------
1 | assembly-versioning-scheme: MajorMinorPatch
2 | mode: ContinuousDelivery
3 | branches:
4 | develop:
5 | regex: ^dev(elop)?(ment)?|oliverw$
6 | ignore:
7 | sha: []
8 | merge-message-formats: {}
9 |
--------------------------------------------------------------------------------
/src/Miningcore/GlobalSuppressions.cs:
--------------------------------------------------------------------------------
1 |
2 | // This file is used by Code Analysis to maintain SuppressMessage attributes that are applied to this project.
3 | // Project-level suppressions either have no target or are given
4 | // a specific target and scoped to a namespace, type, member, etc.
5 |
6 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "RCS1194:Implement exception constructors.", Justification = "", Scope = "type", Target = "~T:Miningcore.Api.ApiServer.ApiException")]
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Mining/Abstractions.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Blockchain;
2 | using Miningcore.Configuration;
3 |
4 | namespace Miningcore.Mining;
5 |
6 | public interface IMiningPool
7 | {
8 | PoolConfig Config { get; }
9 | PoolStats PoolStats { get; }
10 | BlockchainStats NetworkStats { get; }
11 | double ShareMultiplier { get; }
12 | void Configure(PoolConfig pc, ClusterConfig cc);
13 | double HashrateFromShares(double shares, double interval);
14 | Task RunAsync(CancellationToken ct);
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Mining/PoolStartupException.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 |
3 | namespace Miningcore.Mining;
4 |
5 | public class PoolStartupException : Exception
6 | {
7 | public PoolStartupException(string msg, string poolId = null) : base(msg)
8 | {
9 | PoolId = poolId;
10 | }
11 |
12 | public PoolStartupException()
13 | {
14 | }
15 |
16 | public string PoolId { get; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Mining/PoolStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Mining;
2 |
3 | public class PoolStats
4 | {
5 | public DateTime? LastPoolBlockTime { get; set; }
6 | public int ConnectedMiners { get; set; }
7 | public ulong PoolHashrate { get; set; }
8 | public int SharesPerSecond { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Mining/StratumShare.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Blockchain;
2 | using Miningcore.Stratum;
3 |
4 | namespace Miningcore.Mining;
5 |
6 | public record StratumShare(StratumConnection Connection, Share Share);
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Nicehash/API/NicehashConstants.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Nicehash.API;
2 |
3 | public class NicehashConstants
4 | {
5 | public const string ApiBaseUrl = "https://api2.nicehash.com/main/api/v2";
6 |
7 | public const string NicehashUA = "nicehash";
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Notifications/Messages/AdminNotification.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Notifications.Messages;
2 |
3 | public record AdminNotification
4 | {
5 | public AdminNotification(string subject, string message)
6 | {
7 | Subject = subject;
8 | Message = message;
9 | }
10 |
11 | public string Subject { get; }
12 | public string Message { get; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Notifications/Messages/BtStreamMessage.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Notifications.Messages;
2 |
3 | public record BtStreamMessage
4 | {
5 | public BtStreamMessage(string topic, string payload, DateTime sent, DateTime received)
6 | {
7 | Topic = topic;
8 | Payload = payload;
9 | Sent = sent;
10 | Received = received;
11 | }
12 |
13 | public string Topic { get; }
14 | public string Payload { get; }
15 | public DateTime Sent { get; }
16 | public DateTime Received { get; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Notifications/Messages/HashrateNotification.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Notifications.Messages;
2 |
3 | public record HashrateNotification
4 | {
5 | public string PoolId { get; set; }
6 | public double Hashrate { get; set; }
7 | public string Miner { get; set; }
8 | public string Worker { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Notifications/Messages/PoolStatusNotification.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Mining;
2 |
3 | namespace Miningcore.Notifications.Messages;
4 |
5 | public enum PoolStatus
6 | {
7 | Online,
8 | Offline
9 | }
10 |
11 | public record PoolStatusNotification
12 | {
13 | public IMiningPool Pool { get; set; }
14 | public PoolStatus Status { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Payments/PayoutConstants.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Payments;
2 |
3 | public static class PayoutConstants
4 | {
5 | public const char PayoutInfoSeperator = '.';
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Dummy/DummyConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 |
3 | namespace Miningcore.Persistence.Dummy;
4 |
5 | public class DummyConnectionFactory : IConnectionFactory
6 | {
7 | public DummyConnectionFactory(string connectionString)
8 | {
9 | }
10 |
11 | ///
12 | /// This implementation ensures that Glimpse.ADO is able to collect data
13 | ///
14 | ///
15 | public Task OpenConnectionAsync()
16 | {
17 | throw new NotImplementedException();
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/IConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 |
3 | namespace Miningcore.Persistence;
4 |
5 | public interface IConnectionFactory
6 | {
7 | Task OpenConnectionAsync();
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Balance.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public record Balance
4 | {
5 | public string PoolId { get; init; }
6 | public string Address { get; init; }
7 |
8 | ///
9 | /// Amount owed in pool-base-currency (ie. Bitcoin, not Satoshis)
10 | ///
11 | public decimal Amount { get; init; }
12 |
13 | public DateTime Created { get; init; }
14 | public DateTime Updated { get; init; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/BalanceChange.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public record BalanceChange
4 | {
5 | public long Id { get; init; }
6 | public string PoolId { get; init; }
7 | public string Address { get; init; }
8 |
9 | ///
10 | /// Amount owed in pool-base-currency (ie. Bitcoin, not Satoshis)
11 | ///
12 | public decimal Amount { get; init; }
13 |
14 | public string Usage { get; init; }
15 |
16 | public DateTime Created { get; init; }
17 | }
18 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Block.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public class Block
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 | public ulong BlockHeight { get; set; }
8 | public double NetworkDifficulty { get; set; }
9 | public BlockStatus Status { get; set; }
10 | public string Type { get; set; }
11 | public double ConfirmationProgress { get; set; }
12 | public double? Effort { get; set; }
13 | public string TransactionConfirmationData { get; set; }
14 | public string Miner { get; set; }
15 | public decimal Reward { get; set; }
16 | public string Source { get; set; }
17 | public string Hash { get; set; }
18 | public DateTime Created { get; set; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/BlockStatus.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public enum BlockStatus
4 | {
5 | Pending = 1,
6 | Orphaned = 2,
7 | Confirmed = 3
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/MinerSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public class MinerSettings
4 | {
5 | public string PoolId { get; set; }
6 | public string Address { get; set; }
7 | public decimal PaymentThreshold { get; set; }
8 | public DateTime Created { get; set; }
9 | public DateTime Updated { get; set; }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/MinerWorkerPerformanceStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public class MinerWorkerPerformanceStats
4 | {
5 | public string PoolId { get; set; }
6 | public string Miner { get; set; }
7 | public string Worker { get; set; }
8 | public double Hashrate { get; set; }
9 | public double SharesPerSecond { get; set; }
10 | public DateTime Created { get; set; }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Payment.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public record Payment
4 | {
5 | public long Id { get; init; }
6 | public string PoolId { get; init; }
7 | public string Coin { get; init; }
8 | public string Address { get; init; }
9 | public decimal Amount { get; init; }
10 | public string TransactionConfirmationData { get; init; }
11 | public DateTime Created { get; init; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/PoolStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public record PoolStats
4 | {
5 | public long Id { get; init; }
6 | public string PoolId { get; init; }
7 |
8 | public int ConnectedMiners { get; init; }
9 | public float PoolHashrate { get; init; }
10 | public double NetworkHashrate { get; init; }
11 | public double NetworkDifficulty { get; init; }
12 | public DateTime? LastNetworkBlockTime { get; init; }
13 | public long BlockHeight { get; init; }
14 | public int ConnectedPeers { get; init; }
15 | public int SharesPerSecond { get; init; }
16 |
17 | public DateTime Created { get; init; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Projections/AmountByDate.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model.Projections;
2 |
3 | public record AmountByDate
4 | {
5 | public decimal Amount { get; init; }
6 | public DateTime Date { get; init; }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Projections/MinerStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model.Projections;
2 |
3 | public record WorkerPerformanceStats
4 | {
5 | public double Hashrate { get; init; }
6 | public double SharesPerSecond { get; init; }
7 | }
8 |
9 | public record WorkerPerformanceStatsContainer
10 | {
11 | public DateTime Created { get; init; }
12 | public Dictionary Workers { get; init; }
13 | }
14 |
15 | public class MinerStats
16 | {
17 | public double PendingShares { get; init; }
18 | public decimal PendingBalance { get; init; }
19 | public decimal TotalPaid { get; init; }
20 | public decimal TodayPaid { get; init; }
21 | public Payment LastPayment { get; set; }
22 | public WorkerPerformanceStatsContainer Performance { get; set; }
23 | public MinerWorkerPerformanceStats[] PerformanceStats { get; init; }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Projections/MinerWorkerHashes.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model.Projections;
2 |
3 | public record MinerWorkerHashes
4 | {
5 | public double Sum { get; init; }
6 | public long Count { get; init; }
7 | public string Miner { get; init; }
8 | public string Worker { get; init; }
9 | public DateTime FirstShare { get; init; }
10 | public DateTime LastShare { get; init; }
11 | }
12 |
13 | public record MinerWorkerHashrate
14 | {
15 | public string Miner { get; init; }
16 | public string Worker { get; init; }
17 | public double Hashrate { get; init; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/SampleInterval.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public enum SampleInterval
4 | {
5 | Hour = 1,
6 | Day
7 | }
8 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/SampleRange.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public enum SampleRange
4 | {
5 | Day = 1,
6 | Month,
7 | Hour,
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Model/Share.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Model;
2 |
3 | public record Share
4 | {
5 | public string PoolId { get; init; }
6 | public ulong BlockHeight { get; init; }
7 | public string Miner { get; init; }
8 | public string Worker { get; init; }
9 | public string UserAgent { get; init; }
10 | public double Difficulty { get; init; }
11 | public double NetworkDifficulty { get; init; }
12 | public string IpAddress { get; init; }
13 | public string Source { get; init; }
14 | public DateTime Created { get; init; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/Balance.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class Balance
4 | {
5 | public string PoolId { get; set; }
6 | public string Address { get; set; }
7 | public decimal Amount { get; set; }
8 | public DateTime Created { get; set; }
9 | public DateTime Updated { get; set; }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/BalanceChange.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class BalanceChange
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 | public string Address { get; set; }
8 | public decimal Amount { get; set; }
9 | public string Usage { get; set; }
10 | public string[] Tags { get; set; }
11 | public DateTime Created { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/Block.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class Block
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 | public long BlockHeight { get; set; }
8 | public double NetworkDifficulty { get; set; }
9 | public string Status { get; set; }
10 | public string Type { get; set; }
11 | public double ConfirmationProgress { get; set; }
12 | public double? Effort { get; set; }
13 | public string TransactionConfirmationData { get; set; }
14 | public string Miner { get; set; }
15 | public decimal Reward { get; set; }
16 | public string Source { get; set; }
17 | public string Hash { get; set; }
18 | public DateTime Created { get; set; }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/MinerSettings.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class MinerSettings
4 | {
5 | public string PoolId { get; set; }
6 | public string Address { get; set; }
7 | public decimal PaymentThreshold { get; set; }
8 | public DateTime Created { get; set; }
9 | public DateTime Updated { get; set; }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/MinerWorkerPerformanceStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class MinerWorkerPerformanceStats
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 | public string Miner { get; set; }
8 | public string Worker { get; set; }
9 | public double Hashrate { get; set; }
10 | public double SharesPerSecond { get; set; }
11 | public DateTime Created { get; set; }
12 |
13 | public int Partition { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/Payment.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class Payment
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 | public string Coin { get; set; }
8 | public string Address { get; set; }
9 | public decimal Amount { get; set; }
10 | public string TransactionConfirmationData { get; set; }
11 | public DateTime Created { get; set; }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/PoolStats.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class PoolStats
4 | {
5 | public long Id { get; set; }
6 | public string PoolId { get; set; }
7 |
8 | public int ConnectedMiners { get; set; }
9 | public float PoolHashrate { get; set; }
10 | public double NetworkHashrate { get; set; }
11 | public double NetworkDifficulty { get; set; }
12 | public DateTime? LastNetworkBlockTime { get; set; }
13 | public long BlockHeight { get; set; }
14 | public int ConnectedPeers { get; set; }
15 | public int SharesPerSecond { get; set; }
16 |
17 | public DateTime Created { get; set; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Entities/Share.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Persistence.Postgres.Entities;
2 |
3 | public class Share
4 | {
5 | public string PoolId { get; set; }
6 | public long BlockHeight { get; set; }
7 | public string Miner { get; set; }
8 | public string Worker { get; set; }
9 | public string UserAgent { get; set; }
10 | public double Difficulty { get; set; }
11 | public double NetworkDifficulty { get; set; }
12 | public string IpAddress { get; set; }
13 | public string Source { get; set; }
14 | public DateTime Created { get; set; }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/PgConnectionFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 | using Npgsql;
3 |
4 | namespace Miningcore.Persistence.Postgres;
5 |
6 | public class PgConnectionFactory : IConnectionFactory
7 | {
8 | public PgConnectionFactory(string connectionString)
9 | {
10 | this.connectionString = connectionString;
11 | }
12 |
13 | private readonly string connectionString;
14 |
15 | public async Task OpenConnectionAsync()
16 | {
17 | var con = new NpgsqlConnection(connectionString);
18 | await con.OpenAsync();
19 | return con;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Scripts/cleandb.sql:
--------------------------------------------------------------------------------
1 | DROP TABLE shares;
2 | DROP TABLE blocks;
3 | DROP TABLE balances;
4 | DROP TABLE payments;
5 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Scripts/createdb_postgresql_11_appendix.sql:
--------------------------------------------------------------------------------
1 | SET ROLE miningcore;
2 |
3 | DROP TABLE shares;
4 |
5 | CREATE TABLE shares
6 | (
7 | poolid TEXT NOT NULL,
8 | blockheight BIGINT NOT NULL,
9 | difficulty DOUBLE PRECISION NOT NULL,
10 | networkdifficulty DOUBLE PRECISION NOT NULL,
11 | miner TEXT NOT NULL,
12 | worker TEXT NULL,
13 | useragent TEXT NULL,
14 | ipaddress TEXT NOT NULL,
15 | source TEXT NULL,
16 | created TIMESTAMP WITH TIME ZONE NOT NULL
17 | ) PARTITION BY LIST (poolid);
18 |
19 | CREATE INDEX IDX_SHARES_CREATED ON SHARES(created);
20 | CREATE INDEX IDX_SHARES_MINER_DIFFICULTY on SHARES(miner, difficulty);
21 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Postgres/Scripts/legacy_timestamp_migration.sql:
--------------------------------------------------------------------------------
1 | ALTER TABLE shares ALTER COLUMN created TYPE TIMESTAMPTZ;
2 | ALTER TABLE blocks ALTER COLUMN created TYPE TIMESTAMPTZ;
3 | ALTER TABLE balances ALTER COLUMN created TYPE TIMESTAMPTZ;
4 | ALTER TABLE balances ALTER COLUMN updated TYPE TIMESTAMPTZ;
5 | ALTER TABLE balance_changes ALTER COLUMN created TYPE TIMESTAMPTZ;
6 | ALTER TABLE miner_settings ALTER COLUMN created TYPE TIMESTAMPTZ;
7 | ALTER TABLE miner_settings ALTER COLUMN updated TYPE TIMESTAMPTZ;
8 | ALTER TABLE payments ALTER COLUMN created TYPE TIMESTAMPTZ;
9 | ALTER TABLE poolstats ALTER COLUMN lastnetworkblocktime TYPE TIMESTAMPTZ;
10 | ALTER TABLE poolstats ALTER COLUMN created TYPE TIMESTAMPTZ;
11 | ALTER TABLE minerstats ALTER COLUMN created TYPE TIMESTAMPTZ;
12 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Repositories/IBalanceRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 | using Miningcore.Persistence.Model;
3 |
4 | namespace Miningcore.Persistence.Repositories;
5 |
6 | public interface IBalanceRepository
7 | {
8 | Task AddAmountAsync(IDbConnection con, IDbTransaction tx, string poolId, string address, decimal amount, string usage, params string[] tags);
9 | Task GetBalanceAsync(IDbConnection con, string poolId, string address);
10 | Task GetBalanceAsync(IDbConnection con, IDbTransaction tx, string poolId, string address);
11 |
12 | Task GetBalanceChangeCountByTagAsync(IDbConnection con, IDbTransaction tx, string poolId, string tag);
13 | Task GetBalanceChangesByTagAsync(IDbConnection con, IDbTransaction tx, string poolId, string tag);
14 |
15 | Task GetPoolBalancesOverThresholdAsync(IDbConnection con, string poolId, decimal minimum);
16 | }
17 |
--------------------------------------------------------------------------------
/src/Miningcore/Persistence/Repositories/IMinerRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 | using Miningcore.Persistence.Model;
3 |
4 | namespace Miningcore.Persistence.Repositories;
5 |
6 | public interface IMinerRepository
7 | {
8 | Task GetSettingsAsync(IDbConnection con, IDbTransaction tx, string poolId, string address);
9 | Task UpdateSettingsAsync(IDbConnection con, IDbTransaction tx, MinerSettings settings);
10 | }
11 |
--------------------------------------------------------------------------------
/src/Miningcore/Properties/PublishProfiles/FolderProfile.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 | FileSystem
9 | Release
10 | netcoreapp2.0
11 | bin\Release\PublishOutput
12 |
13 |
--------------------------------------------------------------------------------
/src/Miningcore/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "MiningCore": {
4 | "commandName": "Project",
5 | "commandLineArgs": "-c ..\\..\\..\\config.json",
6 | "nativeDebugging": true
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Pushover/PushoverConstants.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Pushover;
2 |
3 | public static class PushoverConstants
4 | {
5 | public const string ApiBaseUrl = "https://api.pushover.net/1";
6 | }
7 |
8 | public enum PushoverMessagePriority
9 | {
10 | Silent = -2,
11 | Quiet = -1,
12 | None = 0,
13 | Priority = 1,
14 | PriorityWithConfirmation = 2
15 | }
16 |
--------------------------------------------------------------------------------
/src/Miningcore/Pushover/PushoverRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Pushover;
2 |
3 | public class PushoverRequest
4 | {
5 | public string Token { get; set; }
6 | public string User { get; set; }
7 | public string Device { get; set; }
8 | public string Title { get; set; }
9 | public string Message { get; set; }
10 | public int Priority { get; set; }
11 | public int Timestamp { get; set; }
12 | public string Sound { get; set; }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Miningcore/Pushover/PushoverResponse.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Pushover;
2 |
3 | public class PushoverReponse
4 | {
5 | public int Status { get; set; }
6 | public string Request { get; set; }
7 | public string User { get; set; }
8 | public string[] Errors { get; set; }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Miningcore/Rpc/RpcRequest.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Rpc;
2 |
3 | public record RpcRequest
4 | {
5 | public RpcRequest(string method)
6 | {
7 | Method = method;
8 | }
9 |
10 | public RpcRequest(string method, object payload)
11 | {
12 | Method = method;
13 | Payload = payload;
14 | }
15 |
16 | public string Method { get; }
17 | public object Payload { get; }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Miningcore/Rpc/RpcResponse.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.JsonRpc;
2 |
3 | namespace Miningcore.Rpc;
4 |
5 | public record RpcResponse(T Response, JsonRpcError Error = null);
6 |
--------------------------------------------------------------------------------
/src/Miningcore/Stratum/StratumEndpoint.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 | using Miningcore.Configuration;
3 |
4 | namespace Miningcore.Stratum;
5 |
6 | public record StratumEndpoint(IPEndPoint IPEndPoint, PoolEndpoint PoolEndpoint);
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Stratum/StratumError.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Stratum;
2 |
3 | public enum StratumError
4 | {
5 | Other = 20,
6 | JobNotFound = 21, // stale
7 | DuplicateShare = 22,
8 | LowDifficultyShare = 23,
9 | UnauthorizedWorker = 24,
10 | NotSubscribed = 25,
11 | MinusOne = -1
12 | }
13 |
14 | public class StratumException : Exception
15 | {
16 | public StratumException(StratumError code, string message) : base(message)
17 | {
18 | Code = code;
19 | }
20 |
21 | public StratumError Code { get; set; }
22 | }
23 |
--------------------------------------------------------------------------------
/src/Miningcore/Time/Abstractions.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Time;
2 |
3 | public interface IMasterClock
4 | {
5 | DateTime Now { get; }
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Time/StandardClock.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Time;
2 |
3 | public class StandardClock : IMasterClock
4 | {
5 | public DateTime Now => DateTime.UtcNow;
6 | }
7 |
--------------------------------------------------------------------------------
/src/Miningcore/Util/IPUtils.cs:
--------------------------------------------------------------------------------
1 | using System.Net;
2 |
3 | namespace Miningcore.Util;
4 |
5 | public class IPUtils
6 | {
7 | public static readonly IPAddress IPv4LoopBackOnIPv6 = IPAddress.Parse("::ffff:127.0.0.1");
8 | }
9 |
--------------------------------------------------------------------------------
/src/Miningcore/Util/LogUtil.cs:
--------------------------------------------------------------------------------
1 | using Miningcore.Configuration;
2 | using NLog;
3 |
4 | namespace Miningcore.Util;
5 |
6 | public static class LogUtil
7 | {
8 | public static ILogger GetPoolScopedLogger(Type type, PoolConfig poolConfig)
9 | {
10 | return LogManager.GetLogger(poolConfig.Id);
11 | }
12 |
13 | public static ILogger GetPoolScopedLogger(Type type, string poolId)
14 | {
15 | return LogManager.GetLogger(poolId);
16 | }
17 |
18 | public static string DotTerminate(string msg)
19 | {
20 | if(!msg.EndsWith("."))
21 | msg += ".";
22 |
23 | return msg;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Miningcore/Util/StaticRandom.cs:
--------------------------------------------------------------------------------
1 | namespace Miningcore.Util;
2 |
3 | public static class StaticRandom
4 | {
5 | static int seed = Environment.TickCount;
6 |
7 | private static readonly ThreadLocal random =
8 | new(() => new Random(Interlocked.Increment(ref seed)));
9 |
10 | public static int Next()
11 | {
12 | return random.Value.Next();
13 | }
14 |
15 | public static int Next(int n)
16 | {
17 | return random.Value.Next(n);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/Miningcore/VarDiff/VarDiffContext.cs:
--------------------------------------------------------------------------------
1 | using CircularBuffer;
2 | using Miningcore.Configuration;
3 |
4 | namespace Miningcore.VarDiff;
5 |
6 | public class VarDiffContext
7 | {
8 | public double? LastTs { get; set; }
9 | public double LastRetarget { get; set; }
10 | public CircularBuffer TimeBuffer { get; set; }
11 | public DateTime Created { get; set; }
12 | public DateTime? LastUpdate { get; set; }
13 | public VarDiffConfig Config { get; set; }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/c29.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 |
5 | #define PROOFSIZE 32
6 | #define PROOFSIZEb 40
7 | #define PROOFSIZEi 48
8 | #define EDGEBITS 29
9 |
10 | typedef struct siphash_keys__
11 | {
12 | uint64_t k0;
13 | uint64_t k1;
14 | uint64_t k2;
15 | uint64_t k3;
16 | } siphash_keys;
17 |
18 | enum verify_code { POW_OK, POW_HEADER_LENGTH, POW_TOO_BIG, POW_TOO_SMALL, POW_NON_MATCHING, POW_BRANCH, POW_DEAD_END, POW_SHORT_CYCLE, POW_UNBALANCED};
19 |
20 | extern int c29s_verify(uint32_t edges[32], siphash_keys *keys);
21 | extern int c29b_verify(uint32_t edges[40], siphash_keys *keys);
22 | extern int c29i_verify(uint32_t edges[48], siphash_keys *keys);
23 | extern int c29v_verify(uint32_t edges[32], siphash_keys *keys);
24 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 |
3 | #include
4 |
5 | BOOL APIENTRY DllMain( HMODULE hModule,
6 | DWORD ul_reason_for_call,
7 | LPVOID lpReserved
8 | )
9 | {
10 | switch (ul_reason_for_call)
11 | {
12 | case DLL_PROCESS_ATTACH:
13 | case DLL_THREAD_ATTACH:
14 | case DLL_THREAD_DETACH:
15 | case DLL_PROCESS_DETACH:
16 | break;
17 | }
18 | return TRUE;
19 | }
20 |
21 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig-override/base/io/log/Log.h:
--------------------------------------------------------------------------------
1 | #define LOG_INFO(x, ...)
2 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig-override/base/io/log/Tags.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libcryptonight/xmrig-override/base/io/log/Tags.h
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/generic/lib/argon2-arch.c:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "impl-select.h"
6 |
7 | #define rotr64(x, n) (((x) >> (n)) | ((x) << (64 - (n))))
8 |
9 | #include "argon2-template-64.h"
10 |
11 | void fill_segment_default(const argon2_instance_t *instance,
12 | argon2_position_t position)
13 | {
14 | fill_segment_64(instance, position);
15 | }
16 |
17 | void argon2_get_impl_list(argon2_impl_list *list)
18 | {
19 | list->count = 0;
20 | }
21 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/lib/argon2-avx2.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_AVX2_H
2 | #define ARGON2_AVX2_H
3 |
4 | #include "core.h"
5 |
6 | void xmrig_ar2_fill_segment_avx2(const argon2_instance_t *instance, argon2_position_t position);
7 | int xmrig_ar2_check_avx2(void);
8 |
9 | #endif // ARGON2_AVX2_H
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/lib/argon2-avx512f.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_AVX512F_H
2 | #define ARGON2_AVX512F_H
3 |
4 | #include "core.h"
5 |
6 | void xmrig_ar2_fill_segment_avx512f(const argon2_instance_t *instance, argon2_position_t position);
7 | int xmrig_ar2_check_avx512f(void);
8 |
9 | #endif // ARGON2_AVX512F_H
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/lib/argon2-sse2.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_SSE2_H
2 | #define ARGON2_SSE2_H
3 |
4 | #include "core.h"
5 |
6 | void xmrig_ar2_fill_segment_sse2(const argon2_instance_t *instance, argon2_position_t position);
7 | int xmrig_ar2_check_sse2(void);
8 |
9 | #endif // ARGON2_SSE2_H
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/lib/argon2-ssse3.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_SSSE3_H
2 | #define ARGON2_SSSE3_H
3 |
4 | #include "core.h"
5 |
6 | void xmrig_ar2_fill_segment_ssse3(const argon2_instance_t *instance, argon2_position_t position);
7 | int xmrig_ar2_check_ssse3(void);
8 |
9 | #endif // ARGON2_SSSE3_H
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/lib/argon2-xop.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_XOP_H
2 | #define ARGON2_XOP_H
3 |
4 | #include "core.h"
5 |
6 | void xmrig_ar2_fill_segment_xop(const argon2_instance_t *instance, argon2_position_t position);
7 | int xmrig_ar2_check_xop(void);
8 |
9 | #endif // ARGON2_XOP_H
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/src/test-feature-avx2.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void function_avx2(__m256i *dst, const __m256i *a, const __m256i *b)
4 | {
5 | *dst = _mm256_xor_si256(*a, *b);
6 | }
7 |
8 | int main(void) { return 0; }
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/src/test-feature-avx512f.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void function_avx512f(__m512i *dst, const __m512i *a)
4 | {
5 | *dst = _mm512_ror_epi64(*a, 57);
6 | }
7 |
8 | int main(void) { return 0; }
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/src/test-feature-sse2.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void function_sse2(__m128i *dst, const __m128i *a, const __m128i *b)
4 | {
5 | *dst = _mm_xor_si128(*a, *b);
6 | }
7 |
8 | int main(void) { return 0; }
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/src/test-feature-ssse3.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void function_ssse3(__m128i *dst, const __m128i *a, const __m128i *b)
4 | {
5 | *dst = _mm_shuffle_epi8(*a, *b);
6 | }
7 |
8 | int main(void) { return 0; }
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/arch/x86_64/src/test-feature-xop.c:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | void function_xop(__m128i *dst, const __m128i *a, int b)
4 | {
5 | *dst = _mm_roti_epi64(*a, b);
6 | }
7 |
8 | int main(void) { return 0; }
9 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/lib/blake2/blake2.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_BLAKE2_H
2 | #define ARGON2_BLAKE2_H
3 |
4 | #include
5 | #include
6 |
7 | enum blake2b_constant {
8 | BLAKE2B_BLOCKBYTES = 128,
9 | BLAKE2B_OUTBYTES = 64,
10 | BLAKE2B_KEYBYTES = 64,
11 | BLAKE2B_SALTBYTES = 16,
12 | BLAKE2B_PERSONALBYTES = 16
13 | };
14 |
15 | typedef struct __blake2b_state {
16 | uint64_t h[8];
17 | uint64_t t[2];
18 | uint8_t buf[BLAKE2B_BLOCKBYTES];
19 | size_t buflen;
20 | } blake2b_state;
21 |
22 | /* Streaming API */
23 | void xmrig_ar2_blake2b_init(blake2b_state *S, size_t outlen);
24 | void xmrig_ar2_blake2b_update(blake2b_state *S, const void *in, size_t inlen);
25 | void xmrig_ar2_blake2b_final(blake2b_state *S, void *out, size_t outlen);
26 |
27 | void xmrig_ar2_blake2b_long(void *out, size_t outlen, const void *in, size_t inlen);
28 |
29 | #endif // ARGON2_BLAKE2_H
30 |
31 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/argon2/lib/impl-select.h:
--------------------------------------------------------------------------------
1 | #ifndef ARGON2_IMPL_SELECT_H
2 | #define ARGON2_IMPL_SELECT_H
3 |
4 | #include "core.h"
5 |
6 | typedef struct Argon2_impl {
7 | const char *name;
8 | int (*check)(void);
9 | void (*fill_segment)(const argon2_instance_t *instance,
10 | argon2_position_t position);
11 | } argon2_impl;
12 |
13 | typedef struct Argon2_impl_list {
14 | const argon2_impl *entries;
15 | size_t count;
16 | } argon2_impl_list;
17 |
18 | void argon2_get_impl_list(argon2_impl_list *list);
19 | void fill_segment_default(const argon2_instance_t *instance,
20 | argon2_position_t position);
21 |
22 | #endif // ARGON2_IMPL_SELECT_H
23 |
24 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/3rdparty/libethash/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required (VERSION 2.8.12)
2 | project (ethash C)
3 |
4 | set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Os")
5 |
6 | set(HEADERS
7 | data_sizes.h
8 | endian.h
9 | ethash.h
10 | ethash_internal.h
11 | fnv.h
12 | )
13 |
14 | set(SOURCES
15 | ethash_internal.c
16 | keccakf800.c
17 | )
18 |
19 | include_directories(../..)
20 |
21 | add_library(ethash STATIC
22 | ${HEADERS}
23 | ${SOURCES}
24 | )
25 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/crypto/cn/c_jh.h:
--------------------------------------------------------------------------------
1 | /*This program gives the 64-bit optimized bitslice implementation of JH using ANSI C
2 |
3 | --------------------------------
4 | Performance
5 |
6 | Microprocessor: Intel CORE 2 processor (Core 2 Duo Mobile T6600 2.2GHz)
7 | Operating System: 64-bit Ubuntu 10.04 (Linux kernel 2.6.32-22-generic)
8 | Speed for long message:
9 | 1) 45.8 cycles/byte compiler: Intel C++ Compiler 11.1 compilation option: icc -O2
10 | 2) 56.8 cycles/byte compiler: gcc 4.4.3 compilation option: gcc -O3
11 |
12 | --------------------------------
13 | Last Modified: January 16, 2011
14 | */
15 | #pragma once
16 |
17 | #include "hash.h"
18 |
19 | HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
20 |
--------------------------------------------------------------------------------
/src/Native/libcryptonight/xmrig/crypto/cn/hash.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | typedef unsigned char BitSequence;
4 | typedef unsigned long long DataLength;
5 | typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
6 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/common/pod-class.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #pragma once
6 |
7 | #if defined(_MSC_VER)
8 | #define POD_CLASS struct
9 | #else
10 | #define POD_CLASS class
11 | #endif
12 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/contrib/epee/README.md:
--------------------------------------------------------------------------------
1 | epee - is a small library of helpers, wrappers, tools and and so on, used to make my life easier.
--------------------------------------------------------------------------------
/src/Native/libcryptonote/contrib/epee/include/pragma_comp_defs.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(__GNUC__)
4 | #define PRAGMA_WARNING_PUSH _Pragma("GCC diagnostic push")
5 | #define PRAGMA_WARNING_POP _Pragma("GCC diagnostic pop")
6 | #define PRAGMA_WARNING_DISABLE_VS(w)
7 | #define PRAGMA_GCC(w) _Pragma(w)
8 | #elif defined(_MSC_VER)
9 | #define PRAGMA_WARNING_PUSH __pragma(warning( push ))
10 | #define PRAGMA_WARNING_POP __pragma(warning( pop ))
11 | #define PRAGMA_WARNING_DISABLE_VS(w) __pragma( warning ( disable: w ))
12 | //#define PRAGMA_WARNING_DISABLE_GCC(w)
13 | #define PRAGMA_GCC(w)
14 | #endif
15 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/contrib/epee/include/warnings.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(_MSC_VER)
4 |
5 | #define PUSH_WARNINGS __pragma(warning(push))
6 | #define POP_WARNINGS __pragma(warning(pop))
7 | #define DISABLE_VS_WARNINGS(w) __pragma(warning(disable: w))
8 | #define DISABLE_GCC_WARNING(w)
9 | #define DISABLE_CLANG_WARNING(w)
10 | #define DISABLE_GCC_AND_CLANG_WARNING(w)
11 |
12 | #else
13 |
14 | #include
15 |
16 | #define PUSH_WARNINGS _Pragma("GCC diagnostic push")
17 | #define POP_WARNINGS _Pragma("GCC diagnostic pop")
18 | #define DISABLE_VS_WARNINGS(w)
19 |
20 | #if defined(__clang__)
21 | #define DISABLE_GCC_WARNING(w)
22 | #define DISABLE_CLANG_WARNING DISABLE_GCC_AND_CLANG_WARNING
23 | #else
24 | #define DISABLE_GCC_WARNING DISABLE_GCC_AND_CLANG_WARNING
25 | #define DISABLE_CLANG_WARNING(w)
26 | #endif
27 |
28 | #define DISABLE_GCC_AND_CLANG_WARNING(w) _Pragma(BOOST_PP_STRINGIZE(GCC diagnostic ignored BOOST_PP_STRINGIZE(-W##w)))
29 |
30 | #endif
31 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/crypto/hash.c:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #include
6 | #include
7 | #include
8 |
9 | #include "hash-ops.h"
10 | #include "keccak.h"
11 |
12 | void hash_permutation(union hash_state *state) {
13 | keccakf((uint64_t*)state, 24);
14 | }
15 |
16 | void hash_process(union hash_state *state, const uint8_t *buf, size_t count) {
17 | keccak1600(buf, count, (uint8_t*)state);
18 | }
19 |
20 | void cn_fast_hash(const void *data, size_t length, char *hash) {
21 | union hash_state state;
22 | hash_process(&state, data, length);
23 | memcpy(hash, &state, HASH_SIZE);
24 | }
25 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/crypto/keccak.h:
--------------------------------------------------------------------------------
1 | // keccak.h
2 | // 19-Nov-11 Markku-Juhani O. Saarinen
3 |
4 | #ifndef KECCAK_H
5 | #define KECCAK_H
6 |
7 | #include
8 | #include
9 |
10 | #ifndef KECCAK_ROUNDS
11 | #define KECCAK_ROUNDS 24
12 | #endif
13 |
14 | #ifndef ROTL64
15 | #define ROTL64(x, y) (((x) << (y)) | ((x) >> (64 - (y))))
16 | #endif
17 |
18 | // compute a keccak hash (md) of given byte length from "in"
19 | int keccak(const uint8_t *in, int inlen, uint8_t *md, int mdlen);
20 |
21 | // update the state
22 | void keccakf(uint64_t st[25], int norounds);
23 |
24 | void keccak1600(const uint8_t *in, int inlen, uint8_t *md);
25 |
26 | #endif
27 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/crypto/random.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #pragma once
6 |
7 | #include
8 |
9 | void generate_random_bytes(size_t n, void *result);
10 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/cryptonote_core/difficulty.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #pragma once
6 |
7 | #include
8 | #include
9 |
10 | #include "crypto/hash.h"
11 |
12 | namespace cryptonote
13 | {
14 | typedef std::uint64_t difficulty_type;
15 |
16 | bool check_hash(const crypto::hash &hash, difficulty_type difficulty);
17 | difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties);
18 | difficulty_type next_difficulty(std::vector timestamps, std::vector cumulative_difficulties, size_t target_seconds);
19 | }
20 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/cryptonote_protocol/blobdatatype.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #pragma once
6 |
7 | namespace cryptonote
8 | {
9 | typedef std::string blobdata;
10 | }
11 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/mingw_stubs.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "serialization/variant.h"
6 | #include "serialization/serialization.h"
7 | #include "hex.h"
8 | #include "ringct/rctTypes.h"
9 |
10 | static const char *errorMsg = "Don't call me. I'm a stub";
11 |
12 | std::string epee::to_hex::string(const epee::span src)
13 | {
14 | throw std::runtime_error(errorMsg);
15 | }
16 |
17 | size_t rct::n_bulletproof_max_amounts(const std::vector &proofs)
18 | {
19 | throw std::runtime_error(errorMsg);
20 | }
21 |
22 | extern "C" void cn_slow_hash(const void *data, size_t length, char *hash)
23 | {
24 | throw std::runtime_error(errorMsg);
25 | }
26 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/serialization/binary_utils.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2012-2013 The Cryptonote developers
2 | // Distributed under the MIT/X11 software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #pragma once
6 |
7 | #include
8 | #include "binary_archive.h"
9 |
10 | namespace serialization {
11 |
12 | template
13 | bool parse_binary(const std::string &blob, T &v)
14 | {
15 | std::istringstream istr(blob);
16 | binary_archive iar(istr);
17 | return ::serialization::serialize(iar, v);
18 | }
19 |
20 | template
21 | bool dump_binary(T& v, std::string& blob)
22 | {
23 | std::stringstream ostr;
24 | binary_archive oar(ostr);
25 | bool success = ::serialization::serialize(oar, v);
26 | blob = ostr.str();
27 | return success && ostr.good();
28 | };
29 |
30 | } // namespace serialization
31 |
--------------------------------------------------------------------------------
/src/Native/libcryptonote/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/src/Native/libethhash/Makefile:
--------------------------------------------------------------------------------
1 | CFLAGS += -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable $(CPU_FLAGS) $(HAVE_FEATURE)
2 | CXXFLAGS += -g -Wall -fPIC -fpermissive -O2 -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-sign-compare -std=c++11 $(CPU_FLAGS) $(HAVE_FEATURE)
3 | LDFLAGS += -shared
4 | TARGET = libethhash.so
5 |
6 | OBJECTS = internal.o io.o io_posix.o sha3.o exports.o
7 |
8 | all: $(TARGET)
9 |
10 | $(TARGET): $(OBJECTS)
11 | $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
12 |
13 | .PHONY: clean
14 |
15 | clean:
16 | $(RM) $(TARGET) $(OBJECTS)
17 |
--------------------------------------------------------------------------------
/src/Native/libethhash/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | BOOL APIENTRY DllMain( HMODULE hModule,
5 | DWORD ul_reason_for_call,
6 | LPVOID lpReserved
7 | )
8 | {
9 | switch (ul_reason_for_call)
10 | {
11 | case DLL_PROCESS_ATTACH:
12 | case DLL_THREAD_ATTACH:
13 | case DLL_THREAD_DETACH:
14 | case DLL_PROCESS_DETACH:
15 | break;
16 | }
17 | return TRUE;
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/src/Native/libethhash/sha3.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #ifdef __cplusplus
4 | extern "C" {
5 | #endif
6 |
7 | #include "compiler.h"
8 | #include
9 | #include
10 |
11 | struct ethash_h256;
12 |
13 | #define decsha3(bits) \
14 | int sha3_##bits(uint8_t*, size_t, uint8_t const*, size_t);
15 |
16 | decsha3(256)
17 | decsha3(512)
18 |
19 | static inline void SHA3_256(struct ethash_h256 const* ret, uint8_t const* data, size_t const size)
20 | {
21 | sha3_256((uint8_t*)ret, 32, data, size);
22 | }
23 |
24 | static inline void SHA3_512(uint8_t* ret, uint8_t const* data, size_t const size)
25 | {
26 | sha3_512(ret, 64, data, size);
27 | }
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
--------------------------------------------------------------------------------
/src/Native/libethhash/sha3_cryptopp.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "compiler.h"
4 | #include
5 | #include
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | struct ethash_h256;
12 |
13 | void SHA3_256(struct ethash_h256 const* ret, uint8_t const* data, size_t size);
14 | void SHA3_512(uint8_t* const ret, uint8_t const* data, size_t size);
15 |
16 | #ifdef __cplusplus
17 | }
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/Native/libethhash/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // $safeprojectname$.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/Native/libethhash/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
11 | // Windows Header Files:
12 | #include
13 |
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/Native/libethhash/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/core.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_core_H
3 | #define sodium_core_H
4 |
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | SODIUM_EXPORT
12 | int sodium_init(void)
13 | __attribute__ ((warn_unused_result));
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_core_hchacha20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_hchacha20_H
2 | #define crypto_core_hchacha20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_hchacha20_OUTPUTBYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_core_hchacha20_outputbytes(void);
14 |
15 | #define crypto_core_hchacha20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_hchacha20_inputbytes(void);
18 |
19 | #define crypto_core_hchacha20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_hchacha20_keybytes(void);
22 |
23 | #define crypto_core_hchacha20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_hchacha20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_hchacha20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_core_hsalsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_hsalsa20_H
2 | #define crypto_core_hsalsa20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_hsalsa20_OUTPUTBYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_core_hsalsa20_outputbytes(void);
14 |
15 | #define crypto_core_hsalsa20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_hsalsa20_inputbytes(void);
18 |
19 | #define crypto_core_hsalsa20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_hsalsa20_keybytes(void);
22 |
23 | #define crypto_core_hsalsa20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_hsalsa20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_hsalsa20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_core_salsa20.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa20_H
2 | #define crypto_core_salsa20_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa20_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa20_outputbytes(void);
14 |
15 | #define crypto_core_salsa20_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa20_inputbytes(void);
18 |
19 | #define crypto_core_salsa20_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa20_keybytes(void);
22 |
23 | #define crypto_core_salsa20_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa20_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa20(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_core_salsa2012.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa2012_H
2 | #define crypto_core_salsa2012_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa2012_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa2012_outputbytes(void);
14 |
15 | #define crypto_core_salsa2012_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa2012_inputbytes(void);
18 |
19 | #define crypto_core_salsa2012_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa2012_keybytes(void);
22 |
23 | #define crypto_core_salsa2012_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa2012_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa2012(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_core_salsa208.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_core_salsa208_H
2 | #define crypto_core_salsa208_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_core_salsa208_OUTPUTBYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_core_salsa208_outputbytes(void);
14 |
15 | #define crypto_core_salsa208_INPUTBYTES 16U
16 | SODIUM_EXPORT
17 | size_t crypto_core_salsa208_inputbytes(void);
18 |
19 | #define crypto_core_salsa208_KEYBYTES 32U
20 | SODIUM_EXPORT
21 | size_t crypto_core_salsa208_keybytes(void);
22 |
23 | #define crypto_core_salsa208_CONSTBYTES 16U
24 | SODIUM_EXPORT
25 | size_t crypto_core_salsa208_constbytes(void);
26 |
27 | SODIUM_EXPORT
28 | int crypto_core_salsa208(unsigned char *out, const unsigned char *in,
29 | const unsigned char *k, const unsigned char *c);
30 |
31 | #ifdef __cplusplus
32 | }
33 | #endif
34 |
35 | #endif
36 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_scalarmult_curve25519.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_scalarmult_curve25519_H
2 | #define crypto_scalarmult_curve25519_H
3 |
4 | #include
5 |
6 | #include "export.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | #define crypto_scalarmult_curve25519_BYTES 32U
13 | SODIUM_EXPORT
14 | size_t crypto_scalarmult_curve25519_bytes(void);
15 |
16 | #define crypto_scalarmult_curve25519_SCALARBYTES 32U
17 | SODIUM_EXPORT
18 | size_t crypto_scalarmult_curve25519_scalarbytes(void);
19 |
20 | SODIUM_EXPORT
21 | int crypto_scalarmult_curve25519(unsigned char *q, const unsigned char *n,
22 | const unsigned char *p)
23 | __attribute__ ((warn_unused_result));
24 |
25 | SODIUM_EXPORT
26 | int crypto_scalarmult_curve25519_base(unsigned char *q, const unsigned char *n);
27 |
28 | #ifdef __cplusplus
29 | }
30 | #endif
31 |
32 | #endif
33 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_verify_16.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_16_H
2 | #define crypto_verify_16_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_16_BYTES 16U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_16_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_16(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_verify_32.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_32_H
2 | #define crypto_verify_32_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_32_BYTES 32U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_32_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_32(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/crypto_verify_64.h:
--------------------------------------------------------------------------------
1 | #ifndef crypto_verify_64_H
2 | #define crypto_verify_64_H
3 |
4 | #include
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | #define crypto_verify_64_BYTES 64U
12 | SODIUM_EXPORT
13 | size_t crypto_verify_64_bytes(void);
14 |
15 | SODIUM_EXPORT
16 | int crypto_verify_64(const unsigned char *x, const unsigned char *y)
17 | __attribute__ ((warn_unused_result));
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
23 | #endif
24 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/randombytes_salsa20_random.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_salsa20_random_H
3 | #define randombytes_salsa20_random_H
4 |
5 | #include "export.h"
6 | #include "randombytes.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | SODIUM_EXPORT
13 | extern struct randombytes_implementation randombytes_salsa20_implementation;
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/randombytes_sysrandom.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef randombytes_sysrandom_H
3 | #define randombytes_sysrandom_H
4 |
5 | #include "export.h"
6 | #include "randombytes.h"
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | SODIUM_EXPORT
13 | extern struct randombytes_implementation randombytes_sysrandom_implementation;
14 |
15 | #ifdef __cplusplus
16 | }
17 | #endif
18 |
19 | #endif
20 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/runtime.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_runtime_H
3 | #define sodium_runtime_H
4 |
5 | #include "export.h"
6 |
7 | #ifdef __cplusplus
8 | extern "C" {
9 | #endif
10 |
11 | SODIUM_EXPORT
12 | int sodium_runtime_has_neon(void);
13 |
14 | SODIUM_EXPORT
15 | int sodium_runtime_has_sse2(void);
16 |
17 | SODIUM_EXPORT
18 | int sodium_runtime_has_sse3(void);
19 |
20 | SODIUM_EXPORT
21 | int sodium_runtime_has_ssse3(void);
22 |
23 | SODIUM_EXPORT
24 | int sodium_runtime_has_sse41(void);
25 |
26 | SODIUM_EXPORT
27 | int sodium_runtime_has_avx(void);
28 |
29 | SODIUM_EXPORT
30 | int sodium_runtime_has_avx2(void);
31 |
32 | SODIUM_EXPORT
33 | int sodium_runtime_has_pclmul(void);
34 |
35 | SODIUM_EXPORT
36 | int sodium_runtime_has_aesni(void);
37 |
38 | /* ------------------------------------------------------------------------- */
39 |
40 | int _sodium_runtime_get_cpu_features(void);
41 |
42 | #ifdef __cplusplus
43 | }
44 | #endif
45 |
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/include/libsodium/sodium/version.h:
--------------------------------------------------------------------------------
1 |
2 | #ifndef sodium_version_H
3 | #define sodium_version_H
4 |
5 | #include "export.h"
6 |
7 | #define SODIUM_VERSION_STRING "1.0.13"
8 |
9 | #define SODIUM_LIBRARY_VERSION_MAJOR 9
10 | #define SODIUM_LIBRARY_VERSION_MINOR 5
11 |
12 |
13 | #ifdef __cplusplus
14 | extern "C" {
15 | #endif
16 |
17 | SODIUM_EXPORT
18 | const char *sodium_version_string(void);
19 |
20 | SODIUM_EXPORT
21 | int sodium_library_version_major(void);
22 |
23 | SODIUM_EXPORT
24 | int sodium_library_version_minor(void);
25 |
26 | SODIUM_EXPORT
27 | int sodium_library_minimal(void);
28 |
29 | #ifdef __cplusplus
30 | }
31 | #endif
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/lib/x64/libsodium.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libethhash/windows/lib/x64/libsodium.lib
--------------------------------------------------------------------------------
/src/Native/libethhash/windows/lib/x86/libsodium.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libethhash/windows/lib/x86/libsodium.lib
--------------------------------------------------------------------------------
/src/Native/libkawpow/Makefile:
--------------------------------------------------------------------------------
1 | CFLAGS += -g -Wall -c -fPIC -O2 -Wno-pointer-sign -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-discarded-qualifiers -Wno-unused-const-variable $(CPU_FLAGS)
2 | CXXFLAGS += -g -Wall -fPIC -fpermissive -O2 -Wno-char-subscripts -Wno-unused-variable -Wno-unused-function -Wno-strict-aliasing -Wno-sign-compare -std=c++11 $(CPU_FLAGS)
3 | LDFLAGS += -shared
4 | TARGET = libkawpow.so
5 |
6 | OBJECTS = ethash/ethash.o keccak/keccak.o keccak/keccakf800.o keccak/keccakf1600.o ethash/managed.o ethash/primes.o ethash/progpow.o
7 |
8 | all: $(TARGET)
9 |
10 | $(TARGET): $(OBJECTS)
11 | $(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
12 |
13 | .PHONY: clean
14 |
15 | clean:
16 | $(RM) $(TARGET) $(OBJECTS)
17 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/attributes.h:
--------------------------------------------------------------------------------
1 | /* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | * Copyright 2018-2019 Pawel Bylica.
3 | * Licensed under the Apache License, Version 2.0.
4 | */
5 |
6 | #pragma once
7 |
8 | /** inline */
9 | #if _MSC_VER || __STDC_VERSION__
10 | #define INLINE inline
11 | #else
12 | #define INLINE
13 | #endif
14 |
15 | /** [[always_inline]] */
16 | #if _MSC_VER
17 | #define ALWAYS_INLINE __forceinline
18 | #elif defined(__has_attribute) && __STDC_VERSION__
19 | #if __has_attribute(always_inline)
20 | #define ALWAYS_INLINE __attribute__((always_inline))
21 | #endif
22 | #endif
23 | #if !defined(ALWAYS_INLINE)
24 | #define ALWAYS_INLINE
25 | #endif
26 |
27 | /** [[no_sanitize()]] */
28 | #if __clang__
29 | #define NO_SANITIZE(sanitizer) \
30 | __attribute__((no_sanitize(sanitizer)))
31 | #else
32 | #define NO_SANITIZE(sanitizer)
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | BOOL APIENTRY DllMain( HMODULE hModule,
5 | DWORD ul_reason_for_call,
6 | LPVOID lpReserved
7 | )
8 | {
9 | switch (ul_reason_for_call)
10 | {
11 | case DLL_PROCESS_ATTACH:
12 | case DLL_THREAD_ATTACH:
13 | case DLL_THREAD_DETACH:
14 | case DLL_PROCESS_DETACH:
15 | break;
16 | }
17 | return TRUE;
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/ethash/hash_types.hpp:
--------------------------------------------------------------------------------
1 | // ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | // Copyright 2018-2019 Pawel Bylica.
3 | // Licensed under the Apache License, Version 2.0.
4 |
5 | #pragma once
6 |
7 | #include "hash_types.h"
8 |
9 | namespace ethash
10 | {
11 | using hash256 = ethash_hash256;
12 | using hash512 = ethash_hash512;
13 | using hash1024 = ethash_hash1024;
14 | using hash2048 = ethash_hash2048;
15 | } // namespace ethash
16 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/ethash/primes.h:
--------------------------------------------------------------------------------
1 | /* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | * Copyright 2018-2019 Pawel Bylica.
3 | * Licensed under the Apache License, Version 2.0.
4 | */
5 |
6 | #pragma once
7 |
8 | #include "ethash.h"
9 |
10 | #ifdef __cplusplus
11 | extern "C" {
12 | #endif
13 |
14 | /**
15 | * Finds the largest prime number not greater than the provided upper bound.
16 | *
17 | * @param upper_bound The upper bound. SHOULD be greater than 1.
18 | * @return The largest prime number `p` such `p <= upper_bound`.
19 | * In case `upper_bound <= 1`, returns 0.
20 | */
21 | int ethash_find_largest_prime(int upper_bound) NOEXCEPT;
22 |
23 | #ifdef __cplusplus
24 | }
25 | #endif
26 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/ethash/version.h:
--------------------------------------------------------------------------------
1 | /* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | * Copyright 2019 Pawel Bylica.
3 | * Licensed under the Apache License, Version 2.0.
4 | */
5 |
6 | #pragma once
7 |
8 | /** The ethash library version. */
9 | #define ETHASH_VERSION "0.5.1-alpha.1"
10 |
11 | #ifdef __cplusplus
12 | namespace ethash
13 | {
14 | /// The ethash library version.
15 | constexpr auto version = ETHASH_VERSION;
16 |
17 | } // namespace ethash
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/keccak/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | # Copyright 2019 Pawel Bylica.
3 | # Licensed under the Apache License, Version 2.0.
4 |
5 | include(CMakePackageConfigHelpers)
6 | include(GNUInstallDirs)
7 |
8 | add_library(
9 | keccak
10 | ${include_dir}/ethash/keccak.h
11 | ${include_dir}/ethash/keccak.hpp
12 | keccak.c
13 | keccakf800.c
14 | keccakf1600.c
15 | )
16 | set_property(TARGET keccak PROPERTY POSITION_INDEPENDENT_CODE ON)
17 |
18 | target_include_directories(keccak PUBLIC $$)
19 |
20 | install(
21 | TARGETS keccak
22 | EXPORT ethashTargets
23 | ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
24 | LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
25 | RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
26 | )
27 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/stdafx.cpp:
--------------------------------------------------------------------------------
1 | // stdafx.cpp : source file that includes just the standard includes
2 | // $safeprojectname$.pch will be the pre-compiled header
3 | // stdafx.obj will contain the pre-compiled type information
4 |
5 | #include "stdafx.h"
6 |
7 | // TODO: reference any additional headers you need in STDAFX.H
8 | // and not in this file
9 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/stdafx.h:
--------------------------------------------------------------------------------
1 | // stdafx.h : include file for standard system include files,
2 | // or project specific include files that are used frequently, but
3 | // are changed infrequently
4 | //
5 |
6 | #pragma once
7 |
8 | #include "targetver.h"
9 |
10 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
11 | // Windows Header Files:
12 | #include
13 |
14 |
15 |
16 | // TODO: reference additional headers your program requires here
17 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/support/attributes.h:
--------------------------------------------------------------------------------
1 | /* ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
2 | * Copyright 2018-2019 Pawel Bylica.
3 | * Licensed under the Apache License, Version 2.0.
4 | */
5 |
6 | #pragma once
7 |
8 | /** inline */
9 | #if _MSC_VER || __STDC_VERSION__
10 | #define INLINE inline
11 | #else
12 | #define INLINE
13 | #endif
14 |
15 | /** [[always_inline]] */
16 | #if _MSC_VER
17 | #define ALWAYS_INLINE __forceinline
18 | #elif defined(__has_attribute) && __STDC_VERSION__
19 | #if __has_attribute(always_inline)
20 | #define ALWAYS_INLINE __attribute__((always_inline))
21 | #endif
22 | #endif
23 | #if !defined(ALWAYS_INLINE)
24 | #define ALWAYS_INLINE
25 | #endif
26 |
27 | /** [[no_sanitize()]] */
28 | #if __clang__
29 | #define NO_SANITIZE(sanitizer) \
30 | __attribute__((no_sanitize(sanitizer)))
31 | #else
32 | #define NO_SANITIZE(sanitizer)
33 | #endif
34 |
--------------------------------------------------------------------------------
/src/Native/libkawpow/targetver.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | // Including SDKDDKVer.h defines the highest available Windows platform.
4 |
5 | // If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
6 | // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
7 |
8 | #include
9 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/Lyra2RE.h:
--------------------------------------------------------------------------------
1 | #ifndef LYRA2RE_H
2 | #define LYRA2RE_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | void lyra2re_hash(const char* input, char* output);
9 | void lyra2re2_hash(const char* input, char* output);
10 | void lyra2re3_hash(const char* input, char* output);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/bcrypt.h:
--------------------------------------------------------------------------------
1 | #ifndef BCRYPT_H
2 | #define BCRYPT_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | void bcrypt_hash(const char *input, char *output);
9 |
10 | #ifdef __cplusplus
11 | }
12 | #endif
13 |
14 | #endif
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake.c:
--------------------------------------------------------------------------------
1 | #include "blake.h"
2 | #include
3 | #include
4 | #include
5 | #include
6 |
7 | #include "sha3/sph_blake.h"
8 |
9 |
10 | void blake_hash(const char* input, char* output, uint32_t len)
11 | {
12 | sph_blake256_context ctx_blake;
13 | sph_blake256_init(&ctx_blake);
14 | sph_blake256(&ctx_blake, input, len);
15 | sph_blake256_close(&ctx_blake, output);
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake.h:
--------------------------------------------------------------------------------
1 | #ifndef BLAKE_H
2 | #define BLAKE_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void blake_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2b:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2b
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2bp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2bp
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2s:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2s
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2sp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2sp
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2xb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2xb
--------------------------------------------------------------------------------
/src/Native/libmultihash/blake2/sse/blake2xs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/oliverw/miningcore/a553f62301f44c6df80891e408b6526d1dd98692/src/Native/libmultihash/blake2/sse/blake2xs
--------------------------------------------------------------------------------
/src/Native/libmultihash/boolberry.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include
4 | #include
5 |
6 | void boolberry_hash(const char* input, uint32_t input_len, const char* scratchpad, uint64_t spad_length, char* output, uint64_t height);
7 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/c11.h:
--------------------------------------------------------------------------------
1 | #ifndef C11_H
2 | #define C11_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void c11_hash(const char* input, char* output);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/dcrypt.h:
--------------------------------------------------------------------------------
1 | #ifndef DCRYPT_H
2 | #define DCRYPT_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void dcrypt_hash(const char* input, char* hash, uint32_t len);
11 |
12 |
13 | #ifdef __cplusplus
14 | }
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/dllmain.cpp:
--------------------------------------------------------------------------------
1 | // dllmain.cpp : Defines the entry point for the DLL application.
2 | #include "stdafx.h"
3 |
4 | BOOL APIENTRY DllMain( HMODULE hModule,
5 | DWORD ul_reason_for_call,
6 | LPVOID lpReserved
7 | )
8 | {
9 | switch (ul_reason_for_call)
10 | {
11 | case DLL_PROCESS_ATTACH:
12 | case DLL_THREAD_ATTACH:
13 | case DLL_THREAD_DETACH:
14 | case DLL_PROCESS_DETACH:
15 | break;
16 | }
17 | return TRUE;
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/crypto/hmac_sha256.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 The Bitcoin Core developers
2 | // Distributed under the MIT software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #ifndef BITCOIN_CRYPTO_HMAC_SHA256_H
6 | #define BITCOIN_CRYPTO_HMAC_SHA256_H
7 |
8 | #include "sha256.h"
9 |
10 | #include
11 | #include
12 |
13 | /** A hasher class for HMAC-SHA-512. */
14 | class CHMAC_SHA256
15 | {
16 | private:
17 | CSHA256 outer;
18 | CSHA256 inner;
19 |
20 | public:
21 | static const size_t OUTPUT_SIZE = 32;
22 |
23 | CHMAC_SHA256(const unsigned char* key, size_t keylen);
24 | CHMAC_SHA256& Write(const unsigned char* data, size_t len)
25 | {
26 | inner.Write(data, len);
27 | return *this;
28 | }
29 | void Finalize(unsigned char hash[OUTPUT_SIZE]);
30 | };
31 |
32 | #endif // BITCOIN_CRYPTO_HMAC_SHA256_H
33 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/crypto/hmac_sha512.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 The Bitcoin Core developers
2 | // Distributed under the MIT software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #ifndef BITCOIN_CRYPTO_HMAC_SHA512_H
6 | #define BITCOIN_CRYPTO_HMAC_SHA512_H
7 |
8 | #include "sha512.h"
9 |
10 | #include
11 | #include
12 |
13 | /** A hasher class for HMAC-SHA-512. */
14 | class CHMAC_SHA512
15 | {
16 | private:
17 | CSHA512 outer;
18 | CSHA512 inner;
19 |
20 | public:
21 | static const size_t OUTPUT_SIZE = 64;
22 |
23 | CHMAC_SHA512(const unsigned char* key, size_t keylen);
24 | CHMAC_SHA512& Write(const unsigned char* data, size_t len)
25 | {
26 | inner.Write(data, len);
27 | return *this;
28 | }
29 | void Finalize(unsigned char hash[OUTPUT_SIZE]);
30 | };
31 |
32 | #endif // BITCOIN_CRYPTO_HMAC_SHA512_H
33 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/crypto/ripemd160.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 The Bitcoin Core developers
2 | // Distributed under the MIT software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #ifndef BITCOIN_CRYPTO_RIPEMD160_H
6 | #define BITCOIN_CRYPTO_RIPEMD160_H
7 |
8 | #include
9 | #include
10 |
11 | /** A hasher class for RIPEMD-160. */
12 | class CRIPEMD160
13 | {
14 | private:
15 | uint32_t s[5];
16 | unsigned char buf[64];
17 | size_t bytes;
18 |
19 | public:
20 | static const size_t OUTPUT_SIZE = 20;
21 |
22 | CRIPEMD160();
23 | CRIPEMD160& Write(const unsigned char* data, size_t len);
24 | void Finalize(unsigned char hash[OUTPUT_SIZE]);
25 | CRIPEMD160& Reset();
26 | };
27 |
28 | #endif // BITCOIN_CRYPTO_RIPEMD160_H
29 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/crypto/sha1.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 The Bitcoin Core developers
2 | // Distributed under the MIT software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #ifndef BITCOIN_CRYPTO_SHA1_H
6 | #define BITCOIN_CRYPTO_SHA1_H
7 |
8 | #include
9 | #include
10 |
11 | /** A hasher class for SHA1. */
12 | class CSHA1
13 | {
14 | private:
15 | uint32_t s[5];
16 | unsigned char buf[64];
17 | size_t bytes;
18 |
19 | public:
20 | static const size_t OUTPUT_SIZE = 20;
21 |
22 | CSHA1();
23 | CSHA1& Write(const unsigned char* data, size_t len);
24 | void Finalize(unsigned char hash[OUTPUT_SIZE]);
25 | CSHA1& Reset();
26 | };
27 |
28 | #endif // BITCOIN_CRYPTO_SHA1_H
29 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/crypto/sha512.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2014 The Bitcoin Core developers
2 | // Distributed under the MIT software license, see the accompanying
3 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4 |
5 | #ifndef BITCOIN_CRYPTO_SHA512_H
6 | #define BITCOIN_CRYPTO_SHA512_H
7 |
8 | #include
9 | #include
10 |
11 | /** A hasher class for SHA-512. */
12 | class CSHA512
13 | {
14 | private:
15 | uint64_t s[8];
16 | unsigned char buf[128];
17 | size_t bytes;
18 |
19 | public:
20 | static const size_t OUTPUT_SIZE = 64;
21 |
22 | CSHA512();
23 | CSHA512& Write(const unsigned char* data, size_t len);
24 | void Finalize(unsigned char hash[OUTPUT_SIZE]);
25 | CSHA512& Reset();
26 | };
27 |
28 | #endif // BITCOIN_CRYPTO_SHA512_H
29 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/equihashverify.h:
--------------------------------------------------------------------------------
1 | #ifndef EQUIHASHVERIFY_H
2 | #define EQUIHASHVERIFY_H
3 |
4 | #include
5 |
6 | #ifdef __cplusplus
7 | extern "C" {
8 | #endif
9 |
10 | bool verifyEH_200_9(const char*, const std::vector&, const char *personalization);
11 | bool verifyEH_144_5(const char*, const std::vector&, const char *personalization);
12 | bool verifyEH_96_5(const char*, const std::vector&, const char *personalization);
13 |
14 | #ifdef __cplusplus
15 | }
16 | #endif
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/support/cleanse.cpp:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009-2010 Satoshi Nakamoto
2 | // Copyright (c) 2009-2015 The Bitcoin Core developers
3 | // Distributed under the MIT software license, see the accompanying
4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 |
6 | #include "cleanse.h"
7 |
8 | #ifndef _WIN32
9 | #include
10 | #else
11 | #include
12 | #endif
13 |
14 | void memory_cleanse(void *ptr, size_t len)
15 | {
16 | #ifndef _WIN32
17 | OPENSSL_cleanse(ptr, len);
18 | #else
19 | ZeroMemory(ptr, 0, len);
20 | #endif
21 | }
22 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/equi/support/cleanse.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009-2010 Satoshi Nakamoto
2 | // Copyright (c) 2009-2015 The Bitcoin Core developers
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 BITCOIN_SUPPORT_CLEANSE_H
7 | #define BITCOIN_SUPPORT_CLEANSE_H
8 |
9 | #include
10 |
11 | void memory_cleanse(void *ptr, size_t len);
12 |
13 | #endif // BITCOIN_SUPPORT_CLEANSE_H
14 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/fresh.h:
--------------------------------------------------------------------------------
1 | #ifndef FRESH_H
2 | #define FRESH_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void fresh_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/fugue.c:
--------------------------------------------------------------------------------
1 | #include "fugue.h"
2 |
3 | #include "sha3/sph_fugue.h"
4 |
5 | void fugue_hash(const char* input, char* output, uint32_t len)
6 | {
7 | sph_fugue256_context ctx_fugue;
8 | sph_fugue256_init(&ctx_fugue);
9 | sph_fugue256(&ctx_fugue, input, len);
10 | sph_fugue256_close(&ctx_fugue, output);
11 | }
12 |
13 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/fugue.h:
--------------------------------------------------------------------------------
1 | #ifndef FUGUE_H
2 | #define FUGUE_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void fugue_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/geek.h:
--------------------------------------------------------------------------------
1 | #ifndef GEEK_H
2 | #define GEEK_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void geek_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/groestl.h:
--------------------------------------------------------------------------------
1 | #ifndef GROESTL_H
2 | #define GROESTL_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void groestl_hash(const char* input, char* output, uint32_t len);
11 | void groestlmyriad_hash(const char* input, char* output, uint32_t len);
12 |
13 | #ifdef __cplusplus
14 | }
15 | #endif
16 |
17 | #endif
18 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/hashodo.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2009-2010 Satoshi Nakamoto
2 | // Copyright (c) 2009-2018 The DigiByte developers
3 | // Distributed under the MIT/X11 software license, see the accompanying
4 | // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 |
6 | #ifndef HASH_ODO
7 | #define HASH_ODO
8 |
9 | #include
10 | #include
11 |
12 | #include "odocrypt.h"
13 | extern "C" {
14 | #include "KeccakP-800-SnP.h"
15 | }
16 |
17 | inline void odocrypt_hash(const char* input, char* output, uint32_t len, uint32_t key)
18 | {
19 | char cipher[KeccakP800_stateSizeInBytes] = {};
20 |
21 | assert(len <= OdoCrypt::DIGEST_SIZE);
22 | assert(OdoCrypt::DIGEST_SIZE < KeccakP800_stateSizeInBytes);
23 | memcpy(cipher, static_cast(input), len);
24 | cipher[len] = 1;
25 |
26 | OdoCrypt(key).Encrypt(cipher, cipher);
27 | KeccakP800_Permute_12rounds(cipher);
28 | memcpy(output, cipher, 32);
29 | }
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/heavyhash/heavyhash.h:
--------------------------------------------------------------------------------
1 | #ifndef OPOWPOOL_HEAVYHASH_H
2 | #define OPOWPOOL_HEAVYHASH_H
3 |
4 |
5 |
6 | //void compute_blockheader_heavyhash(uint32_t* block_header, void* output);
7 |
8 | // yiimp format
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | #include
14 | void heavyhash_hash(const char* input, char* output, uint32_t len);
15 |
16 |
17 | #ifdef __cplusplus
18 | }
19 | #endif
20 |
21 | #endif //OPOWPOOL_HEAVYHASH_H
--------------------------------------------------------------------------------
/src/Native/libmultihash/heavyhash/keccak_tiny.h:
--------------------------------------------------------------------------------
1 | #ifndef KECCAK_FIPS202_H
2 | #define KECCAK_FIPS202_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 |
9 | #include
10 | #include
11 |
12 | #define decshake(bits) \
13 | int shake##bits(uint8_t*, size_t, const uint8_t*, size_t);
14 |
15 | #define decsha3(bits) \
16 | int sha3_##bits(uint8_t*, size_t, const uint8_t*, size_t);
17 |
18 | decshake(128)
19 | decshake(256)
20 | decsha3(224)
21 | decsha3(256)
22 | decsha3(384)
23 | decsha3(512)
24 |
25 | #ifdef __cplusplus
26 | }
27 | #endif
28 |
29 | #endif
--------------------------------------------------------------------------------
/src/Native/libmultihash/hefty1.h:
--------------------------------------------------------------------------------
1 | #ifndef HEFTY1_H
2 | #define HEFTY1_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void hefty1_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/hmq17.h:
--------------------------------------------------------------------------------
1 | #ifndef HMQ17_H
2 | #define HMQ17_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void hmq17_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/jh.c:
--------------------------------------------------------------------------------
1 | #include "jh.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include "sha3/sph_jh.h"
8 |
9 |
10 | void jh_hash(const char* input, char* output, uint32_t len) {
11 |
12 | sph_jh256_context ctx_jh;
13 | sph_jh256_init(&ctx_jh);
14 | sph_jh256 (&ctx_jh, input, len);
15 | sph_jh256_close(&ctx_jh, output);
16 |
17 | }
18 |
19 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/jh.h:
--------------------------------------------------------------------------------
1 | #ifndef JHA_H
2 | #define JHA_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void jh_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/keccak.c:
--------------------------------------------------------------------------------
1 | #include "keccak.h"
2 |
3 | #include "sha3/sph_types.h"
4 | #include "sha3/sph_keccak.h"
5 |
6 |
7 | void keccak_hash(const char* input, char* output, uint32_t size)
8 | {
9 | sph_keccak256_context ctx_keccak;
10 | sph_keccak256_init(&ctx_keccak);
11 | sph_keccak256 (&ctx_keccak, input, size);//80);
12 | sph_keccak256_close(&ctx_keccak, output);
13 | }
14 |
15 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/keccak.h:
--------------------------------------------------------------------------------
1 | #ifndef KECCAK_H
2 | #define KECCAK_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void keccak_hash(const char* input, char* output, uint32_t size);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/net-core-test/net-core-test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp1.1
6 |
7 |
8 |
9 | True
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/nist5.h:
--------------------------------------------------------------------------------
1 | #ifndef NIST5_H
2 | #define NIST5_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void nist5_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
--------------------------------------------------------------------------------
/src/Native/libmultihash/phi.h:
--------------------------------------------------------------------------------
1 | #ifndef PHI_H
2 | #define PHI_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void phi_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/quark.h:
--------------------------------------------------------------------------------
1 | #ifndef QUARK_H
2 | #define QUARK_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void quark_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/qubit.h:
--------------------------------------------------------------------------------
1 | #ifndef QUBIT_H
2 | #define QUBIT_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void qubit_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/s3.h:
--------------------------------------------------------------------------------
1 | #ifndef S3_H
2 | #define S3_H
3 |
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | #include
9 |
10 | void s3_hash(const char* input, char* output, uint32_t len);
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/scryptn.h:
--------------------------------------------------------------------------------
1 | #ifndef SCRYPTN_H
2 | #define SCRYPTN_H
3 | #include
4 | #ifdef __cplusplus
5 | extern "C" {
6 | #endif
7 |
8 | void scrypt_N_R_1_256(const char* input, char* output, uint32_t N, uint32_t R, uint32_t len);
9 | void scrypt_N_R_1_256_sp(const char* input, char* output, char* scratchpad, uint32_t N, uint32_t R, uint32_t len);
10 | //const int scrypt_scratchpad_size = 131583;
11 |
12 | #ifdef __cplusplus
13 | }
14 | #endif
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/src/Native/libmultihash/sha256csm.c:
--------------------------------------------------------------------------------
1 | #include "sha256csm.h"
2 | #include
3 | #include
4 | #include