How to check if node is on TestNet or MainNet via `bitcoin-cli`?
Is there a way, by using bitcoin-cli
using RPC querying, if the node I’m querying is running on MainNet or TestNet?
Thanks
Is there a way, by using bitcoin-cli
using RPC querying, if the node I’m querying is running on MainNet or TestNet?
Thanks
I would to get the fee when I search for a transaction using getrawtransaction
, but the JSON-RPC does not return this.
https://chainquery.com/bitcoin-api/getrawtransaction
So to achieve this, my idea is to:
vin
, and save the output value for each one.vin
s, and subtract the sum of the vout
values to give you the remainder.I know this will work, but I dislike having to call getrawtransaction
for each vin
(as this JSON-RPC call will be made 200+ times for some transactions).
Is there a more efficient way? Or is this currently the only way to calculate the fee for a transaction using bitcoin-cli?
Aside: Why doesn’t
getrawtransaction
return a fee field, like the transactions ingetrawmempool
andgetblocktemplate
do?
I want to call chainActive.Tip()->nHeight in core.cpp. It is not possible, I am interested in every idea.
https://github.com/LIMXTEC/BitSend/blob/DEV-joshafest/src/core.cpp
Here is an example :
bool GetH()
{
int nBlockHeight = chainActive.Tip()->nHeight;
if(nBlockHeight < FORKX17_Main_Net )
return true;
else
return false;
}
}
uint256 CBlockHeader::GetHash() const
{
if (GetH())
{
return HashX11(BEGIN(nVersion), END(nNonce));
}
else
{
return HashX17(BEGIN(nVersion), END(nNonce));
}
}
Also that is not possible:
CBlockIndex* pindexPrev = chainActive.Tip();
if (pindexPrev->nHeight <= FORKX17_Main_Net)
Is there a documentation somewhere to understand the C++ code of Bitcoin Core (available on Github) “from a to z” and being able to recreate it ?
How can I reset the IP address of a Dragon Miner 1TH/s machine?
Mistakenly, I entered the wrong IP in the miner when changing the network IP address, and now my miner is not visible on the network. What I entered was like “IP 192.168.1.100.4”.
So how can I reset my miner? It has the SD card option.
I wanted to convert the following bitcoin mining python code to VB.net (2012) and I tried to convert it’s functionality, but it throws some errors and I’m stuck as I even can’t get the resulting value of "header"
variable.
and the final hash result should be 0000000000000000e067a478024addfecdc93628978aa52d91fabd4292982a50
, but I’m no where near that.
why this produces errors, converting from hex to byte is not the correct method?
in python L
is used to format it to long
right?, so what does the <L
& <LLL
in the python code do? and is this ::-1
used to prevent overflow when reading the hex string?
and, in exp = bits >> 24
what does it do, bitwise operations?
import hashlib, struct
ver = 2
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
time_ = 0x53058b35 # 2014-02-20 04:57:25
bits = 0x19015f53
# https://en.bitcoin.it/wiki/Difficulty
exp = bits >> 24
mant = bits & 0xffffff
target_hexstr = '%064x' % (mant * (1<<(8*(exp - 3))))
target_str = target_hexstr.decode('hex')
nonce = 0
while nonce < 0x100000000:
header = ( struct.pack("<L", ver) + prev_block.decode('hex')[::-1] +
mrkl_root.decode('hex')[::-1] + struct.pack("<LLL", time_, bits, nonce))
hash = hashlib.sha256(hashlib.sha256(header).digest()).digest()
print nonce, hash[::-1].encode('hex')
if hash[::-1] < target_str:
print 'success'
break
nonce += 1
The VB.NET code I’ve been coding up until now is,
Public Class Form1
Dim version As Long = 0
Dim time As Integer
Dim pblock As Byte
Dim mklroot As Byte
Dim header As String
Dim nonce As Integer = 856192328
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Textbox1.Text = "2"
Textbox2.Text = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
Textbox3.Text = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
Textbox4.Text = "0x53058b35" '2014-02-20 04:57:25
Textbox5.Text = "0x19015f53"
Dim n As Int32 = T2.Text.Length - 1
version = CLng(Textbox1.Text)
'pblock = CByte(Textbox2.Text)
pblock = Convert.ToByte(Convert.ToInt32(Textbox2.Text, 16))
mklroot = Convert.ToByte(Convert.ToInt32(Textbox3.Text, 16))
time = CInt(Textbox4.Text)
header = version & pblock & mklroot & time & nonce
Textbox6.Text = header
End Sub
End Class
To me, banking is not a public thing. I don’t want people to know what’s in my bank account at what time, or who I sent money to.
I know that I can make a new address for each transaction, as addresses are ‘free’. But this isn’t the case for say, a coffee shop, which would want only a single address for people to send money to (usually in the form of a QR code printout hanging on the wall). I can effectively track the incoming and outgoing cash flow of a coffee shop by just tracing the blockchain, can’t I? If I were a rival shop, this would be very useful to me.
I’ve been using a pretty old version of Multibit classic and recently decided to upgrade. I tried out Multibit HD and Electrum and noticed that both have me set up a wallet with a "word seed". It’s just a string of random words that is apparently used in an algorithm. The question is, what does it do exactly? Someone told me that it generates private keys for you, and all you need is that word seed and you will be able to restore/generate all your private keys. How does this work exactly? What algorithm is being use on the seed to generate the keys?
These words are apparently very important, as Multibit warns on their site:
To restore your wallet and recover your bitcoin, you must have your wallet words.
With your wallet words, you can recover your bitcoin. You must keep your wallet words safe, because anyone who knows your wallet words can steal your bitcoin.
The seed words seem to be a replacement for the private keys, based on what Multibit says about them. I’m personally quite attached to the idea of having my private keys, so why should I be content with this word seed instead? Some apparently think it’s safe enough: Is 12-word seed phrase safe enough?, but is it usable enough?
These questions: Does a wallet containing multiple addresses have a single private key? and Why can the same 12 words produce different seeds in an Electrum wallet file? hint on what is happening here, but is lacking details. It seems the phrase is "hierarchical deterministic" wallets, hence the "HD" in "Multibit HD".
This question exactly articulates my concerns: Is it important to have an unencrypted backup of the private key?
Frequently after one pull request is merged, multiple other pull requests follow to clean up a problem created by the first PR
Recent example:
https://github.com/bitcoin/bitcoin/pull/7957
https://github.com/bitcoin/bitcoin/pull/8164
https://github.com/bitcoin/bitcoin/pull/8171
Normally no real harm is done. Is this no big deal or a sign that more testing should be done before Bitcoin pull requests are merged?
I lost my wallet identifier and mnemonic. What I only have is my Bitcoin receiving address, 1EAd1Qua6fzyenPeSMRxYcpbcKgYUBpxQ7
. I also lost the “Welcome to my wallet…” message in my e-mail. What do I do now? Please help, my bicoins are inside!