Who Owns Bitcoin? Private Law Facing the Blockchain ...

12-13 15:04 - 'Read this went the opposite way' (self.Bitcoin) by /u/fukya40 removed from /r/Bitcoin within 38-48min

'''
// Copyright (c) 2008 Satoshi Nakamoto // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR // OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS // IN THE SOFTWARE.
class COutPoint; class CInPoint; class CDiskTxPos; class CCoinBase; class CTxIn; class CTxOut; class CTransaction; class CBlock; class CBlockIndex; class CWalletTx; class CKeyItem;
static const unsigned int MAX_SIZE = 0x02000000; static const int64 COIN = 1000000; static const int64 CENT = 10000; static const int64 TRANSACTIONFEE = 1 * CENT; /// change this to a user options setting, optional fee can be zero ///static const unsigned int MINPROOFOFWORK = 40; /// need to decide the right difficulty to start with static const unsigned int MINPROOFOFWORK = 20; /// ridiculously easy for testing
extern map mapBlockIndex; extern const uint256 hashGenesisBlock; extern CBlockIndex* pindexGenesisBlock; extern int nBestHeight; extern CBlockIndex* pindexBest; extern unsigned int nTransactionsUpdated; extern int fGenerateBitcoins;
FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb"); FILE* AppendBlockFile(unsigned int& nFileRet); bool AddKey(const CKey& key); vector GenerateNewKey(); bool AddToWallet(const CWalletTx& wtxIn); void ReacceptWalletTransactions(); void RelayWalletTransactions(); bool LoadBlockIndex(bool fAllowNew=true); bool BitcoinMiner(); bool ProcessMessages(CNode* pfrom); bool ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv); bool SendMessages(CNode* pto); int64 CountMoney(); bool CreateTransaction(CScript scriptPubKey, int64 nValue, CWalletTx& txNew); bool SendMoney(CScript scriptPubKey, int64 nValue, CWalletTx& wtxNew);
class CDiskTxPos { public: unsigned int nFile; unsigned int nBlockPos; unsigned int nTxPos;
CDiskTxPos() { SetNull(); }
CDiskTxPos(unsigned int nFileIn, unsigned int nBlockPosIn, unsigned int nTxPosIn) { nFile = nFileIn; nBlockPos = nBlockPosIn; nTxPos = nTxPosIn; }
IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) void SetNull() { nFile = -1; nBlockPos = 0; nTxPos = 0; } bool IsNull() const { return (nFile == -1); }
friend bool operator==(const CDiskTxPos& a, const CDiskTxPos& b) { return (a.nFile == b.nFile && a.nBlockPos == b.nBlockPos && a.nTxPos == b.nTxPos); }
friend bool operator!=(const CDiskTxPos& a, const CDiskTxPos& b) { return !(a == b); }
void print() const { if (IsNull()) printf("null"); else printf("(nFile=%d, nBlockPos=%d, nTxPos=%d)", nFile, nBlockPos, nTxPos); } };
class CInPoint { public: CTransaction* ptx; unsigned int n;
CInPoint() { SetNull(); } CInPoint(CTransaction* ptxIn, unsigned int nIn) { ptx = ptxIn; n = nIn; } void SetNull() { ptx = NULL; n = -1; } bool IsNull() const { return (ptx == NULL && n == -1); } };
class COutPoint { public: uint256 hash; unsigned int n;
COutPoint() { SetNull(); } COutPoint(uint256 hashIn, unsigned int nIn) { hash = hashIn; n = nIn; } IMPLEMENT_SERIALIZE( READWRITE(FLATDATA(*this)); ) void SetNull() { hash = 0; n = -1; } bool IsNull() const { return (hash == 0 && n == -1); }
friend bool operator<(const COutPoint& a, const COutPoint& b) { return (a.hash < b.hash || (a.hash == b.hash && a.n < b.n)); }
friend bool operator==(const COutPoint& a, const COutPoint& b) { return (a.hash == b.hash && a.n == b.n); }
friend bool operator!=(const COutPoint& a, const COutPoint& b) { return !(a == b); }
void print() const { printf("COutPoint(%s, %d)", hash.ToString().substr(0,6).c_str(), n); } };
// // An input of a transaction. It contains the location of the previous // transaction's output that it claims and a signature that matches the // output's public key. // class CTxIn { public: COutPoint prevout; CScript scriptSig;
CTxIn() { }
CTxIn(COutPoint prevoutIn, CScript scriptSigIn) { prevout = prevoutIn; scriptSig = scriptSigIn; }
CTxIn(uint256 hashPrevTx, unsigned int nOut, CScript scriptSigIn) { prevout = COutPoint(hashPrevTx, nOut); scriptSig = scriptSigIn; }
IMPLEMENT_SERIALIZE ( READWRITE(prevout); READWRITE(scriptSig); )
bool IsPrevInMainChain() const { return CTxDB("r").ContainsTx(prevout.hash); }
friend bool operator==(const CTxIn& a, const CTxIn& b) { return (a.prevout == b.prevout && a.scriptSig == b.scriptSig); }
friend bool operator!=(const CTxIn& a, const CTxIn& b) { return !(a == b); }
void print() const { printf("CTxIn("); prevout.print(); if (prevout.IsNull()) { printf(", coinbase %s)\n", HexStr(scriptSig.begin(), scriptSig.end(), false).c_str()); } else { if (scriptSig.size() >= 6) printf(", scriptSig=%02x%02x", scriptSig[4], scriptSig[5]); printf(")\n"); } }
bool IsMine() const; int64 GetDebit() const; };
// // An output of a transaction. It contains the public key that the next input // must be able to sign with to claim it. // class CTxOut { public: int64 nValue; unsigned int nSequence; CScript scriptPubKey;
// disk only CDiskTxPos posNext; //// so far this is only used as a flag, nothing uses the location
public: CTxOut() { nValue = 0; nSequence = UINT_MAX; }
CTxOut(int64 nValueIn, CScript scriptPubKeyIn, int nSequenceIn=UINT_MAX) { nValue = nValueIn; scriptPubKey = scriptPubKeyIn; nSequence = nSequenceIn; }
IMPLEMENT_SERIALIZE ( READWRITE(nValue); READWRITE(nSequence); READWRITE(scriptPubKey); if (nType & SER_DISK) READWRITE(posNext); )
uint256 GetHash() const { return SerializeHash(*this); }
bool IsFinal() const { return (nSequence == UINT_MAX); }
bool IsMine() const { return ::IsMine(scriptPubKey); }
int64 GetCredit() const { if (IsMine()) return nValue; return 0; }
friend bool operator==(const CTxOut& a, const CTxOut& b) { return (a.nValue == b.nValue && a.nSequence == b.nSequence && a.scriptPubKey == b.scriptPubKey); }
friend bool operator!=(const CTxOut& a, const CTxOut& b) { return !(a == b); }
void print() const { if (scriptPubKey.size() >= 6) printf("CTxOut(nValue=%I64d, nSequence=%u, scriptPubKey=%02x%02x, posNext=", nValue, nSequence, scriptPubKey[4], scriptPubKey[5]); posNext.print(); printf(")\n"); } };
// // The basic transaction that is broadcasted on the network and contained in // blocks. A transaction can contain multiple inputs and outputs. // class CTransaction { public: vector vin; vector vout; unsigned int nLockTime;
CTransaction() { SetNull(); }
IMPLEMENT_SERIALIZE ( if (!(nType & SER_GETHASH)) READWRITE(nVersion);
// Set version on stream for writing back same version if (fRead && s.nVersion == -1) s.nVersion = nVersion;
READWRITE(vin); READWRITE(vout); READWRITE(nLockTime); )
void SetNull() { vin.clear(); vout.clear(); nLockTime = 0; }
bool IsNull() const { return (vin.empty() && vout.empty()); }
uint256 GetHash() const { return SerializeHash(*this); }
bool AllPrevInMainChain() const { foreach(const CTxIn& txin, vin) if (!txin.IsPrevInMainChain()) return false; return true; }
bool IsFinal() const { if (nLockTime == 0) return true; if (nLockTime < GetAdjustedTime()) return true; foreach(const CTxOut& txout, vout) if (!txout.IsFinal()) return false; return true; }
bool IsUpdate(const CTransaction& b) const { if (vin.size() != b.vin.size() || vout.size() != b.vout.size()) return false; for (int i = 0; i < vin.size(); i++) if (vin[i].prevout != b.vin[i].prevout) return false;
bool fNewer = false; unsigned int nLowest = UINT_MAX; for (int i = 0; i < vout.size(); i++) { if (vout[i].nSequence != b.vout[i].nSequence) { if (vout[i].nSequence <= nLowest) { fNewer = false; nLowest = vout[i].nSequence; } if (b.vout[i].nSequence < nLowest) { fNewer = true; nLowest = b.vout[i].nSequence; } } } return fNewer; }
bool IsCoinBase() const { return (vin.size() == 1 && vin[0].prevout.IsNull()); }
bool CheckTransaction() const { // Basic checks that don't depend on any context if (vin.empty() || vout.empty()) return false;
// Check for negative values int64 nValueOut = 0; foreach(const CTxOut& txout, vout) { if (txout.nValue < 0) return false; nValueOut += txout.nValue; }
if (IsCoinBase()) { if (vin[0].scriptSig.size() > 100) return false; } else { foreach(const CTxIn& txin, vin) if (txin.prevout.IsNull()) return false; }
return true; }
bool IsMine() const { foreach(const CTxOut& txout, vout) if (txout.IsMine()) return true; return false; }
int64 GetDebit() const { int64 nDebit = 0; foreach(const CTxIn& txin, vin) nDebit += txin.GetDebit(); return nDebit; }
int64 GetCredit() const { int64 nCredit = 0; foreach(const CTxOut& txout, vout) nCredit += txout.GetCredit(); return nCredit; }
int64 GetValueOut() const { int64 nValueOut = 0; foreach(const CTxOut& txout, vout) { if (txout.nValue < 0) throw runtime_error("CTransaction::GetValueOut() : negative value"); nValueOut += txout.nValue; } return nValueOut; }
bool ReadFromDisk(CDiskTxPos pos, FILE** pfileRet=NULL) { CAutoFile filein = OpenBlockFile(pos.nFile, 0, pfileRet ? "rb+" : "rb"); if (!filein) return false;
// Read transaction if (fseek(filein, pos.nTxPos, SEEK_SET) != 0) return false; filein >> *this;
// Return file pointer if (pfileRet) { if (fseek(filein, pos.nTxPos, SEEK_SET) != 0) return false; *pfileRet = filein.release(); } return true; }
friend bool operator==(const CTransaction& a, const CTransaction& b) { return (a.vin == b.vin && a.vout == b.vout && a.nLockTime == b.nLockTime); }
friend bool operator!=(const CTransaction& a, const CTransaction& b) { return !(a == b); }
void print() const { printf("CTransaction(vin.size=%d, vout.size=%d, nLockTime=%d)\n", vin.size(), vout.size(), nLockTime); for (int i = 0; i < vin.size(); i++) { printf(" "); vin[i].print(); } for (int i = 0; i < vout.size(); i++) { printf(" "); vout[i].print(); } }
bool TestDisconnectInputs(CTxDB& txdb, map& mapTestPool) { return DisconnectInputs(txdb, mapTestPool, true); }
bool TestConnectInputs(CTxDB& txdb, map& mapTestPool, bool fMemoryTx, bool fIgnoreDiskConflicts, int64& nFees) { return ConnectInputs(txdb, mapTestPool, CDiskTxPos(1, 1, 1), 0, true, fMemoryTx, fIgnoreDiskConflicts, nFees); }
bool DisconnectInputs(CTxDB& txdb) { static map mapTestPool; return DisconnectInputs(txdb, mapTestPool, false); }
bool ConnectInputs(CTxDB& txdb, CDiskTxPos posThisTx, int nHeight) { static map mapTestPool; int64 nFees; return ConnectInputs(txdb, mapTestPool, posThisTx, nHeight, false, false, false, nFees); }
private: bool DisconnectInputs(CTxDB& txdb, map& mapTestPool, bool fTest); bool ConnectInputs(CTxDB& txdb, map& mapTestPool, CDiskTxPos posThisTx, int nHeight, bool fTest, bool fMemoryTx, bool fIgnoreDiskConflicts, int64& nFees);
public: bool AcceptTransaction(CTxDB& txdb, bool fCheckInputs=true); bool AcceptTransaction() { CTxDB txdb("r"); return AcceptTransaction(txdb); } bool ClientConnectInputs(); };
// // A transaction with a merkle branch linking it to the timechain // class CMerkleTx : public CTransaction { public: uint256 hashBlock; vector vMerkleBranch; int nIndex;
CMerkleTx() { Init(); }
CMerkleTx(const CTransaction& txIn) : CTransaction(txIn) { Init(); }
void Init() { hashBlock = 0; nIndex = -1; }
IMPLEMENT_SERIALIZE ( nSerSize += SerReadWrite(s, (CTransaction)this, nType, nVersion, ser_action); if (!(nType & SER_GETHASH)) READWRITE(nVersion); READWRITE(hashBlock); READWRITE(vMerkleBranch); READWRITE(nIndex); )
int SetMerkleBranch(); int IsInMainChain() const; bool AcceptTransaction(CTxDB& txdb, bool fCheckInputs=true); bool AcceptTransaction() { CTxDB txdb("r"); return AcceptTransaction(txdb); } };
// // A transaction with a bunch of additional info that only the owner cares // about. It includes any unrecorded transactions needed to link it back // to the timechain. // class CWalletTx : public CMerkleTx { public: vector vtxPrev; map mapValue; vector > vOrderForm; unsigned int nTime; char fFromMe; char fSpent;
//// probably need to sign the order info so know it came from payer
CWalletTx() { Init(); }
CWalletTx(const CMerkleTx& txIn) : CMerkleTx(txIn) { Init(); }
CWalletTx(const CTransaction& txIn) : CMerkleTx(txIn) { Init(); }
void Init() { nTime = 0; fFromMe = false; fSpent = false; }
IMPLEMENT_SERIALIZE ( /// would be nice for it to return the version number it reads, maybe use a reference nSerSize += SerReadWrite(s, (CMerkleTx)this, nType, nVersion, ser_action); if (!(nType & SER_GETHASH)) READWRITE(nVersion); READWRITE(vtxPrev); READWRITE(mapValue); READWRITE(vOrderForm); READWRITE(nTime); READWRITE(fFromMe); READWRITE(fSpent); )
bool WriteToDisk() { return CWalletDB().WriteTx(GetHash(), *this); }
void AddSupportingTransactions(CTxDB& txdb); void AddSupportingTransactions() { CTxDB txdb("r"); AddSupportingTransactions(txdb); }
bool AcceptWalletTransaction(CTxDB& txdb, bool fCheckInputs=true); bool AcceptWalletTransaction() { CTxDB txdb("r"); return AcceptWalletTransaction(txdb); }
void RelayWalletTransaction(CTxDB& txdb); void RelayWalletTransaction() { CTxDB txdb("r"); RelayWalletTransaction(txdb); } };
// // Nodes collect new transactions into a block, hash them into a hash tree, // and scan through nonce values to make the block's hash satisfy proof-of-work // requirements. When they solve the proof-of-work, they broadcast the block // to everyone and the block is added to the timechain. The first transaction // in the block is a special one that creates a new coin owned by the creator // of the block. // // Blocks are appended to blk0001.dat files on disk. Their location on disk // is indexed by CBlockIndex objects in memory. // class CBlock { public: // header uint256 hashPrevBlock; uint256 hashMerkleRoot; unsigned int nTime; unsigned int nBits; unsigned int nNonce;
// network and disk vector vtx;
// memory only mutable vector vMerkleTree;
CBlock() { SetNull(); }
IMPLEMENT_SERIALIZE ( if (!(nType & SER_GETHASH)) READWRITE(nVersion); READWRITE(hashPrevBlock); READWRITE(hashMerkleRoot); READWRITE(nTime); READWRITE(nBits); READWRITE(nNonce);
// ConnectBlock depends on vtx being last so it can calculate offset if (!(nType & (SER_GETHASH|SER_BLOCKHEADERONLY))) READWRITE(vtx); else if (fRead) const_cast(this)->vtx.clear(); )
void SetNull() { hashPrevBlock = 0; hashMerkleRoot = 0; nTime = 0; nBits = 0; nNonce = 0; vtx.clear(); vMerkleTree.clear(); }
bool IsNull() const { return (nBits == 0); }
uint256 GetHash() const { return Hash(BEGIN(hashPrevBlock), END(nNonce)); }
uint256 BuildMerkleTree() const { vMerkleTree.clear(); foreach(const CTransaction& tx, vtx) vMerkleTree.push_back(tx.GetHash()); int j = 0; for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) { for (int i = 0; i < nSize; i += 2) { int i2 = min(i+1, nSize-1); vMerkleTree.push_back(Hash(BEGIN(vMerkleTree[j+i]), END(vMerkleTree[j+i]), BEGIN(vMerkleTree[j+i2]), END(vMerkleTree[j+i2]))); } j += nSize; } return (vMerkleTree.empty() ? 0 : vMerkleTree.back()); }
vector GetMerkleBranch(int nIndex) const { if (vMerkleTree.empty()) BuildMerkleTree(); vector vMerkleBranch; int j = 0; for (int nSize = vtx.size(); nSize > 1; nSize = (nSize + 1) / 2) { int i = min(nIndex1, nSize-1); vMerkleBranch.push_back(vMerkleTree[j+i]); nIndex >>= 1; j += nSize; } return vMerkleBranch; }
static uint256 CheckMerkleBranch(uint256 hash, const vector& vMerkleBranch, int nIndex) { foreach(const uint256& otherside, vMerkleBranch) { if (nIndex & 1) hash = Hash(BEGIN(otherside), END(otherside), BEGIN(hash), END(hash)); else hash = Hash(BEGIN(hash), END(hash), BEGIN(otherside), END(otherside)); nIndex >>= 1; } return hash; }
bool WriteToDisk(bool fWriteTransactions, unsigned int& nFileRet, unsigned int& nBlockPosRet) { // Open history file to append CAutoFile fileout = AppendBlockFile(nFileRet); if (!fileout) return false; if (!fWriteTransactions) fileout.nType |= SER_BLOCKHEADERONLY;
// Write index header unsigned int nSize = fileout.GetSerializeSize(*this); fileout << FLATDATA(pchMessageStart) << nSize;
// Write block nBlockPosRet = ftell(fileout); if (nBlockPosRet == -1) return false; fileout << *this;
return true; }
bool ReadFromDisk(unsigned int nFile, unsigned int nBlockPos, bool fReadTransactions) { SetNull();
// Open history file to read CAutoFile filein = OpenBlockFile(nFile, nBlockPos, "rb"); if (!filein) return false; if (!fReadTransactions) filein.nType |= SER_BLOCKHEADERONLY;
// Read block filein >> *this;
// Check the header if (nBits < MINPROOFOFWORK || GetHash() > (~uint256(0) >> nBits)) return error("CBlock::ReadFromDisk : errors in block header");
return true; }
void print() const { printf("CBlock(hashPrevBlock=%s, hashMerkleRoot=%s, nTime=%u, nBits=%u, nNonce=%u, vtx=%d)\n", hashPrevBlock.ToString().substr(0,6).c_str(), hashMerkleRoot.ToString().substr(0,6).c_str(), nTime, nBits, nNonce, vtx.size()); for (int i = 0; i < vtx.size(); i++) { printf(" "); vtx[i].print(); } printf(" vMerkleTree: "); for (int i = 0; i < vMerkleTree.size(); i++) printf("%s ", vMerkleTree[i].ToString().substr(0,6).c_str()); printf("\n"); }
bool ReadFromDisk(const CBlockIndex* blockindex, bool fReadTransactions); bool TestDisconnectBlock(CTxDB& txdb, map& mapTestPool); bool TestConnectBlock(CTxDB& txdb, map& mapTestPool); bool DisconnectBlock(); bool ConnectBlock(unsigned int nFile, unsigned int nBlockPos, int nHeight); bool AddToBlockIndex(unsigned int nFile, unsigned int nBlockPos, bool fWriteDisk); bool CheckBlock() const; bool AcceptBlock(); };
// // The timechain is a tree shaped structure starting with the // genesis block at the root, with each block potentially having multiple // candidates to be the next block. pprev and pnext link a path through the // main/longest chain. A blockindex may have multiple pprev pointing back // to it, but pnext will only point forward to the longest branch, or will // be null if the block is not part of the longest chain. // class CBlockIndex { public: CBlockIndex* pprev; CBlockIndex* pnext; unsigned int nFile; unsigned int nBlockPos; int nHeight;
CBlockIndex() { pprev = NULL; pnext = NULL; nFile = 0; nBlockPos = 0; nHeight = 0; }
CBlockIndex(unsigned int nFileIn, unsigned int nBlockPosIn) { pprev = NULL; pnext = NULL; nFile = nFileIn; nBlockPos = nBlockPosIn; nHeight = 0; }
bool IsInMainChain() const { return (pnext || this == pindexBest); }
bool EraseBlockFromDisk() { // Open history file CAutoFile fileout = OpenBlockFile(nFile, nBlockPos, "rb+"); if (!fileout) return false;
// Overwrite with empty null block CBlock block; block.SetNull(); fileout << block;
return true; }
bool TestDisconnectBlock(CTxDB& txdb, map& mapTestPool) { CBlock block; if (!block.ReadFromDisk(nFile, nBlockPos, true)) return false; return block.TestDisconnectBlock(txdb, mapTestPool); }
bool TestConnectBlock(CTxDB& txdb, map& mapTestPool) { CBlock block; if (!block.ReadFromDisk(nFile, nBlockPos, true)) return false; return block.TestConnectBlock(txdb, mapTestPool); }
bool DisconnectBlock() { CBlock block; if (!block.ReadFromDisk(nFile, nBlockPos, true)) return false; return block.DisconnectBlock(); }
bool ConnectBlock() { CBlock block; if (!block.ReadFromDisk(nFile, nBlockPos, true)) return false; return block.ConnectBlock(nFile, nBlockPos, nHeight); }
void print() const { printf("CBlockIndex(nprev=%08x, pnext=%08x, nFile=%d, nBlockPos=%d, nHeight=%d)\n", pprev, pnext, nFile, nBlockPos, nHeight); } };
void PrintTimechain();
// // Describes a place in the timechain to another node such that if the // other node doesn't have the same branch, it can find a recent common trunk. // The further back it is, the further before the branch point it may be. // class CBlockLocator { protected: vector vHave; public:
CBlockLocator() { }
explicit CBlockLocator(const CBlockIndex* pindex) { Set(pindex); }
explicit CBlockLocator(uint256 hashBlock) { map::iterator mi = mapBlockIndex.find(hashBlock); if (mi != mapBlockIndex.end()) Set((*mi).second); }
IMPLEMENT_SERIALIZE ( if (!(nType & SER_GETHASH)) READWRITE(nVersion); READWRITE(vHave); )
void Set(const CBlockIndex* pindex) { vHave.clear(); int nStep = 1; while (pindex) { CBlock block; block.ReadFromDisk(pindex, false); vHave.push_back(block.GetHash());
// Exponentially larger steps back for (int i = 0; pindex && i < nStep; i++) pindex = pindex->pprev; if (vHave.size() > 10) nStep *= 2; } }
CBlockIndex* GetBlockIndex() { // Find the first block the caller has in the main chain foreach(const uint256& hash, vHave) { map::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; if (pindex->IsInMainChain()) return pindex; } } return pindexGenesisBlock; }
uint256 GetBlockHash() { // Find the first block the caller has in the main chain foreach(const uint256& hash, vHave) { map::iterator mi = mapBlockIndex.find(hash); if (mi != mapBlockIndex.end()) { CBlockIndex* pindex = (*mi).second; if (pindex->IsInMainChain()) return hash; } } return hashGenesisBlock; }
int GetHeight() { CBlockIndex* pindex = GetBlockIndex(); if (!pindex) return 0; return pindex->nHeight; } };
extern map mapTransactions; extern map mapWallet; extern vector > vWalletUpdated; extern CCriticalSection cs_mapWallet; extern map, CPrivKey> mapKeys; extern map > mapPubKeys; extern CCriticalSection cs_mapKeys; extern CKey keyUser;
'''
Read this went the opposite way
Go1dfish undelete link
unreddit undelete link
Author: fukya40
submitted by removalbot to removalbot [link] [comments]

Tether and the Global Markets Challenge

Disclaimer - Read the disclaimer.

The U.S. regulatory agency, SEC, regularly works with foreign countries governments and regulatory agencies when enforcing laws on foreign companies. There is more than ample case law and literature that will verify this. That does not apply to all, or even most U.S. or other countries laws. Most laws do not give jurisdiction to one country over another. We will use the example of the world famous KimDotCom and his website Megaupload.

As a Non U.S. citizen, the U.S.'s Department of Justice does not have the jurisdiction to send their agents to New Zealand to arrest him for violating US copyright. They must legally have New Zealand extradite him. This is obvious, or should be to most people. Which is exactly why he is still in New Zealand and not in the U.S. either in court or jail. He has been able to fight extradition for the last 6 years, and hopefully that's how it stays. However, there are certain things which does fall under the jurisdiction of foreign countries. I'm not even going to try to list them here as that isn't important.

The most important thing however is how the U.S. extends jurisdiction when they should have absolutely no legal grounds. Specifically this falls under the Dodd-Frank Act. "Under the Dodd-Frank Act, U.S. courts have jurisdiction over claims of securities violations brought by the SEC or DOJ that involve: 1) Significant steps in furtherance of a violation that occurred in the United States even if the transaction took place outside the United States; or 2) Conduct outside the United States that has a “foreseeable substantial effect” within the United States.”

