# Create transaction error using C# authentication examples from fireblock's github

**URL:** <https://community.fireblocks.com/t/create-transaction-error-using-c-authentication-examples-from-fireblocks-github/1092>\
**Category:** Support\
**Created:** [June 5, 2024, 2:50pm UTC](https://community.fireblocks.com/t/create-transaction-error-using-c-authentication-examples-from-fireblocks-github/1092 "2024-06-05T14:50:33Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Danny4](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@Danny4](https://community.fireblocks.com/u/Danny4)\
**Post date:** [June 5, 2024, 2:50pm UTC](https://community.fireblocks.com/t/create-transaction-error-using-c-authentication-examples-from-fireblocks-github/1092/1 "2024-06-05T14:50:33Z")

</div>

I have been using the C# authentication examples on github:

> <https://github.com/fireblocks/developers-hub/blob/main/authentication_examples/cs/Program.cs>

This has worked fine, I can create an account, and used the code to create a wallet. When I use the C# authentication example code to create a transaction I get:

{StatusCode: 400, ReasonPhrase: ‘Bad Request’, Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:  
{  
Date: Wed, 05 Jun 2024 14:34:02 GMT  
Connection: keep-alive  
X-Powered-By: Express  
X-Request-ID: 999a84ba161a0ec49b942364d8a3701a  
ETag: W/“83-hxj/FEidCiaj062wnON16m9/2pQ”  
Strict-Transport-Security: max-age=15724800; includeSubDomains  
CF-Cache-Status: DYNAMIC  
Server: cloudflare  
CF-RAY: 88f0e18e5a857ce8-EWR  
Content-Type: application/json; charset=utf-8  
Content-Length: 131  
}}

The code:

static async Task CreateTransaction(string apiKey, string privateKey, string baseUrl)  
{  
string path = “/v1/transactions”;  
ApiTokenProvider provider = new ApiTokenProvider(privateKey, apiKey);

```
FBTansaction fbTransaction = new FBTansaction();
fbTransaction.operation = "TRANSFER";
fbTransaction.assetId = "ETH_TEST5";
fbTransaction.amount = "0.001";

Source source = new Source();
source.id = "6";
source.type = "VAULT_ACCOUNT";
fbTransaction.source = source;

Destination destination = new Destination();
destination.id = "11";
destination.type = "VAULT_ACCOUNT";
fbTransaction.destination = destination;
  
string token = provider.SignJwt(path, JsonConvert.SerializeObject(fbTransaction));

using (HttpClient client = new HttpClient())
{
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
    client.DefaultRequestHeaders.Add("X-API-Key", apiKey);

    string jsonBody = JsonConvert.SerializeObject(fbTransaction);
    HttpContent content = new StringContent(jsonBody, Encoding.UTF8, "application/json");

    HttpResponseMessage response = await client.PostAsync(baseUrl + path, content);

    if (response.IsSuccessStatusCode)
    {
        var json = response.Content.ReadAsStringAsync();
        string jsonString = json.Result.ToString();

        return await response.Content.ReadAsStringAsync();
    }   
    else
    {
        return "POST Request failed with status: " + response.StatusCode;
    }
}

```

}

The json body that is sent from the above code:  
“{  
"operation":"TRANSFER",  
"note":null,  
"assetId":"ETH\_TEST5",  
"source":{  
"type":"VAULT\_ACCOUNT",  
"id":"6",  
"name":"TestFromAPI"},  
"destination":{  
"type":"VAULT\_ACCOUNT",  
"id":"11",  
"name":"VaultTest1"},  
"amount":"0.001"  
}”

This works using postman and the above json body converts to C# classes fine using [json2sharp.com](http://json2sharp.com). So cannot see what the problem is, when creating accounts and wallets using the example C# code works fine, but creating a transaction?  
Any help would be great.

Regards  
Danny

---

<div class="post-metadata">

**Author:** ![Mohammed](https://sea1.discourse-cdn.com/flex015/user_avatar/community.fireblocks.com/mohammed/32/511_2.png) [@Mohammed](https://community.fireblocks.com/u/Mohammed)\
**Post date:** [June 5, 2024, 3:29pm UTC](https://community.fireblocks.com/t/create-transaction-error-using-c-authentication-examples-from-fireblocks-github/1092/2 "2024-06-05T15:29:08Z")

</div>

Hi, @Danny4

Can you try removing “name” from source and destination objects. Only include type: “VAULT\_ACCOUNT” and “id”

I found an error on our backend logs that show “message should be string”

And this is the body we see with name as null, please omit the note and name and lets test if it is successful, or validate that those are type string and include them in the body.

{“operation”:“TRANSFER”,“note”:null,“assetId”:“ETH\_TEST5”,“source”:{“type”:“VAULT\_ACCOUNT”,“id”:“6”,“name”:null},“destination”:{“type”:“VAULT\_ACCOUNT”,“id”:“11”,“name”:null},“amount”:“0.001”}

---

<div class="post-metadata">

**Author:** ![Danny4](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@Danny4](https://community.fireblocks.com/u/Danny4)\
**Post date:** [June 5, 2024, 3:45pm UTC](https://community.fireblocks.com/t/create-transaction-error-using-c-authentication-examples-from-fireblocks-github/1092/3 "2024-06-05T15:45:43Z")

</div>

Hi Mohammed

That’s worked, thanks
