PRCYCoin  2.0.0.7rc1
P2P Digital Currency
blockexplorer.cpp
Go to the documentation of this file.
1 #include "amount.h"
2 #include "blockexplorer.h"
3 #include "bitcoinunits.h"
4 #include "chainparams.h"
5 #include "clientmodel.h"
6 #include "core_io.h"
7 #include "guiutil.h"
8 #include "main.h"
9 #include "net.h"
10 #include "txdb.h"
11 #include "ui_blockexplorer.h"
12 #include "guiinterface.h"
13 #include "util.h"
14 #include "utilstrencodings.h"
15 #include <QDateTime>
16 #include <QKeyEvent>
17 #include <QMessageBox>
18 #include <set>
19 
20 extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
21 
22 inline std::string utostr(unsigned int n)
23 {
24  return strprintf("%u", n);
25 }
26 
27 static std::string makeHRef(const std::string& Str)
28 {
29  return "<a href=\"" + Str + "\">" + Str + "</a>";
30 }
31 
32 static CAmount getTxIn(const CTransaction& tx)
33 {
34  if (tx.IsCoinBase())
35  return 0;
36 
37  CAmount Sum = 0;
38  for (unsigned int i = 0; i < tx.vin.size(); i++)
39  Sum += getPrevOut(tx.vin[i].prevout).nValue;
40  return Sum;
41 }
42 
43 static std::string ValueToString(CAmount nValue, bool AllowNegative = false)
44 {
45  if (nValue < 0 && !AllowNegative)
46  return "<span>" + _("unknown") + "</span>";
47 
48  QString Str = BitcoinUnits::formatWithUnit(BitcoinUnits::PRCY, nValue);
49  if (AllowNegative && nValue > 0)
50  Str = '+' + Str;
51  return std::string("<span>") + Str.toUtf8().data() + "</span>";
52 }
53 
54 static std::string ScriptToString(const CScript& Script, bool Long = false, bool Highlight = false)
55 {
56  if (Script.empty())
57  return "unknown";
58 
59  CTxDestination Dest;
60  CBitcoinAddress Address;
61  if (ExtractDestination(Script, Dest) && Address.Set(Dest)) {
62  if (Highlight)
63  return "<span class=\"addr\">" + Address.ToString() + "</span>";
64  else
65  return makeHRef(Address.ToString());
66  } else
67  return Long ? "<pre>" + FormatScript(Script) + "</pre>" : _("Non-standard script");
68 }
69 
70 static std::string TimeToString(uint64_t Time)
71 {
72  QDateTime timestamp;
73  timestamp.setTime_t(Time);
74  return timestamp.toString("yyyy-MM-dd hh:mm:ss").toUtf8().data();
75 }
76 
77 static std::string makeHTMLTableRow(const std::string* pCells, int n)
78 {
79  std::string Result = "<tr>";
80  for (int i = 0; i < n; i++) {
81  Result += "<td class=\"d" + utostr(i) + "\">";
82  Result += pCells[i];
83  Result += "</td>";
84  }
85  Result += "</tr>";
86  return Result;
87 }
88 
89 static const char* table = "<table>";
90 
91 static std::string makeHTMLTable(const std::string* pCells, int nRows, int nColumns)
92 {
93  std::string Table = table;
94  for (int i = 0; i < nRows; i++)
95  Table += makeHTMLTableRow(pCells + i * nColumns, nColumns);
96  Table += "</table>";
97  return Table;
98 }
99 
100 static std::string TxToRow(const CTransaction& tx, const CScript& Highlight = CScript(), const std::string& Prepend = std::string(), int64_t* pSum = NULL)
101 {
102  std::string InAmounts, InAddresses, OutAmounts, OutAddresses;
103  int64_t Delta = 0;
104  for (unsigned int j = 0; j < tx.vin.size(); j++) {
105  if (tx.IsCoinBase()) {
106  InAmounts += ValueToString(tx.GetValueOut());
107  InAddresses += "coinbase";
108  } else {
109  CTxOut PrevOut = getPrevOut(tx.vin[j].prevout);
110  InAmounts += ValueToString(PrevOut.nValue);
111  InAddresses += ScriptToString(PrevOut.scriptPubKey, false, PrevOut.scriptPubKey == Highlight).c_str();
112  if (PrevOut.scriptPubKey == Highlight)
113  Delta -= PrevOut.nValue;
114  }
115  if (j + 1 != tx.vin.size()) {
116  InAmounts += "<br/>";
117  InAddresses += "<br/>";
118  }
119  }
120  for (unsigned int j = 0; j < tx.vout.size(); j++) {
121  CTxOut Out = tx.vout[j];
122  OutAmounts += ValueToString(Out.nValue);
123  OutAddresses += ScriptToString(Out.scriptPubKey, false, Out.scriptPubKey == Highlight);
124  if (Out.scriptPubKey == Highlight)
125  Delta += Out.nValue;
126  if (j + 1 != tx.vout.size()) {
127  OutAmounts += "<br/>";
128  OutAddresses += "<br/>";
129  }
130  }
131 
132  std::string List[8] =
133  {
134  Prepend,
135  makeHRef(tx.GetHash().GetHex()),
136  InAddresses,
137  InAmounts,
138  OutAddresses,
139  OutAmounts,
140  "",
141  ""};
142 
143  int n = sizeof(List) / sizeof(std::string) - 2;
144 
145  if (!Highlight.empty()) {
146  List[n++] = std::string("<font color=\"") + ((Delta > 0) ? "green" : "red") + "\">" + ValueToString(Delta, true) + "</font>";
147  *pSum += Delta;
148  List[n++] = ValueToString(*pSum);
149  return makeHTMLTableRow(List, n);
150  }
151  return makeHTMLTableRow(List + 1, n - 1);
152 }
153 
155 {
156  CTransaction tx;
157  uint256 hashBlock;
158  if (GetTransaction(out.hash, tx, hashBlock, true))
159  return tx.vout[out.n];
160  return CTxOut();
161 }
162 
163 void getNextIn(const COutPoint& Out, uint256& Hash, unsigned int& n)
164 {
165 }
166 
167 const CBlockIndex* getexplorerBlockIndex(int64_t height)
168 {
169  std::string hex = getexplorerBlockHash(height);
170  uint256 hash = uint256S(hex);
171  return mapBlockIndex[hash];
172 }
173 
174 std::string getexplorerBlockHash(int64_t Height)
175 {
176  std::string genesisblockhash = "0000039a711dba61e12c29fb86542fa059e9616aafe9b4c61e065d393f31535e";
178  if ((Height < 0) || (Height > pindexBest->nHeight)) {
179  return genesisblockhash;
180  }
181 
182  CBlock block;
184  while (pblockindex->nHeight > Height)
185  pblockindex = pblockindex->pprev;
186  return pblockindex->GetBlockHash().GetHex(); // pblockindex->phashBlock->GetHex();
187 }
188 
189 std::string BlockToString(CBlockIndex* pBlock)
190 {
191  if (!pBlock)
192  return "";
193 
194  CBlock block;
195  ReadBlockFromDisk(block, pBlock);
196 
197  CAmount Fees = 0;
198  CAmount OutVolume = 0;
199  CAmount Reward = 0;
200 
201  std::string TxLabels[] = {_("Hash"), _("From"), _("Amount"), _("To"), _("Amount")};
202 
203  std::string TxContent = table + makeHTMLTableRow(TxLabels, sizeof(TxLabels) / sizeof(std::string));
204  for (unsigned int i = 0; i < block.vtx.size(); i++) {
205  const CTransaction& tx = block.vtx[i];
206  TxContent += TxToRow(tx);
207 
208  CAmount In = getTxIn(tx);
209  CAmount Out = tx.GetValueOut();
210  if (tx.IsCoinBase())
211  Reward += Out;
212  else if (In < 0)
213  Fees = -MAX_MONEY_OUT;
214  else {
215  Fees += In - Out;
216  OutVolume += Out;
217  }
218  }
219  TxContent += "</table>";
220 
221  CAmount Generated;
222  if (pBlock->nHeight == 0)
223  Generated = OutVolume;
224  else
225  Generated = GetBlockValue(pBlock->pprev->nHeight);
226 
227  std::string BlockContentCells[] =
228  {
229  _("Height"), itostr(pBlock->nHeight),
230  _("Size"), itostr(GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)),
231  _("Number of Transactions"), itostr(block.vtx.size()),
232  _("Value Out"), ValueToString(OutVolume),
233  _("Fees"), ValueToString(Fees),
234  _("Generated"), ValueToString(Generated),
235  _("Timestamp"), TimeToString(block.nTime),
236  _("Difficulty"), strprintf("%.4f", GetDifficulty(pBlock)),
237  _("Bits"), utostr(block.nBits),
238  _("Nonce"), utostr(block.nNonce),
239  _("Version"), itostr(block.nVersion),
240  _("Hash"), "<pre>" + block.GetHash().GetHex() + "</pre>",
241  _("Merkle Root"), "<pre>" + block.hashMerkleRoot.GetHex() + "</pre>",
242  };
243 
244  std::string BlockContent = makeHTMLTable(BlockContentCells, sizeof(BlockContentCells) / (2 * sizeof(std::string)), 2);
245 
246  std::string Content;
247  Content += "<h2><a class=\"nav\" href=";
248  Content += itostr(pBlock->nHeight - 1);
249  Content += ">◄&nbsp;</a>";
250  Content += _("Block");
251  Content += " ";
252  Content += itostr(pBlock->nHeight);
253  Content += "<a class=\"nav\" href=";
254  Content += itostr(pBlock->nHeight + 1);
255  Content += ">&nbsp;►</a></h2>";
256  Content += BlockContent;
257  Content += "</br>";
258  Content += "<h2>" + _("Transactions") + "</h2>";
259  Content += TxContent;
260 
261  return Content;
262 }
263 
264 std::string TxToString(uint256 BlockHash, const CTransaction& tx)
265 {
266  CAmount Input = 0;
267  CAmount Output = tx.GetValueOut();
268 
269  std::string InputsContentCells[] = {_("#"), _("Taken from"), _("Address"), _("Amount")};
270  std::string InputsContent = makeHTMLTableRow(InputsContentCells, sizeof(InputsContentCells) / sizeof(std::string));
271  std::string OutputsContentCells[] = {_("#"), _("Redeemed in"), _("Address"), _("Amount")};
272  std::string OutputsContent = makeHTMLTableRow(OutputsContentCells, sizeof(OutputsContentCells) / sizeof(std::string));
273 
274  if (tx.IsCoinBase()) {
275  std::string InputsContentCells[] =
276  {
277  "0",
278  "coinbase",
279  "-",
280  ValueToString(Output)};
281  InputsContent += makeHTMLTableRow(InputsContentCells, sizeof(InputsContentCells) / sizeof(std::string));
282  } else
283  for (unsigned int i = 0; i < tx.vin.size(); i++) {
284  COutPoint Out = tx.vin[i].prevout;
285  CTxOut PrevOut = getPrevOut(tx.vin[i].prevout);
286  if (PrevOut.nValue < 0)
287  Input = -MAX_MONEY_OUT;
288  else
289  Input += PrevOut.nValue;
290  std::string InputsContentCells[] =
291  {
292  itostr(i),
293  "<span>" + makeHRef(Out.hash.GetHex()) + ":" + itostr(Out.n) + "</span>",
294  ScriptToString(PrevOut.scriptPubKey, true),
295  ValueToString(PrevOut.nValue)};
296  InputsContent += makeHTMLTableRow(InputsContentCells, sizeof(InputsContentCells) / sizeof(std::string));
297  }
298 
299  uint256 TxHash = tx.GetHash();
300  for (unsigned int i = 0; i < tx.vout.size(); i++) {
301  const CTxOut& Out = tx.vout[i];
302  uint256 HashNext = uint256S("0");
303  unsigned int nNext = 0;
304  bool fAddrIndex = false;
305  getNextIn(COutPoint(TxHash, i), HashNext, nNext);
306  std::string OutputsContentCells[] =
307  {
308  itostr(i),
309  (HashNext == uint256S("0")) ? (fAddrIndex ? _("no") : _("unknown")) : "<span>" + makeHRef(HashNext.GetHex()) + ":" + itostr(nNext) + "</span>",
310  ScriptToString(Out.scriptPubKey, true),
311  ValueToString(Out.nValue)};
312  OutputsContent += makeHTMLTableRow(OutputsContentCells, sizeof(OutputsContentCells) / sizeof(std::string));
313  }
314 
315  InputsContent = table + InputsContent + "</table>";
316  OutputsContent = table + OutputsContent + "</table>";
317 
318  std::string Hash = TxHash.GetHex();
319 
320  std::string Labels[] =
321  {
322  _("In Block"), "",
323  _("Size"), itostr(GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION)),
324  _("Input"), tx.IsCoinBase() ? "-" : ValueToString(Input),
325  _("Output"), ValueToString(Output),
326  _("Fees"), tx.IsCoinBase() ? "-" : ValueToString(Input - Output),
327  _("Timestamp"), "",
328  _("Hash"), "<pre>" + Hash + "</pre>",
329  };
330 
331  // std::map<uint256, CBlockIndex*>::iterator iter = mapBlockIndex.find(BlockHash);
332  BlockMap::iterator iter = mapBlockIndex.find(BlockHash);
333  if (iter != mapBlockIndex.end()) {
334  CBlockIndex* pIndex = iter->second;
335  Labels[0 * 2 + 1] = makeHRef(itostr(pIndex->nHeight));
336  Labels[5 * 2 + 1] = TimeToString(pIndex->nTime);
337  }
338 
339  std::string Content;
340  Content += "<h2>" + _("Transaction") + "&nbsp;<span>" + Hash + "</span></h2>";
341  Content += makeHTMLTable(Labels, sizeof(Labels) / (2 * sizeof(std::string)), 2);
342  Content += "</br>";
343  Content += "<h3>" + _("Inputs") + "</h3>";
344  Content += InputsContent;
345  Content += "</br>";
346  Content += "<h3>" + _("Outputs") + "</h3>";
347  Content += OutputsContent;
348 
349  return Content;
350 }
351 
352 std::string AddressToString(const CBitcoinAddress& Address)
353 {
354  std::string TxLabels[] =
355  {
356  _("Date"),
357  _("Hash"),
358  _("From"),
359  _("Amount"),
360  _("To"),
361  _("Amount"),
362  _("Delta"),
363  _("Balance")};
364  std::string TxContent = table + makeHTMLTableRow(TxLabels, sizeof(TxLabels) / sizeof(std::string));
365 
366  std::set<COutPoint> PrevOuts;
367  TxContent += "</table>";
368 
369  std::string Content;
370  Content += "<h1>" + _("Transactions to/from") + "&nbsp;<span>" + Address.ToString() + "</span></h1>";
371  Content += TxContent;
372  return Content;
373 }
374 
375 BlockExplorer::BlockExplorer(QWidget* parent) : QMainWindow(parent),
376  ui(new Ui::BlockExplorer),
377  m_NeverShown(true),
378  m_HistoryIndex(0)
379 {
380  ui->setupUi(this);
381 
382  this->setStyleSheet(GUIUtil::loadStyleSheet());
383 
384  connect(ui->pushSearch, SIGNAL(released()), this, SLOT(onSearch()));
385  connect(ui->content, SIGNAL(linkActivated(const QString&)), this, SLOT(goTo(const QString&)));
386  connect(ui->back, SIGNAL(released()), this, SLOT(back()));
387  connect(ui->forward, SIGNAL(released()), this, SLOT(forward()));
388 }
389 
391 {
392  delete ui;
393 }
394 
395 void BlockExplorer::keyPressEvent(QKeyEvent* event)
396 {
397  switch ((Qt::Key)event->key()) {
398  case Qt::Key_Enter:
399  case Qt::Key_Return:
400  onSearch();
401  return;
402 
403  default:
404  return QMainWindow::keyPressEvent(event);
405  }
406 }
407 
408 void BlockExplorer::showEvent(QShowEvent*)
409 {
410  if (m_NeverShown) {
411  m_NeverShown = false;
412 
414 
415  setBlock(pindexBest);
416  QString text = QString("%1").arg(pindexBest->nHeight);
417  ui->searchBox->setText(text);
418  m_History.push_back(text);
420 
421  if (!GetBoolArg("-txindex", true)) {
422  QString Warning = tr("Not all transactions will be shown. To view all transactions you need to set txindex=1 in the configuration file (prcycoin.conf).");
423  QMessageBox::warning(this, "PRCY Blockchain Explorer", Warning, QMessageBox::Ok);
424  }
425  }
426 }
427 
428 bool BlockExplorer::switchTo(const QString& query)
429 {
430  bool IsOk;
431  int64_t AsInt = query.toInt(&IsOk);
432  // If query is integer, get hash from height
433  if (IsOk && AsInt >= 0 && AsInt <= chainActive.Tip()->nHeight) {
434  std::string hex = getexplorerBlockHash(AsInt);
435  uint256 hash = uint256S(hex);
436  CBlockIndex* pIndex = mapBlockIndex[hash];
437  if (pIndex) {
438  setBlock(pIndex);
439  return true;
440  }
441  }
442 
443  // If the query is not an integer, assume it is a block hash
444  uint256 hash = uint256S(query.toUtf8().constData());
445 
446  BlockMap::iterator iter = mapBlockIndex.find(hash);
447  if (iter != mapBlockIndex.end()) {
448  setBlock(iter->second);
449  return true;
450  }
451 
452  // If the query is neither an integer nor a block hash, assume a transaction hash
453  CTransaction tx;
454  uint256 hashBlock = UINT256_ZERO;
455  if (GetTransaction(hash, tx, hashBlock, true)) {
456  setContent(TxToString(hashBlock, tx));
457  return true;
458  }
459 
460  // If the query is not an integer, nor a block hash, nor a transaction hash, assume an address
461  CBitcoinAddress Address;
462  Address.SetString(query.toUtf8().constData());
463  if (Address.IsValid()) {
464  std::string Content = AddressToString(Address);
465  if (Content.empty())
466  return false;
467  setContent(Content);
468  return true;
469  }
470 
471  return false;
472 }
473 
474 void BlockExplorer::goTo(const QString& query)
475 {
476  if (switchTo(query)) {
477  ui->searchBox->setText(query);
478  while (m_History.size() > m_HistoryIndex + 1)
479  m_History.pop_back();
480  m_History.push_back(query);
481  m_HistoryIndex = m_History.size() - 1;
483  }
484 }
485 
487 {
488  goTo(ui->searchBox->text());
489 }
490 
492 {
493  setContent(BlockToString(pBlock));
494 }
495 
496 void BlockExplorer::setContent(const std::string& Content)
497 {
498  QString CSS = "body {font-size:12px; color:#f8f6f6; bgcolor:#5B4C7C;}\n a, span { font-family: monospace; }\n span.addr {color:#5B4C7C; font-weight: bold;}\n table tr td {padding: 3px; border: 1px solid black; background-color: #5B4C7C;}\n td.d0 {font-weight: bold; color:#f8f6f6;}\n h2, h3 { white-space:nowrap; color:#5B4C7C;}\n a { color:#88f6f6; text-decoration:none; }\n a.nav {color:#5B4C7C;}\n";
499  QString FullContent = "<html><head><style type=\"text/css\">" + CSS + "</style></head>" + "<body>" + Content.c_str() + "</body></html>";
500 
501  ui->content->setText(FullContent);
502 }
503 
505 {
506  int NewIndex = m_HistoryIndex - 1;
507  if (0 <= NewIndex && NewIndex < m_History.size()) {
508  m_HistoryIndex = NewIndex;
509  ui->searchBox->setText(m_History[NewIndex]);
510  switchTo(m_History[NewIndex]);
512  }
513 }
514 
516 {
517  int NewIndex = m_HistoryIndex + 1;
518  if (0 <= NewIndex && NewIndex < m_History.size()) {
519  m_HistoryIndex = NewIndex;
520  ui->searchBox->setText(m_History[NewIndex]);
521  switchTo(m_History[NewIndex]);
523  }
524 }
525 
527 {
528  ui->back->setEnabled(m_HistoryIndex - 1 >= 0);
529  ui->forward->setEnabled(m_HistoryIndex + 1 < m_History.size());
530 }
UINT256_ZERO
const uint256 UINT256_ZERO
constant uint256 instances
Definition: uint256.h:129
AddressToString
std::string AddressToString(const CBitcoinAddress &Address)
Definition: blockexplorer.cpp:352
CBlockHeader::hashMerkleRoot
uint256 hashMerkleRoot
Definition: block.h:62
CBlockHeader::nBits
uint32_t nBits
Definition: block.h:65
BlockExplorer::showEvent
void showEvent(QShowEvent *)
Definition: blockexplorer.cpp:408
BitcoinUnits::formatWithUnit
static QString formatWithUnit(int unit, const CAmount &amount, bool plussign=false, SeparatorStyle separators=separatorStandard)
Format as string (with unit)
Definition: bitcoinunits.cpp:190
BlockExplorer::m_NeverShown
bool m_NeverShown
Definition: blockexplorer.h:45
base_uint::GetHex
std::string GetHex() const
Definition: arith_uint256.cpp:155
BlockExplorer::forward
void forward()
Definition: blockexplorer.cpp:515
CBlockHeader::nVersion
int32_t nVersion
Definition: block.h:59
chainActive
CChain chainActive
The currently-connected chain of blocks.
Definition: main.cpp:70
COutPoint::hash
uint256 hash
Definition: transaction.h:39
CBitcoinAddress
base58-encoded PRCY addresses.
Definition: base58.h:109
utostr
std::string utostr(unsigned int n)
Definition: blockexplorer.cpp:22
CBlockIndex::pprev
CBlockIndex * pprev
pointer to the index of the predecessor of this block
Definition: chain.h:169
CBlockIndex::nHeight
int nHeight
height of the entry in the chain. The genesis block has height 0
Definition: chain.h:181
getNextIn
void getNextIn(const COutPoint &Out, uint256 &Hash, unsigned int &n)
Definition: blockexplorer.cpp:163
GetSerializeSize
unsigned int GetSerializeSize(char a, int, int=0)
Definition: serialize.h:194
FormatScript
std::string FormatScript(const CScript &script)
Definition: core_write.cpp:20
CBitcoinAddress::Set
bool Set(const CKeyID &id)
Definition: base58.cpp:237
CTransaction::GetValueOut
CAmount GetValueOut() const
Definition: transaction.cpp:155
chainparams.h
getPrevOut
CTxOut getPrevOut(const COutPoint &out)
Definition: blockexplorer.cpp:154
guiinterface.h
SER_NETWORK
@ SER_NETWORK
Definition: serialize.h:159
CBase58Data::ToString
std::string ToString() const
Definition: base58.cpp:200
core_io.h
CBlockHeader::GetHash
uint256 GetHash() const
Definition: block.cpp:80
CTransaction
The basic transaction that is broadcasted on the network and contained in blocks.
Definition: transaction.h:269
CBlockIndex::nTime
unsigned int nTime
Definition: chain.h:228
CTxOut::nValue
CAmount nValue
Definition: transaction.h:167
BlockExplorer::~BlockExplorer
~BlockExplorer()
Definition: blockexplorer.cpp:390
CBlockHeader::nNonce
uint32_t nNonce
Definition: block.h:66
CTransaction::IsCoinBase
bool IsCoinBase() const
Definition: transaction.h:359
BlockExplorer::BlockExplorer
BlockExplorer(QWidget *parent=0)
Definition: blockexplorer.cpp:375
CBase58Data::SetString
bool SetString(const char *psz, unsigned int nVersionBytes=1)
Definition: base58.cpp:178
BlockExplorer::m_History
QStringList m_History
Definition: blockexplorer.h:47
CTxOut
An output of a transaction.
Definition: transaction.h:164
_
std::string _(const char *psz)
Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
Definition: guiinterface.h:119
BlockExplorer::switchTo
bool switchTo(const QString &query)
Definition: blockexplorer.cpp:428
GetTransaction
bool GetTransaction(const uint256 &hash, CTransaction &tx, uint256 &hashBlock, bool fAllowSlow, CBlockIndex *blockIndex)
Return transaction in tx, and if it was found inside a block, its hash is placed in hashBlock.
Definition: main.cpp:2010
BitcoinUnits::PRCY
@ PRCY
Definition: bitcoinunits.h:61
CTransaction::vout
std::vector< CTxOut > vout
Definition: transaction.h:286
CTxOut::scriptPubKey
CScript scriptPubKey
Definition: transaction.h:168
BlockExplorer::setBlock
void setBlock(CBlockIndex *pBlock)
Definition: blockexplorer.cpp:491
GetBoolArg
bool GetBoolArg(const std::string &strArg, bool fDefault)
Return boolean argument or default value.
Definition: util.cpp:255
getexplorerBlockIndex
const CBlockIndex * getexplorerBlockIndex(int64_t height)
Definition: blockexplorer.cpp:167
CAmount
int64_t CAmount
Amount in PRCY (Can be negative)
Definition: amount.h:17
guiutil.h
CBlockHeader::nTime
uint32_t nTime
Definition: block.h:64
uint256
256-bit unsigned big integer.
Definition: uint256.h:38
uint256S
uint256 uint256S(const char *str)
Definition: uint256.h:99
BlockExplorer::setContent
void setContent(const std::string &content)
Definition: blockexplorer.cpp:496
CScript
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:363
ExtractDestination
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Definition: standard.cpp:199
CBlockIndex::GetBlockHash
uint256 GetBlockHash() const
Definition: chain.h:359
CTxDestination
boost::variant< CNoDestination, CKeyID, CScriptID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:81
BlockExplorer::back
void back()
Definition: blockexplorer.cpp:504
BlockExplorer::goTo
void goTo(const QString &query)
Definition: blockexplorer.cpp:474
BlockExplorer::keyPressEvent
void keyPressEvent(QKeyEvent *event)
Definition: blockexplorer.cpp:395
BlockExplorer
Definition: blockexplorer.h:25
CBlock::vtx
std::vector< CTransaction > vtx
Definition: block.h:146
CBlock
Definition: block.h:142
strprintf
#define strprintf
Definition: tinyformat.h:1056
Ui
Definition: 2faconfirmdialog.h:7
itostr
std::string itostr(int n)
Definition: utilstrencodings.cpp:564
BlockExplorer::onSearch
void onSearch()
Definition: blockexplorer.cpp:486
main.h
COutPoint::n
uint32_t n
Definition: transaction.h:40
CTransaction::vin
std::vector< CTxIn > vin
Definition: transaction.h:285
ReadBlockFromDisk
bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos)
Definition: main.cpp:2101
BlockExplorer::updateNavButtons
void updateNavButtons()
Definition: blockexplorer.cpp:526
bitcoinunits.h
GetBlockValue
CAmount GetBlockValue(int nHeight)
Definition: main.cpp:2158
BlockToString
std::string BlockToString(CBlockIndex *pBlock)
Definition: blockexplorer.cpp:189
prevector::empty
bool empty() const
Definition: prevector.h:286
CTransaction::GetHash
const uint256 & GetHash() const
Definition: transaction.h:342
getexplorerBlockHash
std::string getexplorerBlockHash(int64_t Height)
Definition: blockexplorer.cpp:174
COutPoint
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:36
utilstrencodings.h
CChain::Tip
CBlockIndex * Tip(bool fProofOfStake=false) const
Returns the index entry for the tip of this chain, or NULL if none.
Definition: chain.h:596
blockexplorer.h
Hash
std::string Hash(std::string input)
Compute the 256-bit hash of a std::string.
Definition: hash.h:122
CBitcoinAddress::IsValid
bool IsValid() const
Definition: base58.cpp:254
GUIUtil::loadStyleSheet
QString loadStyleSheet()
Load global CSS theme.
Definition: guiutil.cpp:721
net.h
CBlockIndex
The block chain is a tree shaped structure starting with the genesis block at the root,...
Definition: chain.h:162
amount.h
txdb.h
clientmodel.h
BlockExplorer::m_HistoryIndex
int m_HistoryIndex
Definition: blockexplorer.h:46
TxToString
std::string TxToString(uint256 BlockHash, const CTransaction &tx)
Definition: blockexplorer.cpp:264
mapBlockIndex
BlockMap mapBlockIndex
Definition: main.cpp:67
GetDifficulty
double GetDifficulty(const CBlockIndex *blockindex=NULL)
Definition: blockchain.cpp:39
BlockExplorer::ui
Ui::BlockExplorer * ui
Definition: blockexplorer.h:44