我正在尝试使用 sendmoney API 使用下面的代码发送一些比特币。但我收到下面列出的错误 -
错误:
{"errors":[{"id":"authentication_error","message":"无效签名"}]}
我正在使用的代码:
string message = time_epoch.data.epoch.ToString() + "POST" + "/v2/accounts/xxxx/transactions"+
"{type:send,to:xxxx,amount:0.0002,currency:BTC}";
string signature = HashEncode(HashHMAC(StringEncode("xxxxxx"), StringEncode(message)));
var _client = new RestClient("https://api.coinbase.com/v2/");
var request = new RestRequest("accounts/xxxxxx/transactions", Method.POST);
request.AddHeader("CB-VERSION", "2016-10-03");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Charset", "utf-8");
request.AddHeader("CB-ACCESS-KEY", "xxxxx");
request.AddHeader("CB-ACCESS-SIGN", signature);
request.AddHeader("CB-ACCESS-TIMESTAMP", time_epoch.data.epoch.ToString());
request.AddParameter("type", "send");
request.AddParameter("to", "xxxx");
request.AddParameter("amount", "0.0002");
request.AddParameter("currency", "BTC");
request.AddParameter("idem", "9316dd16-6c09");
request.OnBeforeDeserialization = resp => { resp.ContentType = "application/json;charset=utf-8"; };
var response = _client.Execute(request);
return _client.Execute(request).Content;