diff options
| author | Bitflash-sh <btf01@proton.me> | 2026-07-24 11:18:11 -0300 |
|---|---|---|
| committer | Bitflash-sh <btf01@proton.me> | 2026-07-24 11:18:11 -0300 |
| commit | 51d617e70f90a972185917ea0096c1ecef2bfa8b (patch) | |
| tree | 9fbbcd867de9de9d0776afdd02f594ba312c46eb /src/market.h | |
Bitflash: fair-launch release
Satoshi's bitcoin-0.1.0 reborn with RandomX CPU proof of work, anonymous .btf
addressing over Nostr with CGNAT rendezvous, automatic peer discovery, a
headless Linux node, and Windows GUI wallet. Fair launch, no premine, 21M cap.
Diffstat (limited to 'src/market.h')
| -rw-r--r-- | src/market.h | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/src/market.h b/src/market.h new file mode 100644 index 0000000..b5c8b3b --- /dev/null +++ b/src/market.h | |||
| @@ -0,0 +1,182 @@ | |||
| 1 | // Copyright (c) 2009 Satoshi Nakamoto | ||
| 2 | // Distributed under the MIT/X11 software license, see the accompanying | ||
| 3 | // file license.txt or http://www.opensource.org/licenses/mit-license.php. | ||
| 4 | |||
| 5 | class CUser; | ||
| 6 | class CReview; | ||
| 7 | class CProduct; | ||
| 8 | |||
| 9 | static const unsigned int nFlowthroughRate = 2; | ||
| 10 | |||
| 11 | |||
| 12 | |||
| 13 | |||
| 14 | bool AdvertInsert(const CProduct& product); | ||
| 15 | void AdvertErase(const CProduct& product); | ||
| 16 | bool AddAtomsAndPropagate(uint256 hashUserStart, const vector<unsigned short>& vAtoms, bool fOrigin); | ||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | class CUser | ||
| 26 | { | ||
| 27 | public: | ||
| 28 | vector<unsigned short> vAtomsIn; | ||
| 29 | vector<unsigned short> vAtomsNew; | ||
| 30 | vector<unsigned short> vAtomsOut; | ||
| 31 | vector<uint256> vLinksOut; | ||
| 32 | |||
| 33 | CUser() | ||
| 34 | { | ||
| 35 | } | ||
| 36 | |||
| 37 | IMPLEMENT_SERIALIZE | ||
| 38 | ( | ||
| 39 | if (!(nType & SER_GETHASH)) | ||
| 40 | READWRITE(nVersion); | ||
| 41 | READWRITE(vAtomsIn); | ||
| 42 | READWRITE(vAtomsNew); | ||
| 43 | READWRITE(vAtomsOut); | ||
| 44 | READWRITE(vLinksOut); | ||
| 45 | ) | ||
| 46 | |||
| 47 | void SetNull() | ||
| 48 | { | ||
| 49 | vAtomsIn.clear(); | ||
| 50 | vAtomsNew.clear(); | ||
| 51 | vAtomsOut.clear(); | ||
| 52 | vLinksOut.clear(); | ||
| 53 | } | ||
| 54 | |||
| 55 | uint256 GetHash() const { return SerializeHash(*this); } | ||
| 56 | |||
| 57 | |||
| 58 | int GetAtomCount() const | ||
| 59 | { | ||
| 60 | return (vAtomsIn.size() + vAtomsNew.size()); | ||
| 61 | } | ||
| 62 | |||
| 63 | void AddAtom(unsigned short nAtom, bool fOrigin); | ||
| 64 | }; | ||
| 65 | |||
| 66 | |||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | |||
| 72 | class CReview | ||
| 73 | { | ||
| 74 | public: | ||
| 75 | int nVersion; | ||
| 76 | uint256 hashTo; | ||
| 77 | map<string, string> mapValue; | ||
| 78 | vector<unsigned char> vchPubKeyFrom; | ||
| 79 | vector<unsigned char> vchSig; | ||
| 80 | |||
| 81 | // memory only | ||
| 82 | unsigned int nTime; | ||
| 83 | int nAtoms; | ||
| 84 | |||
| 85 | |||
| 86 | CReview() | ||
| 87 | { | ||
| 88 | nVersion = 1; | ||
| 89 | hashTo = 0; | ||
| 90 | nTime = 0; | ||
| 91 | nAtoms = 0; | ||
| 92 | } | ||
| 93 | |||
| 94 | IMPLEMENT_SERIALIZE | ||
| 95 | ( | ||
| 96 | READWRITE(this->nVersion); | ||
| 97 | nVersion = this->nVersion; | ||
| 98 | if (!(nType & SER_DISK)) | ||
| 99 | READWRITE(hashTo); | ||
| 100 | READWRITE(mapValue); | ||
| 101 | READWRITE(vchPubKeyFrom); | ||
| 102 | if (!(nType & SER_GETHASH)) | ||
| 103 | READWRITE(vchSig); | ||
| 104 | ) | ||
| 105 | |||
| 106 | uint256 GetHash() const { return SerializeHash(*this); } | ||
| 107 | uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); } | ||
| 108 | uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); } | ||
| 109 | |||
| 110 | |||
| 111 | bool AcceptReview(); | ||
| 112 | }; | ||
| 113 | |||
| 114 | |||
| 115 | |||
| 116 | |||
| 117 | |||
| 118 | |||
| 119 | |||
| 120 | class CProduct | ||
| 121 | { | ||
| 122 | public: | ||
| 123 | int nVersion; | ||
| 124 | CAddress addr; | ||
| 125 | map<string, string> mapValue; | ||
| 126 | map<string, string> mapDetails; | ||
| 127 | vector<pair<string, string> > vOrderForm; | ||
| 128 | unsigned int nSequence; | ||
| 129 | vector<unsigned char> vchPubKeyFrom; | ||
| 130 | vector<unsigned char> vchSig; | ||
| 131 | |||
| 132 | // disk only | ||
| 133 | int nAtoms; | ||
| 134 | |||
| 135 | // memory only | ||
| 136 | set<unsigned int> setSources; | ||
| 137 | |||
| 138 | CProduct() | ||
| 139 | { | ||
| 140 | nVersion = 1; | ||
| 141 | nAtoms = 0; | ||
| 142 | nSequence = 0; | ||
| 143 | } | ||
| 144 | |||
| 145 | IMPLEMENT_SERIALIZE | ||
| 146 | ( | ||
| 147 | READWRITE(this->nVersion); | ||
| 148 | nVersion = this->nVersion; | ||
| 149 | READWRITE(addr); | ||
| 150 | READWRITE(mapValue); | ||
| 151 | if (!(nType & SER_GETHASH)) | ||
| 152 | { | ||
| 153 | READWRITE(mapDetails); | ||
| 154 | READWRITE(vOrderForm); | ||
| 155 | READWRITE(nSequence); | ||
| 156 | } | ||
| 157 | READWRITE(vchPubKeyFrom); | ||
| 158 | if (!(nType & SER_GETHASH)) | ||
| 159 | READWRITE(vchSig); | ||
| 160 | if (nType & SER_DISK) | ||
| 161 | READWRITE(nAtoms); | ||
| 162 | ) | ||
| 163 | |||
| 164 | uint256 GetHash() const { return SerializeHash(*this); } | ||
| 165 | uint256 GetSigHash() const { return SerializeHash(*this, SER_GETHASH|SER_SKIPSIG); } | ||
| 166 | uint256 GetUserHash() const { return Hash(vchPubKeyFrom.begin(), vchPubKeyFrom.end()); } | ||
| 167 | |||
| 168 | |||
| 169 | bool CheckSignature(); | ||
| 170 | bool CheckProduct(); | ||
| 171 | }; | ||
| 172 | |||
| 173 | |||
| 174 | |||
| 175 | |||
| 176 | |||
| 177 | |||
| 178 | |||
| 179 | |||
| 180 | extern map<uint256, CProduct> mapProducts; | ||
| 181 | extern CCriticalSection cs_mapProducts; | ||
| 182 | extern map<uint256, CProduct> mapMyProducts; | ||