Документация
Поиск

Emercoin API

The debug console in the emercoin-qt GUI

Как и в случае с Биткойн, интерфейс прикладного программирования (API) доступен через :

  • консоль отладки в GUI Emercoin Core .
  • JSONRPC , согласно настройкам в вашем emercoin.conf.
  • Непосредственно в интерфейсе командной строки (emercoin-cli).

Команды API

API позволяет вам или приложениям запрашивать цепочку блоков и отправлять транзакции и т. д. Например, чтобы проверить свой баланс EMC и состояние цепочки блоков:

 $ emc getinfo  

Или получить список всех возможных команд:

 $ emc help  

Дополнительная помощь может быть запрошена для любой из вышеуказанных команд API. например:

$ emc help name_new
name_new <name> <value> <days> [toaddress] [valuetype]
Creates new key->value pair which expires after specified number of days.
Cost is square root of (1% of last PoW + 1% per year of last PoW).
Arguments:
1. name      (string, required) Name to create.
2. value     (string, required) Value to write.
3. toaddress (string, optional) Address of recipient. Empty string = transaction to yourself.
4. valuetype (string, optional) Interpretation of value string. Can be "hex", "base64" or filepath.
   not specified or empty - Write value as a unicode string.
   "hex" or "base64" - Decode value string as a binary data in hex or base64 string format.
   otherwise - Decode value string as a filepath from which to read the data.
$ emc help sendtoaddress
sendtoaddress "emercoinaddress" amount ( "comment" "comment-to" )

Send an amount to a given address. The amount is a real and is rounded to the nearest 0.00000001

Requires wallet passphrase to be set with walletpassphrase call.
Arguments:
1. "emercoinaddress"  (string, required) The emercoin address to send to.
2. "amount"      (numeric, required) The amount in emc to send. eg 0.1
3. "comment"     (string, optional) A comment used to store what the transaction is for. 
                             This is not part of the transaction, just kept in your wallet.
4. "comment-to"  (string, optional) A comment to store the name of the person or organization 
                             to which you're sending the transaction. This is not part of the 
                             transaction, just kept in your wallet.

Result:
"transactionid"  (string) The transaction id.

Examples:
> emercoin-cli sendtoaddress "EMERCoins1aiafJLpHbHvxrogbdnX3U2Jw" 0.1
> emercoin-cli sendtoaddress "EMERCoins1aiafJLpHbHvxrogbdnX3U2Jw" 0.1 "donation" "seans outpost"
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendtoaddress"