0

I code a C# application, build of the BlockCypher API and NBitcoin.

I try to send 5000 Satoshi (f.e.) from my wallet to another. My wallet has an amount of 12709 satoshi as balance.

The Request is: {"inputs":[{"addresses":["1D8qMn5i************zBYX9nV"]}],"outputs":[{"addresses":["1NbfuFvb*********PXyoVRSVG"],"value":5000}]}

The API answers me with the error: "Not enough funds after fees in 1 inputs to pay for 1 outputs, missing -18191."

The tx is:

"tx": {
    "block_height": -1,
    "block_index": -1,
    "hash": "932aa8da****************************************5ed3b2aa6",
    "addresses": [
      "1D8qMn5iW********92npbnzBYX9nV",
      "1NbfuFvb7********SB4rPXyoVRSVG"
    ],
    "total": 5000,
    "fees": 7709,
    "size": 85,
    "vsize": 85,
    "preference": "medium",
    "relayed_by": "2a02:810a:10bf:b99c:618b:7cfb:b849:da91",
    "received": "2021-02-14T13:00:23.205969129Z",
    "ver": 1,
    "double_spend": false,
    "vin_sz": 1,
    "vout_sz": 1,
    "confirmations": 0,
    "inputs": [
      {
        "prev_hash": "ce*****************************************a7",
        "output_index": 1,
        "output_value": 12709,
        "sequence": 4294967295,
        "addresses": [
          "1D8qMn5iW************npbnzBYX9nV"
        ],
        "script_type": "pay-to-pubkey-hash",
        "age": 670255
      }
    ],
    "outputs": [
      {
        "value": 5000,
        "script": "****a9**************************************a88ac",
        "addresses": [
          "1NbfuF**********PXyoVRSVG"
        ],
        "script_type": "pay-to-pubkey-hash"
      }
    ]
  },
  "tosign": [
    "e866b12890***********************1f33c1f591429fc"
  ]
}

My cSharp code is:

var sendingAmt = 5000;
var api = new Blockcypher(MySettings.Default.BlockcypherToken, Endpoint.BtcMain);
var fromaddress = privateKey.PubKey.GetAddress(Network.Main).ToString();
var privateKeyBytes = privateKey.GetBitcoinSecret(Network.Main).ToBytes();
var hexPrivate = Encoders.Hex.EncodeData(privateKeyBytes);
var toAddress = "1NbfuFv*************PXyoVRSVG";

var taskRes = await api.Send(fromaddress, toAddress, hexPrivate, sendingAmt);

Can someone tell me, what the problem is and how I can solve it?

This site is temporarily in read only mode and not accepting new answers.

Browse other questions tagged .