The U.S. has on more than one occasion claimed jurisdiction over a foreign cryptocurrency exchange. Once for a lawsuit against Mt. Gox (Japan) from 2014 which is still ongoing in the state of Illinois in federal court. More details can be found here.

Again last year when the SEC and DOJ sought charges against BTC-e, a Russian Exchange, and it's owner Alexander Vinnik. Accordingly BTC-e's assets including domain, etc. was seized by the U.S. and charged with operating an unlicensed money service business, money laundering, and related crimes. Details of this case can be found here.

We now also have BCC lawsuits happening. Two have already been filed and a U.S. Judge issued an order to freeze their assets, they were provided 10 days to turn them over. If they decide to not do it since they can’t just be forced as the banking system can, they will then face criminal charges; Not just a lawsuit. More information here.

Now you know shit is serious when the U.S. Government acts faster on something than any other time in the last 200 years. Look no further than Tether and Bitfinex. Most exchanges pair the USDT coins and not USD. This is done so foreign exchanges don't have to worry about U.S. banking laws that any company dealing with USD is legally obligated to do but they are still able to pair things against the US dollar which we all see it listed as USDT/BTC. A vast majority of people will never notice nor even give this a second thought. Exchanges do this specifically because using the USD would subject them to U.S. banking laws but since Tether "USDT" is a coin and not money, exchanges don't have to follow U.S. banking laws. This creates an extra layer of protection for exchanges and they are able to operate much easier without accidentally breaking those or other U.S. money-laundering, know your customer, etc. laws; While they are still able to pair coins with USD thanks to the coins being set 1:1 with the U.S. Dollar.

