Anoncoin  0.9.4
P2P Digital Currency
rpcblockchain.cpp
Go to the documentation of this file.
1 // Copyright (c) 2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2013 The Bitcoin developers
3 // Copyright (c) 2013-2014 The Anoncoin Core developers
4 // Distributed under the MIT/X11 software license, see the accompanying
5 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
6 
7 #include "rpcserver.h"
8 #include "main.h"
9 #include "sync.h"
10 #include "checkpoints.h"
11 
12 #include <stdint.h>
13 
14 #include "json/json_spirit_value.h"
15 
16 using namespace json_spirit;
17 using namespace std;
18 
19 void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out, bool fIncludeHex);
20 
21 double GetDifficulty(const CBlockIndex* blockindex)
22 {
23  // Floating point number that is a multiple of the minimum difficulty,
24  // minimum difficulty = 1.0.
25  if (blockindex == NULL)
26  {
27  if (chainActive.Tip() == NULL)
28  return 1.0;
29  else
30  blockindex = chainActive.Tip();
31  }
32 
33  int nShift = (blockindex->nBits >> 24) & 0xff;
34 
35  double dDiff =
36  (double)0x0000ffff / (double)(blockindex->nBits & 0x00ffffff);
37 
38  while (nShift < 29)
39  {
40  dDiff *= 256.0;
41  nShift++;
42  }
43  while (nShift > 29)
44  {
45  dDiff /= 256.0;
46  nShift--;
47  }
48 
49  return dDiff;
50 }
51 
52 
53 Object blockToJSON(const CBlock& block, const CBlockIndex* blockindex)
54 {
55  Object result;
56  result.push_back(Pair("hash", block.GetHash().GetHex()));
57  CMerkleTx txGen(block.vtx[0]);
58  txGen.SetMerkleBranch(&block);
59  result.push_back(Pair("confirmations", (int)txGen.GetDepthInMainChain()));
60  result.push_back(Pair("size", (int)::GetSerializeSize(block, SER_NETWORK, PROTOCOL_VERSION)));
61  result.push_back(Pair("height", blockindex->nHeight));
62  result.push_back(Pair("version", block.nVersion));
63  result.push_back(Pair("merkleroot", block.hashMerkleRoot.GetHex()));
64  Array txs;
65  BOOST_FOREACH(const CTransaction&tx, block.vtx)
66  txs.push_back(tx.GetHash().GetHex());
67  result.push_back(Pair("tx", txs));
68  result.push_back(Pair("time", block.GetBlockTime()));
69  result.push_back(Pair("nonce", (uint64_t)block.nNonce));
70  result.push_back(Pair("bits", HexBits(block.nBits)));
71  result.push_back(Pair("difficulty", GetDifficulty(blockindex)));
72  result.push_back(Pair("chainwork", blockindex->nChainWork.GetHex()));
73 
74  if (blockindex->pprev)
75  result.push_back(Pair("previousblockhash", blockindex->pprev->GetBlockHash().GetHex()));
76  CBlockIndex *pnext = chainActive.Next(blockindex);
77  if (pnext)
78  result.push_back(Pair("nextblockhash", pnext->GetBlockHash().GetHex()));
79  return result;
80 }
81 
82 
83 Value getblockcount(const Array& params, bool fHelp)
84 {
85  if (fHelp || params.size() != 0)
86  throw runtime_error(
87  "getblockcount\n"
88  "\nReturns the number of blocks in the longest block chain.\n"
89  "\nResult:\n"
90  "n (numeric) The current block count\n"
91  "\nExamples:\n"
92  + HelpExampleCli("getblockcount", "")
93  + HelpExampleRpc("getblockcount", "")
94  );
95 
96  return chainActive.Height();
97 }
98 
99 Value getbestblockhash(const Array& params, bool fHelp)
100 {
101  if (fHelp || params.size() != 0)
102  throw runtime_error(
103  "getbestblockhash\n"
104  "\nReturns the hash of the best (tip) block in the longest block chain.\n"
105  "\nResult\n"
106  "\"hex\" (string) the block hash hex encoded\n"
107  "\nExamples\n"
108  + HelpExampleCli("getbestblockhash", "")
109  + HelpExampleRpc("getbestblockhash", "")
110  );
111 
112  return chainActive.Tip()->GetBlockHash().GetHex();
113 }
114 
115 Value getdifficulty(const Array& params, bool fHelp)
116 {
117  if (fHelp || params.size() != 0)
118  throw runtime_error(
119  "getdifficulty\n"
120  "\nReturns the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
121  "\nResult:\n"
122  "n.nnn (numeric) the proof-of-work difficulty as a multiple of the minimum difficulty.\n"
123  "\nExamples:\n"
124  + HelpExampleCli("getdifficulty", "")
125  + HelpExampleRpc("getdifficulty", "")
126  );
127 
128  return GetDifficulty();
129 }
130 
131 
132 Value getrawmempool(const Array& params, bool fHelp)
133 {
134  if (fHelp || params.size() > 1)
135  throw runtime_error(
136  "getrawmempool ( verbose )\n"
137  "\nReturns all transaction ids in memory pool as a json array of string transaction ids.\n"
138  "\nArguments:\n"
139  "1. verbose (boolean, optional, default=false) true for a json object, false for array of transaction ids\n"
140  "\nResult: (for verbose = false):\n"
141  "[ (json array of string)\n"
142  " \"transactionid\" (string) The transaction id\n"
143  " ,...\n"
144  "]\n"
145  "\nResult: (for verbose = true):\n"
146  "{ (json object)\n"
147  " \"transactionid\" : { (json object)\n"
148  " \"size\" : n, (numeric) transaction size in bytes\n"
149  " \"fee\" : n, (numeric) transaction fee in anoncoins\n"
150  " \"time\" : n, (numeric) local time transaction entered pool in seconds since 1 Jan 1970 GMT\n"
151  " \"height\" : n, (numeric) block height when transaction entered pool\n"
152  " \"startingpriority\" : n, (numeric) priority when transaction entered pool\n"
153  " \"currentpriority\" : n, (numeric) transaction priority now\n"
154  " \"depends\" : [ (array) unconfirmed transactions used as inputs for this transaction\n"
155  " \"transactionid\", (string) parent transaction id\n"
156  " ... ]\n"
157  " }, ...\n"
158  "]\n"
159  "\nExamples\n"
160  + HelpExampleCli("getrawmempool", "true")
161  + HelpExampleRpc("getrawmempool", "true")
162  );
163 
164  bool fVerbose = false;
165  if (params.size() > 0)
166  fVerbose = params[0].get_bool();
167 
168  if (fVerbose)
169  {
170  LOCK(mempool.cs);
171  Object o;
172  BOOST_FOREACH(const PAIRTYPE(uint256, CTxMemPoolEntry)& entry, mempool.mapTx)
173  {
174  const uint256& hash = entry.first;
175  const CTxMemPoolEntry& e = entry.second;
176  Object info;
177  info.push_back(Pair("size", (int)e.GetTxSize()));
178  info.push_back(Pair("fee", ValueFromAmount(e.GetFee())));
179  info.push_back(Pair("time", e.GetTime()));
180  info.push_back(Pair("height", (int)e.GetHeight()));
181  info.push_back(Pair("startingpriority", e.GetPriority(e.GetHeight())));
182  info.push_back(Pair("currentpriority", e.GetPriority(chainActive.Height())));
183  const CTransaction& tx = e.GetTx();
184  set<string> setDepends;
185  BOOST_FOREACH(const CTxIn& txin, tx.vin)
186  {
187  if (mempool.exists(txin.prevout.hash))
188  setDepends.insert(txin.prevout.hash.ToString());
189  }
190  Array depends(setDepends.begin(), setDepends.end());
191  info.push_back(Pair("depends", depends));
192  o.push_back(Pair(hash.ToString(), info));
193  }
194  return o;
195  }
196  else
197  {
198  vector<uint256> vtxid;
199  mempool.queryHashes(vtxid);
200 
201  Array a;
202  BOOST_FOREACH(const uint256& hash, vtxid)
203  a.push_back(hash.ToString());
204 
205  return a;
206  }
207 }
208 
209 Value getblockhash(const Array& params, bool fHelp)
210 {
211  if (fHelp || params.size() != 1)
212  throw runtime_error(
213  "getblockhash index\n"
214  "\nReturns hash of block in best-block-chain at index provided.\n"
215  "\nArguments:\n"
216  "1. index (numeric, required) The block index\n"
217  "\nResult:\n"
218  "\"hash\" (string) The block hash\n"
219  "\nExamples:\n"
220  + HelpExampleCli("getblockhash", "1000")
221  + HelpExampleRpc("getblockhash", "1000")
222  );
223 
224  int nHeight = params[0].get_int();
225  if (nHeight < 0 || nHeight > chainActive.Height())
226  throw runtime_error("Block number out of range.");
227 
228  CBlockIndex* pblockindex = chainActive[nHeight];
229  return pblockindex->GetBlockHash().GetHex();
230 }
231 
232 Value getblock(const Array& params, bool fHelp)
233 {
234  if (fHelp || params.size() < 1 || params.size() > 2)
235  throw runtime_error(
236  "getblock \"hash\" ( verbose )\n"
237  "\nIf verbose is false, returns a string that is serialized, hex-encoded data for block 'hash'.\n"
238  "If verbose is true, returns an Object with information about block <hash>.\n"
239  "\nArguments:\n"
240  "1. \"hash\" (string, required) The block hash\n"
241  "2. verbose (boolean, optional, default=true) true for a json object, false for the hex encoded data\n"
242  "\nResult (for verbose = true):\n"
243  "{\n"
244  " \"hash\" : \"hash\", (string) the block hash (same as provided)\n"
245  " \"confirmations\" : n, (numeric) The number of confirmations\n"
246  " \"size\" : n, (numeric) The block size\n"
247  " \"height\" : n, (numeric) The block height or index\n"
248  " \"version\" : n, (numeric) The block version\n"
249  " \"merkleroot\" : \"xxxx\", (string) The merkle root\n"
250  " \"tx\" : [ (array of string) The transaction ids\n"
251  " \"transactionid\" (string) The transaction id\n"
252  " ,...\n"
253  " ],\n"
254  " \"time\" : ttt, (numeric) The block time in seconds since epoch (Jan 1 1970 GMT)\n"
255  " \"nonce\" : n, (numeric) The nonce\n"
256  " \"bits\" : \"1d00ffff\", (string) The bits\n"
257  " \"difficulty\" : x.xxx, (numeric) The difficulty\n"
258  " \"previousblockhash\" : \"hash\", (string) The hash of the previous block\n"
259  " \"nextblockhash\" : \"hash\" (string) The hash of the next block\n"
260  "}\n"
261  "\nResult (for verbose=false):\n"
262  "\"data\" (string) A string that is serialized, hex-encoded data for block 'hash'.\n"
263  "\nExamples:\n"
264  + HelpExampleCli("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
265  + HelpExampleRpc("getblock", "\"00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09\"")
266  );
267 
268  std::string strHash = params[0].get_str();
269  uint256 hash(strHash);
270 
271  bool fVerbose = true;
272  if (params.size() > 1)
273  fVerbose = params[1].get_bool();
274 
275  if (mapBlockIndex.count(hash) == 0)
276  throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Block not found");
277 
278  CBlock block;
279  CBlockIndex* pblockindex = mapBlockIndex[hash];
280 
281  if(!ReadBlockFromDisk(block, pblockindex))
282  throw JSONRPCError(RPC_INTERNAL_ERROR, "Can't read block from disk");
283 
284  if (!fVerbose)
285  {
286  CDataStream ssBlock(SER_NETWORK, PROTOCOL_VERSION);
287  ssBlock << block;
288  std::string strHex = HexStr(ssBlock.begin(), ssBlock.end());
289  return strHex;
290  }
291 
292  return blockToJSON(block, pblockindex);
293 }
294 
295 Value gettxoutsetinfo(const Array& params, bool fHelp)
296 {
297  if (fHelp || params.size() != 0)
298  throw runtime_error(
299  "gettxoutsetinfo\n"
300  "\nReturns statistics about the unspent transaction output set.\n"
301  "Note this call may take some time.\n"
302  "\nResult:\n"
303  "{\n"
304  " \"height\":n, (numeric) The current block height (index)\n"
305  " \"bestblock\": \"hex\", (string) the best block hash hex\n"
306  " \"transactions\": n, (numeric) The number of transactions\n"
307  " \"txouts\": n, (numeric) The number of output transactions\n"
308  " \"bytes_serialized\": n, (numeric) The serialized size\n"
309  " \"hash_serialized\": \"hash\", (string) The serialized hash\n"
310  " \"total_amount\": x.xxx (numeric) The total amount\n"
311  "}\n"
312  "\nExamples:\n"
313  + HelpExampleCli("gettxoutsetinfo", "")
314  + HelpExampleRpc("gettxoutsetinfo", "")
315  );
316 
317  Object ret;
318 
319  CCoinsStats stats;
320  if (pcoinsTip->GetStats(stats)) {
321  ret.push_back(Pair("height", (int64_t)stats.nHeight));
322  ret.push_back(Pair("bestblock", stats.hashBlock.GetHex()));
323  ret.push_back(Pair("transactions", (int64_t)stats.nTransactions));
324  ret.push_back(Pair("txouts", (int64_t)stats.nTransactionOutputs));
325  ret.push_back(Pair("bytes_serialized", (int64_t)stats.nSerializedSize));
326  ret.push_back(Pair("hash_serialized", stats.hashSerialized.GetHex()));
327  ret.push_back(Pair("total_amount", ValueFromAmount(stats.nTotalAmount)));
328  }
329  return ret;
330 }
331 
332 Value gettxout(const Array& params, bool fHelp)
333 {
334  if (fHelp || params.size() < 2 || params.size() > 3)
335  throw runtime_error(
336  "gettxout \"txid\" n ( includemempool )\n"
337  "\nReturns details about an unspent transaction output.\n"
338  "\nArguments:\n"
339  "1. \"txid\" (string, required) The transaction id\n"
340  "2. n (numeric, required) vout value\n"
341  "3. includemempool (boolean, optional) Whether to included the mem pool\n"
342  "\nResult:\n"
343  "{\n"
344  " \"bestblock\" : \"hash\", (string) the block hash\n"
345  " \"confirmations\" : n, (numeric) The number of confirmations\n"
346  " \"value\" : x.xxx, (numeric) The transaction value in btc\n"
347  " \"scriptPubKey\" : { (json object)\n"
348  " \"asm\" : \"code\", (string) \n"
349  " \"hex\" : \"hex\", (string) \n"
350  " \"reqSigs\" : n, (numeric) Number of required signatures\n"
351  " \"type\" : \"pubkeyhash\", (string) The type, eg pubkeyhash\n"
352  " \"addresses\" : [ (array of string) array of anoncoin addresses\n"
353  " \"anoncoinaddress\" (string) anoncoin address\n"
354  " ,...\n"
355  " ]\n"
356  " },\n"
357  " \"version\" : n, (numeric) The version\n"
358  " \"coinbase\" : true|false (boolean) Coinbase or not\n"
359  "}\n"
360 
361  "\nExamples:\n"
362  "\nGet unspent transactions\n"
363  + HelpExampleCli("listunspent", "") +
364  "\nView the details\n"
365  + HelpExampleCli("gettxout", "\"txid\" 1") +
366  "\nAs a json rpc call\n"
367  + HelpExampleRpc("gettxout", "\"txid\", 1")
368  );
369 
370  Object ret;
371 
372  std::string strHash = params[0].get_str();
373  uint256 hash(strHash);
374  int n = params[1].get_int();
375  bool fMempool = true;
376  if (params.size() > 2)
377  fMempool = params[2].get_bool();
378 
379  CCoins coins;
380  if (fMempool) {
381  LOCK(mempool.cs);
383  if (!view.GetCoins(hash, coins))
384  return Value::null;
385  mempool.pruneSpent(hash, coins); // TODO: this should be done by the CCoinsViewMemPool
386  } else {
387  if (!pcoinsTip->GetCoins(hash, coins))
388  return Value::null;
389  }
390  if (n<0 || (unsigned int)n>=coins.vout.size() || coins.vout[n].IsNull())
391  return Value::null;
392 
393  std::map<uint256, CBlockIndex*>::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock());
394  CBlockIndex *pindex = it->second;
395  ret.push_back(Pair("bestblock", pindex->GetBlockHash().GetHex()));
396  if ((unsigned int)coins.nHeight == MEMPOOL_HEIGHT)
397  ret.push_back(Pair("confirmations", 0));
398  else
399  ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1));
400  ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue)));
401  Object o;
402  ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true);
403  ret.push_back(Pair("scriptPubKey", o));
404  ret.push_back(Pair("version", coins.nVersion));
405  ret.push_back(Pair("coinbase", coins.fCoinBase));
406 
407  return ret;
408 }
409 
410 Value verifychain(const Array& params, bool fHelp)
411 {
412  if (fHelp || params.size() > 2)
413  throw runtime_error(
414  "verifychain ( checklevel numblocks )\n"
415  "\nVerifies blockchain database.\n"
416  "\nArguments:\n"
417  "1. checklevel (numeric, optional, 0-4, default=3) How thorough the block verification is.\n"
418  "2. numblocks (numeric, optional, default=288, 0=all) The number of blocks to check.\n"
419  "\nResult:\n"
420  "true|false (boolean) Verified or not\n"
421  "\nExamples:\n"
422  + HelpExampleCli("verifychain", "")
423  + HelpExampleRpc("verifychain", "")
424  );
425 
426  int nCheckLevel = GetArg("-checklevel", 3);
427  int nCheckDepth = GetArg("-checkblocks", 288);
428  if (params.size() > 0)
429  nCheckLevel = params[0].get_int();
430  if (params.size() > 1)
431  nCheckDepth = params[1].get_int();
432 
433  return VerifyDB(nCheckLevel, nCheckDepth);
434 }
435 
436 Value getblockchaininfo(const Array& params, bool fHelp)
437 {
438  if (fHelp || params.size() != 0)
439  throw runtime_error(
440  "getblockchaininfo\n"
441  "Returns an object containing various state info regarding block chain processing.\n"
442  "\nResult:\n"
443  "{\n"
444  " \"chain\": \"xxxx\", (string) current chain (main, testnet3, regtest)\n"
445  " \"blocks\": xxxxxx, (numeric) the current number of blocks processed in the server\n"
446  " \"bestblockhash\": \"...\", (string) the hash of the currently best block\n"
447  " \"difficulty\": xxxxxx, (numeric) the current difficulty\n"
448  " \"verificationprogress\": xxxx, (numeric) estimate of verification progress [0..1]\n"
449  " \"chainwork\": \"xxxx\" (string) total amount of work in active chain, in hexadecimal\n"
450  "}\n"
451  "\nExamples:\n"
452  + HelpExampleCli("getblockchaininfo", "")
453  + HelpExampleRpc("getblockchaininfo", "")
454  );
455 
456  proxyType proxy;
457  GetProxy(NET_IPV4, proxy);
458 
459  Object obj;
460  std::string chain = Params().DataDir();
461  if(chain.empty())
462  chain = "main";
463  obj.push_back(Pair("chain", chain));
464  obj.push_back(Pair("blocks", (int)chainActive.Height()));
465  obj.push_back(Pair("bestblockhash", chainActive.Tip()->GetBlockHash().GetHex()));
466  obj.push_back(Pair("difficulty", (double)GetDifficulty()));
467  obj.push_back(Pair("verificationprogress", Checkpoints::GuessVerificationProgress(chainActive.Tip())));
468  obj.push_back(Pair("chainwork", chainActive.Tip()->nChainWork.GetHex()));
469  return obj;
470 }
const string & DataDir() const
Definition: chainparams.h:83
uint64_t nTransactionOutputs
Definition: coins.h:249
unsigned int GetHeight() const
Definition: txmempool.h:42
int nVersion
Definition: core.h:345
int64_t nTotalAmount
Definition: coins.h:252
uint256 hashBlock
Definition: coins.h:247
const_iterator begin() const
Definition: serialize.h:933
CBlockIndex * pprev
Definition: main.h:705
std::vector< CTxOut > vout
Definition: coins.h:76
void ScriptPubKeyToJSON(const CScript &scriptPubKey, Object &out, bool fIncludeHex)
int nHeight
Definition: coins.h:246
Definition: core.h:394
#define PAIRTYPE(t1, t2)
Definition: util.h:49
Value getblockcount(const Array &params, bool fHelp)
std::string HelpExampleRpc(string methodname, string args)
Definition: rpcserver.cpp:903
int nHeight
Definition: coins.h:79
bool VerifyDB(int nCheckLevel, int nCheckDepth)
Verify consistency of the block and coin databases.
Definition: main.cpp:2812
uint256 GetHash() const
Definition: core.cpp:76
uint64_t nTransactions
Definition: coins.h:248
uint256 GetBestBlock()
Definition: coins.cpp:114
void queryHashes(std::vector< uint256 > &vtxid)
Definition: txmempool.cpp:180
Value gettxoutsetinfo(const Array &params, bool fHelp)
Object blockToJSON(const CBlock &block, const CBlockIndex *blockindex)
Double ended buffer combining vector and stream-like interfaces.
Definition: serialize.h:848
Object JSONRPCError(int code, const string &message)
Value getblockchaininfo(const Array &params, bool fHelp)
pruned version of CTransaction: only retains metadata and unspent transaction outputs ...
Definition: coins.h:69
Value getblock(const Array &params, bool fHelp)
uint256 nChainWork
Definition: main.h:720
bool GetStats(CCoinsStats &stats)
Definition: coins.cpp:71
Value getdifficulty(const Array &params, bool fHelp)
CChain chainActive
The currently-connected chain of blocks.
Definition: main.cpp:43
bool GetCoins(const uint256 &txid, CCoins &coins)
Definition: coins.cpp:75
Definition: txmempool.h:21
uint256 hashSerialized
Definition: coins.h:251
CBlockIndex * Tip() const
Returns the index entry for the tip of this chain, or NULL if none.
Definition: main.h:1024
int Height() const
Return the maximal height in the chain.
Definition: main.h:1055
std::string HexBits(unsigned int nBits)
Definition: rpcserver.cpp:105
CBlockIndex * Next(const CBlockIndex *pindex) const
Find the successor of a block in this chain, or NULL if the given index is not found or is the tip...
Definition: main.h:1047
Value ValueFromAmount(int64_t amount)
Definition: rpcserver.cpp:100
int nVersion
Definition: coins.h:83
uint256 hashMerkleRoot
Definition: core.h:347
unsigned int GetSerializeSize(char a, int, int=0)
Definition: serialize.h:114
int64_t GetBlockTime() const
Definition: core.h:387
An input of a transaction.
Definition: core.h:72
#define LOCK(cs)
Definition: sync.h:157
A combination of a network address (CNetAddr) and a (TCP) port.
Definition: netbase.h:109
uint64_t nSerializedSize
Definition: coins.h:250
bool GetCoins(const uint256 &txid, CCoins &coins)
Definition: txmempool.cpp:201
std::vector< CTxIn > vin
Definition: core.h:186
unsigned int nBits
Definition: main.h:736
double GetPriority(unsigned int currentHeight) const
Definition: txmempool.cpp:31
int64_t GetTime() const
Definition: txmempool.h:41
std::map< uint256, CTxMemPoolEntry > mapTx
Definition: txmempool.h:63
unsigned int nNonce
Definition: core.h:350
Value getrawmempool(const Array &params, bool fHelp)
CCoinsViewCache * pcoinsTip
Global variable that points to the active CCoinsView (protected by cs_main)
Definition: main.cpp:436
std::string GetHex() const
Definition: uint256.h:298
double GuessVerificationProgress(CBlockIndex *pindex, bool fSigchecks)
CCriticalSection cs
Definition: txmempool.h:62
CTxMemPool mempool
Definition: main.cpp:40
bool fCoinBase
Definition: coins.h:73
256-bit unsigned integer
Definition: uint256.h:532
void pruneSpent(const uint256 &hash, CCoins &coins)
Definition: txmempool.cpp:47
const CTransaction & GetTx() const
Definition: txmempool.h:37
bool ReadBlockFromDisk(CBlock &block, const CDiskBlockPos &pos)
Definition: main.cpp:1171
uint256 GetHash() const
Definition: core.cpp:216
The block chain is a tree shaped structure starting with the genesis block at the root...
Definition: main.h:698
const CChainParams & Params()
Return the currently selected parameters.
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:413
std::string ToString() const
Definition: uint256.h:341
double GetDifficulty(const CBlockIndex *blockindex)
bool exists(uint256 hash)
Definition: txmempool.h:92
int GetDepthInMainChain(CBlockIndex *&pindexRet) const
Definition: main.cpp:1049
Value getbestblockhash(const Array &params, bool fHelp)
bool GetProxy(enum Network net, proxyType &proxyInfoOut)
Definition: netbase.cpp:476
std::string HelpExampleCli(string methodname, string args)
Definition: rpcserver.cpp:899
std::vector< CTransaction > vtx
Definition: core.h:398
std::string GetArg(const std::string &strArg, const std::string &strDefault)
Return string argument or default value.
Definition: util.cpp:506
Value getblockhash(const Array &params, bool fHelp)
The basic transaction that is broadcasted on the network and contained in blocks. ...
Definition: core.h:179
Value gettxout(const Array &params, bool fHelp)
int nHeight
Definition: main.h:708
int64_t GetFee() const
Definition: txmempool.h:39
unsigned int nBits
Definition: core.h:349
std::string HexStr(const T itbegin, const T itend, bool fSpaces=false)
Definition: util.h:256
COutPoint prevout
Definition: core.h:75
Value verifychain(const Array &params, bool fHelp)
CCoinsView that brings transactions from a memorypool into view.
Definition: txmempool.h:103
map< uint256, CBlockIndex * > mapBlockIndex
Definition: main.cpp:42
size_t GetTxSize() const
Definition: txmempool.h:40
uint256 GetBlockHash() const
Definition: main.h:815
A transaction with a merkle branch linking it to the block chain.
Definition: main.h:436
const_iterator end() const
Definition: serialize.h:935
uint256 hash
Definition: core.h:27