Elis-API

提供: tezos-wiki
移動先: 案内検索

コードサンプルと戻り値を持つBitcoin API呼び出しリスト(バージョン0.3.20.2以降)

API呼び出し[編集]

API JSON-RPCへの呼び出しはPOSTメソッドを使用して送信され、パラメータはJSONオブジェクトとして送信されます。

リクエストの例[編集]

JSON-RPCサーバーから何かをリクエストすると、次のようなポストデータを持つ http:// user:pass @ localhost:8332 / </ tt>というURLでサーバーにリクエストが送信されます。

<para>:[0]、 "id": "listreceivedbyaccount"}:</ syntaxhighlight>
 {"メソッド" "listreceivedbyaccount"

Bitcoindサーバーは通常のPOSTパラメーターを使用する代わりにJSON表記を使用しますこのパラメーターはいつか混乱を招く可能性があります上のポストデータの末尾にコロンがあることに注意してください

サーバーに送信されるJSONオブジェクトは<tt> method </ tt>、<tt> params </ tt><tt> id </ tt>の3つの要素で構成されています。

<strong> <tt> method </ tt> </ strong>は呼び出すメソッドで呼び出すメソッドを表す単純な文字列です

<strong> <tt> params </ tt> </ strong>メソッドの呼び出しとともに送信する<strong> <tt> Array </ tt> </ strong>パラメータですこれらのパラメータは<tt> Array </ tt>表記であり、<tt> Object </ tt>表記ではありません

<strong> <tt> id </ tt> </ strong>はリクエストしているアプリによって使用されていますが通常はメソッド名をIDとして送信します

== Calls List ==

Required arguments are denoted inside < and > Optional arguments are inside [ and ].




=== backupwallet ===

Safely copies wallet.dat to destination, which can be a directory or a path with filename.

==== Arguments ====

<tt>[0]</tt> <strong><Destination></strong> <tt>String</tt> The destination of the wallet file it will be copied to. This needs to be a valid <tt>directory</tt> in your file system passed in linux style (forward slashes (<tt>/</tt>) as separators - linux style, not backward slashes (<tt>\</tt>) - windows style). The directory <strong>must not have a file named <tt>wallet.dat</tt></strong> otherwise the operation will fail. Example: <tt>"d:/wallet-backup/"</tt>

==== Example Request ====

<syntaxhighlight lang="javascript">{"method":"backupwallet","params":["d:/wallet-backup/"],"id":"backupwallet"}:

結果[編集]

成功[編集]

<tt>結果</ tt> = <tt> null </ tt>

<シンタックスハイライトlang = "javascript"> {     "result":null、     "error":null、     "id": "backupwallet" } </ syntaxhighlight>

エラー[編集]

<シンタックスハイライトlang = "javascript"> {     "result":null、     "error":{         "code":-1、         "メッセージ": "boost :: filesystem :: copy_file:ファイルが存在します:\" C:\\ Users \\ Eli \\ AppData \\ローミング\\ Bitcoin \\ testnet \\ wallet.dat \ "、\" d :\\ wallet-backup \\ wallet.dat \ ""     }、     "id": "backupwallet" } </ syntaxhighlight>

提供されたディレクトリが間違っている場合など、他にもエラーが発生する可能性があります。

getaccount[編集]

指定されたアドレスに関連付けられたアカウントを返します。

引数[編集]

<tt> [0] </ tt> <Bitcoin Address> </ strong> <tt> String </ tt>チェックされているアドレス。例:<tt> "n3CoNg6qBkJauJq5558PrfEHJd8f1emkQZ </ tt>"(これは<tt> testnet </ tt>のアドレスです)、<tt> "" </ tt>

リクエスト例[編集]

"" getaccount "、" params ":[" n3CoNg6qBkJauJq5558PrfEHJd8f1emkQZ "]、" id ":" getaccount "}:</ syntaxhighlight>
結果</ tt> = <tt>文字列</ tt>

ビットコインウォレットの一部のアドレスは特定のアカウントに関連付けられていないので<tt>結果</ tt>は空の文字列(グローバルアカウント)になります。

=====成功=====
<シンタックスハイライトlang = "javascript"> {
    "result" "Testnet Faucet"
    "error"null
    "id" "getaccount"
} </ syntaxhighlight>

=====エラー=====
このメソッドがエラーを返すのは最初の引数<tt> [0] </ tt> <strong> Bitcoinアドレス</ strong>が指定されていない場合のみです <ins>他の場合はアドレスがグローバルアカウントに属していることを示す空の<tt> "result" </ tt>値を持つ成功した結果</ ins>を返します つまり空の文字列<tt> "" </ tt>)または不良アドレス(つまり<tt> "eli" </ tt>など

<シンタックスハイライトlang = "javascript"> {
    "result"null
    "error"{
        "code"-1
        "message" "getaccount <bitcoinaddress> \ n指定されたアドレスに関連付けられたアカウントを返します。
    }、
    "id": "getaccount"
} </ syntaxhighlight>

=== getaccountaddress ===

Returns the current bitcoin address for receiving payments to this account.

==== Arguments ====

<tt>[0]</tt> <strong><Account></strong> <tt>String</tt> The account that you want to get an address for. An empty string is considered as the <tt>global</tt> account and will return a valid address. Example: <tt>"Testnet Faucet"</tt>, <tt>""</tt>

==== Example Request ====

<syntaxhighlight lang="javascript">{"method":"getaccountaddress","params":["Testnet Faucet"],"id":"getaccountaddress"}:

Result[編集]

Success[編集]

<tt>result</tt> = <tt>String</tt> an address associated with this account.

{
    "result": "mpFrRfLZRWCKzG2VmmxajJLcGpchsYiFQo",
    "error": null,
    "id": "getaccountaddress"
}
Error[編集]
{
    "result": null,
    "error": {
        "code": -1,
        "message": "getaccountaddress <account>\nReturns the current bitcoin address for receiving payments to this account."
    },
    "id": "getaccountaddress"
}

This error is only returned if no arguments supplied at all (not even an empty string).



getaddressesbyaccount[編集]

Returns the list of addresses for the given account.

Arguments[編集]

<tt>[0]</tt> <Account> <tt>String</tt> The account that you want to get addresses for. An empty string is considered as the <tt>global</tt> account and will return a valid address. Example: <tt>"Testnet Faucet"</tt>, <tt>""</tt>

Example Request[編集]

{"method":"getaddressesbyaccount","params":["Testnet Faucet"],"id":"getaddressesbyaccount"}:

Result[編集]

Success[編集]

<tt>result</tt> = <tt>Array</tt> An array of addresses associated with the account.

{
    "result": [
        "mpFrRfLZRWCKzG2VmmxajJLcGpchsYiFQo",
        "mv97croRs1krPoTXsfoSnxT7YhUn4zECUs"
    ],
    "error": null,
    "id": "getaddressesbyaccount"
}
Error[編集]
{
    "result": null,
    "error": {
        "code": -1,
        "message": "getaddressesbyaccount <account>\nReturns the list of addresses for the given account."
    },
    "id": "getaddressesbyaccount"
}

This error is only returned if no arguments supplied at all (not even an empty string).



getbalance[編集]

If [Account] is not specified, returns the server's total available balance. If [Account] is specified, returns the balance in the account.

Arguments[編集]

<tt>[0]</tt> [Account] <tt>String</tt> The account that you want to balance. An empty string is considered as the <tt>global</tt> account and will return a the balance of the <tt>global</tt> account. A <tt>null</tt> value will return the entire balance available for the server. Example: <tt>"Testnet Faucet"</tt>, <tt>""</tt>, <tt>null</tt>

<tt>[1]</tt> [Minimum Confirmations] <tt>Integer</tt> The minimum confirmations you want to consider when requesting balance. Default value is <tt>1</tt>. If <tt>0</tt> is supplied even unconfirmed transactions will be considered and will show in the balance. Example: <tt>1</tt>, <tt>0</tt>, <tt>null</tt>

Example Request[編集]

{"method":"getbalance","params":[],"id":"getbalance"}:

Result[編集]

Success[編集]

<tt>result</tt> = <tt>Float</tt> A float representing the balance that the <tt>account</tt> or the <tt>server</tt> has to it's disposal.

{
    "result": 256.4985,
    "error": null,
    "id": "getbalance"
}
Error[編集]

No error should be returned with this method.



getblockbycount[編集]

Dumps the block existing at specified height. Note: this is not available in the official release

Arguments[編集]

<tt>[0]</tt> Height