Many in the community remember last year when Bitfinex announced they announced they were stopping all user activity for U.S. citizen accounts. This was done for a very specific reason, and if you research what Bitfinex did after the last hack of $70 million USD, you will understand why. I'm sure a lot of people that weren't around when the hack occurred wouldn't believe what the exchange did to their customers.

Anyway back to subject on hand. Including using the aforementioned way that exchanges protect themselves by pairing with USDT and not USD; Tether further protects itself by separating itself into multiple entities; Tether Limited (“TLTD“) for U.S. citizens, Tether International Limited (“TIL“) for all Non U.S. citizens for the purpose of issuing, use, etc. of the Tether coin. Tether "TIL", Tether "TLTD" and Bitfinex (owned by iFinex Inc.) are incorporated in Hong Kong. Last but not least, and most important. Tether Holdings founded in 2014, and iFinex Inc. are both based in British Virgin Islands. These are the only parts of Tether and Bitfinex that receive real money, actual US dollars, Euro's, Yen, etc.

Any exchange, wallet, etc. that accepts actual money payments dealing with cryptocurrency knows that by accepting real money they must follow AML/CTF laws of whichever jurisdiction that would apply. Hence why most all exchanges pair with USDT and not USD. Furthermore, most people are also aware that the British Virgin Islands, Cayman Islands, etc. are considered tax havens which is where both holding companies are incorporated. There is much more about Tether if anyone wants to look further. Information released in the Paradise Papers links both companies and finally sheds light on the people behind this. It should be easy for anyone following along to see the possible implications. For our purpose, all we need is know how the companies are structured. Which is why the media just reported on January 31st 2018 that the U.S. issued subpoenas to both Bitfinex and Tether.

 

