when you are doing
BitcoinAddress address1 = **pubKey**.Derive([some client data]).PubKey.GetAddress(Network.Main);
You are getting the bitcoin address, but not the master public key. (ExtPubKey)
A HD pub key have more information than just the pubkey.
The correct code is
string wifStr = **pubkey**.Derive([some client data]).ToString(Network.Main)
Bitcoin signatures have two components: s and R. To sign a Bitcoin transaction with private key k, the signing algorithm generates an ephemeral private key r. The R component of the signature is the x-coordinate of that ephemeral public key. The s component of the signature is calculated in the following way: s = r-1 (Hash(m) + k * R) mod p; where Hash(m) is ...
signing with Segwit is in no way different from signing with P2SH or P2PKH.
If you want interoperability, you need to use Segwit wrapped into P2SH. Please check https://programmingblockchain.gitbooks.io/programmingblockchain/content/other_types_of_ownership/ for more info.
But in a nutshell, if you want to have a P2WPKH-PS2SH (Segwit P2PKH wrapped into ...
How about running a QBitNinja server locally?
var client = new QBitNinjaClient(baseAddress:"specify host here, you probably want localhost", Network.TestNet);
var balanceModel = client.GetBalance(dest: [Add any IDestination here, like new BitcoinAddress("mivD5GHroixrzgjv6Ww73pV5R55PcL8JdM", Network.TestNet)], unspentOnly: true).Result;
Verify() verifies if the transaction is properly signed.
Since Verify() doesn't really tell us if a transaction will successfully propagate
It is either untrue or you found a bug.
node.SendMessage(new TxPayload(tx)); should be perfect. However Stratis is currently building a Bitcoin .NET fullnode, with the lead of Nicolas Dorier, NBitcoin's creator,...
Am I using hardened private derivation function?
No. You're using nonhardened derivation. That's the only kind of derivation that you can use when you only have the public key.
Hardened derivation looks like this:
BitcoinAddress address = privateKey.Derive(orderID, true).Key.PubKey.GetAddress(Network.Main);
It requires the private key. It also doesn't ...
////////////////1st offline SERVER//////////////////
//Create Master Private Key with a seed
ExtKey privateKey = new ExtKey("16236c2028fd2018eb7049825e6b4f0191de4dbff003579918de7b7348ff06ac");
//create master public key from this privateKey
ExtPubKey pubKey = privateKey.Neuter();
//save it's wifStr as key to the next server to use and generate all child keys ...
You aren't doing anything wrong. You just need to be able to handle those duplicate transaction ids. It actually happens a few times before BIP 30 went into effect making such duplicate txids invalid.
These duplicates happen because the coinbase transaction in two different blocks can be exactly the same, so they have exactly the same txid. This is because ...
Not sure how NBitcoin works, but it looks like so far you have derived your private and public key, you now need to hash it in the Ethereum method rather than the bitcoin way.
Look at step 3 in this answer: https://ethereum.stackexchange.com/questions/3542/how-are-ethereum-addresses-generated
Nethereum has implemented it in C#: https://github.com/...
Transaction do not need to be signed. They are if the locking script requires so, which is the most usual thing, but scripts redeemable without a signature can also be valid.
That being said, a transaction redeeming from a script that does not requires a signature could be highly insecure, since a peer (or a miner) that receives so can easily change the ...
You can use my blockchain parser (python script) that converts the local copy of blockchain (blkXXXXX.dat files) to human readable text view -> my parser
Bases on this parser you can do anything you want with that data.
let address = BitcoinAddress.Create("1HLoD9E4SDFFPDiYfNYnkBLQ85Y51J3Zb1",
let sha = NBitcoin.Crypto.Hashes.SHA256(address.ScriptPubKey.ToBytes())
let reversedSha = sha.Reverse().ToArray() // add `open System.Linq` at the top
I have found your transaction here: 12e548ababf06160486f91bfa2a406f131631258b2db025eb36bcd5230a70524
It was successfully created, signed and submitted. I can also see a message that you added in.
There are a few things I picked up that are different when I look into the transaction vs how you built it up.
The address that is derived from that private key ...
The mnemonic standard is BIP 39, and that is not the problem. The problem is the derivation paths.
Exodus, Jaxx, Coinomi, and many other wallets use the BIP 44 specification for deriving keys. This means the m for those wallets is actually the key at the path m/44'/0'/0'. However in your code with NBitcoin, you are using direct BIP 32 paths, so your m is ...
I got stuck on this as well and combined with Nicolas answer the code samples below are what helped sort out my understanding.
I used the simplest segwit example from bip-0143 as the basis. The c# code sample below correctly spends the two inputs from the sample transaction linked above. Note that only the second input (hash ef51e...) uses a segwit ...
NBitcoin just follow BIP125
public bool RBF
return Inputs.Any(i => i.Sequence < 0xffffffff - 1);
If you are using the TransactionBuilder for creating a transaction, you have two ways:
One is to use TransactionBuilder.SetLockTime(blockHeight) where block height is the currentHeight-1 (actually, if you put 0 it will be ...
I'm not sure about Nbitcoin node's API, but I could help you on a blockchain explorer API.
I would recommend Blockr.io, they are fast and trustable. Use the following code to check for confirmed transactions: (output is in json)
You can find an example here.
Specifically, see the first example where Alice sends bitcoins to Satoshi:
Transaction aliceFunding = new Transaction()
new TxOut("0.45", alice.GetAddress()),
new TxOut("0.8", alice.Key.PubKey)
Coin aliceCoins = aliceFunding
I think the problem is that there is only OP_RETURN, I remember seeing in the Bitcoin code that only OP_RETURN without anything else is forbidden.
Except that, your code looks like what is in my book
https://blockchainprogramming.azurewebsites.net/ so I'm almost sure it is the problem.
EDIT : You are crashing during Handshake, can you check Node....