GithubHelp home page GithubHelp logo

xcgtech / wallet Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 5.0 30.82 MB

XCG wallet for block info visit https://blockstats.pw/xchange/

License: MIT License

Makefile 0.95% Shell 0.46% M4 1.53% QMake 0.02% Roff 0.03% Python 6.86% C++ 52.02% C 36.29% Objective-C 0.04% HTML 0.46% CSS 1.26% Objective-C++ 0.07% QML 0.01% Java 0.02%

wallet's Introduction

Xchange Core staging tree 0.24.2

This repository contains the core for XCG - Xchange.

This version DOES NOT contain the Escrow or Auction (Coming Soon) features.

https://www.xcgtech.com

What is Xchange?

Xchange is an experimental new digital currency that enables anonymous, instant payments to anyone, anywhere in the world. Xchange uses peer-to-peer technology to operate with no central authority: managing transactions and issuing money are carried out collectively by the network. Xchange Core is the name of the open source software which enables the use of this currency.

For more information, as well as an immediately useable, binary version of the Xchange Core software, see https://www.xcgtech.comm

License

Xchange Core is released under the terms of the MIT license. See COPYING for more information or see https://opensource.org/licenses/MIT.

Development

Development for XCG - Xchange, specifically the Qt client, is done on a private branch and only the core functionality required for network sync is pushed to this open-source repository.

GUI clients built from this repository will not have the escrow, auction, and other functionalities.

wallet's People

Contributors

cryptforall avatar znuff avatar xcgtech avatar

Stargazers

 avatar AyzeLYC avatar  avatar ZeroCool_NT avatar  avatar Angry Llama avatar AdministerTech LLC avatar  avatar changtianyu avatar  avatar

Watchers

 avatar AyzeLYC avatar  avatar  avatar AdministerTech LLC avatar

wallet's Issues

Ideal Miner software for XCG

The best way to save energy and mine, would be a miner program designed for XCG

Areas that would need adjustment:

  • When mining a block the first 70 secs from the last block, set miners at the the lowest or minimal mining hash or just leave the CPU mining minimal.
  • Use full force from 70 secs until solution is found. (all mining hard ware at max)
  • If a block is solved between 70-72 seconds, set next hash rate at minimal until 150 secs
    for the next block. (using the previous block timestamp)
  • When the time passes 150 sec for the adjustment block, its a low diff block that is mine-able by majority mining hardware. At this point you can set all hardware to max
  • Diff should be constantly changing per second, so updating the diff per second would be ideal.
  • Diff can range from The highest possible value to 0 in any block.

V 0.24.1 xBuffer TSA implementation

Xbuffer/TSA:

  • First true 51 % attack prevention
  • Dependent on Time, uses solve time, ST.
  • 70 sec Min and 180 sec Max block times
  • CPU mining profitable in wallet
  • Rejects pools with on and off mining
  • Short term NH and MRR are considered inefficient
  • No delays with high hash drop off in blocks
  • long term miners benefit the most
  • requires update to explorers
  • The difficulty (D) is not a dependent factor when ST moves from expected block time and adjustments are made
  • D is set as a high and is unlikely solvable for 70 sec, then 70 sec of fair zone mining
  • if the buffer overloads and breaks before 70 secs, the next block D is greatly increased for 70 secs.
  • at 150 secs to the Max block time the block is more dependent of latency and process speed.
  • Assets on chain can survive a sudden black out with only 2 peers remaining and have no block ST delays
  • block time reliability and no hash drop delays in ST.
  • Getdifficulty is actual D that was needed to solve the block at an exact time point.
  • Network Hash(NHPS) is now the actual avg hash/s needed to solve the block.
  • NHPS is an indicator as of what system you fit in, solo or pool mining.
  • Miners Hash rate higher than NHPS are able to solo mine and be successful
  • Hash rate below the avg would do better in a pool or solo expecting, free fall adjustment blocks in increased hash rate
  • increased distribution which prevents market manipulation
  • the ability to change D per process cycle allows for miners to enter the competition, with lower D as ST reaches 150 sec
  • ST reaching 150 to 180 secs, the D will decrease until the lowest limit
  • honest and longer connected miners will benefit from the free fall block system
  • if the block reaches 180 sec, the D reverts back the lowest and enabling CPU mining. If no one can solve it, Start again.
  • On and Off mining attempts will hurt the user and reward the rest of the miners with low D, as the block pull ST towards expect 150 secs. essentially allowing everyone on the network a chance at a block.