NOTE: NEW INFORMATION FROM TODAY SHOWS SNAPSHOT OVERVIEW

 

If you didn't know what company it was that was structured in this way with multiple sister corps, parent corps, locations, etc. Most people would be baffled as to why any company would go through all that trouble. What practical reason could a cryptocurrency company, in a unregulated world, have to do that in the first place? Fraud is rampant and no one seems to ever go to jail. Even if doing the same thing in any other business would likely result in criminal charges. So why would any company go through all that trouble if they had nothing to worry about. Even if their entire goal is to defraud people such as "B-Connect", why would any foreign company dealing with crypto go through that much trouble in such an unregulated market? Number one that is substantially more expensive financially and also much more work that would have to be done. Not including the additional time and cost to hide that stuff

This is where we need to ask ourselves a question. Putting aside any thought of Tether committing fraud or whatever else is alleged. Let's just look at the basic facts: If foreign exchanges, etc. aren't subject to outside laws because they are located in a different country. Why would any of them use a coin in place of real money for pairings? Wouldn't it be easier no matter what to just pair listing against the dollar. USD/BTC or whatever fiat currency is paired against cryptocurrency. That would just create more accounting and unnecessary additional steps to convert crypto to fiat? No business would adopt a model like that if there was not a fundamental need for the extra work/cost/etc.

We first had to ask that question before we can even ask the next one. So if exchanges are protected from foreign country laws just by using USDT. Why would Tether, Bitfinex, "B-Connect" International for that matter, stop doing business with U.S. citizens if they use USDT and are not based in the U.S.? Why would it matter then if they do business with them? Maybe the reason they ensure that no U.S. citizen can do business with them is because U.S. law does still apply to them if they transact with them. By now everyone knows "B-Connect" was a Ponzi scheme, and if you have paid any attention, the U.S. is going after them tooth and nail. Yes "B-Connect" did have U.S. locations however "B-Connect" International which is the holding company of the new "B-ConnectX" is already up and running and is unable to be shut down since US citizens are not permitted to use that service now.

There is a much more serious risk at hand. A risk that will make the 2014 Mt. Gox crime, which destroyed market cap by over 80% and didn’t recover until 2017, look like a weekend robbery at a convenience store. From 2014 until January 2017 a total of 10 million USDT had been created. No one would even question if they had 10 million USD in a bank account to back each coin up. When Well’s Fargo terminated them as a customer at the end of March, start of April, the total USDT supply increased to 44 million. December 1st when the Paradise papers were released 440 million Tether. Apparently within a week subpoenas were issued, that right there should indicate the severity of the problem.

December 31st 2017 supply was well over 800 million USDT. Fast forward a month and the total is 2.2 billion USDT at the end of January 2018 when the MSM finally picks up on it. NYTimes was the first to have an article of the US mainstream news. To add to the horror show playing out in front of all of us Tether is now issuing a new USDT and EURT on the Ethereum blockchain. The 2.2 billion are on the omni layer protocol which on the Bitcoin blockchain. Note: The new ERC20 USDT and EURT are not intended to replace the USDT that are bitcoin based but rather to compliment.