unsigned int XbufferTSA(const CBlockHeader* pblock, const Consensus::Params& consensusParams, const CBlockIndex* pindexPrev)
{
    // Xbuffer Xchange (c) 2018 Kalcan
    // TSA Copyright (c) 2018 Zawy, Kalcan (XCG)
    // LWMA Copyright (c) 2017-2018 The Bitcoin Gold developers
    // Specific LWMA updated by iamstenman (MicroBitcoin)
    // MIT License
    // Recommend N=120.  Requires Future Time Limit to be set to 30 instead of 7200
    // See FTL instructions here:
    // https://github.com/zawy12/difficulty-algorithms/issues/3#issuecomment-442129791
    // Important: Pow.cpp is not the only area that needs new conditions or code for TSA.
    // ONLY LWMA and TSA copy between the #######'s
    //################################################################################################################
    // Begin LWMA

    const int64_t T = consensusParams.nPowTargetSpacing;
    const int64_t N = consensusParams.nZawyLwmaAveragingWindow;
    const int64_t k = N * (N + 1) * T / 2;
    const int64_t height = pindexPrev->nHeight;
    const arith_uint256 powLimit = UintToArith256(consensusParams.powLimit);

    // For startup:
    int64_t hashrateGuess = 1000; // hashes per second expected at startup
    arith_uint256 targetGuess = 115E75/(hashrateGuess*T); // 115E75 =~ pow(2,256)

    if ( targetGuess > powLimit ) { targetGuess=powLimit; }
    if ( height <= N+1 ) { return targetGuess.GetCompact(); }

    arith_uint256 sumTarget, previousTarget, nextTarget;
    int64_t thisTimestamp, previousTimestamp;
    int64_t t = 0, j = 0, SumWAvgtime=0, SS=0;   // Remove SS if following only LWMA and TSA

    const CBlockIndex* blockPreviousTimestamp = pindexPrev->GetAncestor(height - N);
    previousTimestamp = blockPreviousTimestamp->GetBlockTime();

    // Loop through N most recent blocks. // LWMA previous target-> bits and Timestamps are the focys
    for (int64_t i = height - N + 1; i <= height; i++) {
          const CBlockIndex* block = pindexPrev->GetAncestor(i);
          thisTimestamp = (block->GetBlockTime() > previousTimestamp) ? block->GetBlockTime() : previousTimestamp + 1;
          int64_t solvetime = std::min(6 * T, thisTimestamp - previousTimestamp);
          previousTimestamp = thisTimestamp;
          SS+=solvetime;
          j++;
          t += solvetime * j; // Weighted solvetime sum.
          arith_uint256 target;
          target.SetCompact(block->nBits);
          sumTarget += target / (k * N);
    }

    nextTarget = t * sumTarget;

    // The above completes the BTG/MicroBitcoin/Zawy code except last 3 lines were removed
    // Now begin TSA.

    // R is the "softness" of the per-block TSA adjustment to the DA. R<6 is aggressive.
    int64_t R = 2;  assert(R > 1);
    // "m" is a factor to help get e^x from integer math. 1E5 was not as precise
    int64_t m = 1E6;
    int64_t exm = m;  // This will become m*e^x. Initial value is m*e^(mod(<1)) = m.
    int64_t SC, ST, i, f; //remove SC for TSA & LWMA
    int64_t templateTimestamp = pblock->nTime;
    previousTimestamp = pindexPrev->GetBlockTime();
    const CBlockIndex* badblockcheck = pindexPrev->GetAncestor(height-1); //Only for Xbuffer

    ST = std::min(templateTimestamp - previousTimestamp, 6*T);

    //################################################################################################################
    //-------------------------------------------------Xbuffer--------------------------------------------------------
    SC=ST; //real solvetime checkpoint

    // if your avg solvetime is abnormally low or a new coin, drop SS to increase Buffer ST
    // resulting in a faster pull towards the real T
    if ( SS/N + 1 <= T/R ) { SS = ( SS/(N + 1)/T )*SS; }

    // find the ratio real ST:Sum ST && and use it on the real ST.
    ST = ( ST*( ( SS/(N + 1)*1000 )/T ) ) / 1000;

    // checkpoint for new coins and network issues - don't remove, keep for new coins.
    if ( SC > T/R && ST == 0 ) { ST = SC; }

    // Xbuffer - Mining equalizer. If ST < T/2+R then Next block is a free-fall block.
    // Old Miners benefit from new H/S increase
    if ( (previousTimestamp - badblockcheck->GetBlockTime()) <= (T/R) + R && ST<T ) { TSATarget = nextTarget*(1/T); }
    // The Value 10 is user defined, relates to  speed of diff change on the Xbuffer
    // sets min and max.
    // ST will not be constant unti SS/N + 1 = T
    // End of solve time will be a free-fall block
    else if ( ST < T/R || ST > T ) { TSATarget = nextTarget*((ST/T) + (10/T)); }
    //TSA in a pocket based on the length of T/R to allow fair mining based on raw H/S for Xbuffer.
    else {
        int64_t T2 = T/R;
        ST = ST - ((T/R) - 1);
        //-------------------------------------------------Xbuffer--------------------------------------------------------
        //################################################################################################################
        // replace all T2 with T if excluding Xbuffer
        // It might be good to turn this e^x equation into a look-up table;
        for ( i = 1; i <= ST/T2/R ; i++ ) {
          exm = (exm*static_cast<int64_t>(2.71828*m))/m;
        }
        f = ST % (T2*R);
        exm = (exm*(m + (f*(m + (f*(m + (f*(m + (f*m)/(4*T2*R)))/(3*T2*R)))/(2*T2*R)))/(T2*R)))/m;
        // 1000 below is to prevent overflow on testnet
        TSATarget = (nextTarget*((1000*(m*T2 + (ST - T2)*exm))/(m*ST)))/1000;
    }
    // No Xbuffer remove
    if (pindexPrev->GetBlockTime()<1546585506){   if (TSATarget > powLimit || ST>T) { TSATarget = powLimit; }
         }else if (TSATarget > powLimit || ST>(30+T)) { TSATarget = powLimit; }
    if (fDebug) { LogPrintf("LWMA: %s\n  TSA: %s\n Diff: %s\n height: %s\n exm: %s\n f: %s\n, currentT:%s\n",nextTarget.GetHex(), TSATarget.GetHex(), GetDifficulty(pindexPrev), height, previousTimestamp, ST, templateTimestamp); }
    return TSATarget.GetCompact();
} 

Need to do:

Make timeoffset a factor in if (TSATarget > powLimit || ST>(30+T)) { TSATarget = powLimit; }
using the line above, reward the miner a ratio reward based the position on ST vs ST avg.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.