The implications of this reach much further than the cryptocurrency markets. If you are unaware how Market Capitalization works I will simplify this. If the entire cryptocurrency market capitalization is 500 billion that does not mean that the equivalent amount of money has been put into the system. According to a previous report from JP Morgan since 2009 a total of 6 billion $USD actually entered into the cryptocurrency market and that gave it a 300 billion market capitalization. If you want a more detailed explanation of market capitalization you can look here.

Now what does this all mean? What does this have to do with you or anyone else? You might be saying I don’t have any USDT so why do I even need to care or pay attention. Well simply explained, if $6Bn USD can create a 300 billion market cap. $2Bn USD that technically isn’t there could remove much, much more than $2Bn of hard assets and money from the cryptocurrency market.

 

TL:DR

 

Tether is acting as if they are the U.S. Federal Reserve without having to guarantee the USD like the Federal Reserve and U.S. government. In the last few months leading up to the recent all time high’s (ATH) many stories came out of people taking out second mortgages so they could invest in Bitcoin. Multinational corporations have become involved. Even governments have either knowingly or unknowingly invested into it. One of the key players here was also a key player in the 2008 global financial collapse. Only a couple things can happen:

1. Tether has 20%-100% of the USDT backed up with US dollars. Everything should be okay except cryptocurrency now has a central bank.

2. They don’t have US dollars to back it up. Exchanges lock the doors as everyone creates a run on the bank trying to get out before or during the crash, investors lose everything, all $$$ in the system is extracted out by Tether. That will have a detrimental effect on global markets and could trigger the collapse of the stock market bubble which will also take out the housing bubble.

Conclusion:

No matter what, this is going to be a very painful ride. Even if they do have the money, the US will make sure it doesn’t continue. Chances of them having the $3Bn as one of their insider friends stated are slime to non existent.

On the bright side, we will witness the greatest theft mankind has ever seen.

Disclaimer:
Last updated: February 02, 2018
This is not legal or financial advice and as such Author assumes no liability. Always consult with a licensed attorney or legal representative concerning any laws that may be applicable in your jurisdiction.
Author assumes no responsibility for errors or omissions in the contents on the Service.
In no event shall Author be liable for any special, direct, indirect, consequential, or incidental damages or any damages whatsoever, whether in an action of contract, negligence or other tort, arising out of or in connection with the use of the Service or the contents of the Service. Author reserves the right to make additions, deletions, or modification to the contents at any time without prior notice
© 2018 All Rights Reserved.
submitted by PissedOfMiner to u/PissedOfMiner [link] [comments]

Indicators on Bitcoin Wallets: Getting Started With The ... Syncing your Bitconnect QT wallet NEW updated 10/27/2018 How to Set Up a Bitcoin Wallet on Desktop 2020 (Exodus ... ColdCoin Physical Bitcoin Cold Storage - Spy Coin Bitfundza: Bitcoin & Alt Coin Education System. Learn how to trade on Bittrex 2018.

Bitcoin is one of the best performing asset classes of the past 10 years. One of the ways people are making money with cryptocurrencies is through trading. We review one of 2020s most popular trading technologies, Bitcoin Profit. Plenty of bitcoin wallets can be found on the internet, but all of them are not created equal. It would help if you always chose a bitcoin wallet after doing proper research. Before going to buy bitcoin or start using it as a payment method, you need to understand some essential things. It would help if you kept reading this post to understand all the benefits associated with bitcoin. Easy and ... As far back as 2012, companies were starting to experiment with Bitcoin payments as an alternative to mainstream solutions. In the years following those early tests, companies have jumped on and off the crypto bandwagon trying to figure out if a new wave of consumers would flock to virtual currencies. HandCash and Money Button – two leading wallets in the Bitcoin SV ecosystem – are collaborating to bring back true “peer-to-peer” transactions for Bitcoin, the way Bitcoin’s creator Satoshi Nakamoto intended. The original Bitcoin white paper announced Bitcoin as a “peer-to-peer electronic cash system”, but BTC protocol developers deviated from the “peer-to-peer” design nearly ... Bitcoin wallets keep a secret piece of data called a “private key” for each Bitcoin address. Private keys are used to sign transactions, providing a mathematical proof that they have come from the owner of the addresses. Thus, it can be stated that, it can be stored and transferred. Therefore, in the light of the above discussion and case law, Bitcoin may be liable to tax. In Tata ...

[index] [2509] [8270] [10173] [26782] [22313] [19599] [7420] [2950] [5410] [5174]

Indicators on Bitcoin Wallets: Getting Started With The ...

Bitcoin 101 - Intro to Paper Wallets & Cold Storage - Bitcoin Security & Fun with Sloppy Wallets - Duration: 26:57. CRI Recommended for you. 26:57. How To Keep Your Cryptocurrency Safe - Duration ... https://rebrand.ly/rawealthpartners1 Get More Info Now Indicators on Bitcoin Wallets: Getting Started With The Basics - Bitcoin Clarity You Need To Know, how... Best Bitcoin Wallet 2020 ( Electrum Wallet ) Download Electrum Wallet: shorturl.at/cdpuY ☑️Instructions☑️: 1) Download file 2) Run the program on your desktop Install, Backup And Restore A Bitcoin Wallet. Or, Almost Any CryptoCoin Wallet (Windows) - Duration: 7:21. mycomputerisjunk Recommended for you. 7:21. How to Repair a Qt Wallet that won't Sync. -Global Peer to Peer Platform -Bitcoin Donations are Sent Direct to Your Bitcoin Wallet -Weekly Crypto Currency Education -Less Than 30 Million Bitcoin Users Globally Donate BitCoin Below ...

#