最简单EDC收款的方式。为了收到其他用户给你钱包转款,只需要使用一种方式。先填写注册表格!

查阅文档

为了使用API方法,用户需要 token(令牌)

用户注册及token(令牌)生成将手动进行。

为了获得收款新地址,需要发出邀请

POST https://receive.edinarcoin.com/new-account/:token

带参数

  • account – 帐号,用于编入已生成账户中所有的支付情况。
  • hook – url, 如果出现新的支付,将会向其发送POST咨询。在咨询文件中将副有内部支付标识码,转账目标帐号的地址以及数额。

Hook URL(非即插即用驱动)并非是必要的。

例如:

                                {
                                "account": "test123",
                                "hook": "https://example.com/new/payment/hook"
                                }
                                

您会收到新地址

                                {
                                "address": "edcfwqmbx1fod6s97t93469yp7cj6qa9re"
                                }
                                

之后所有的到该地址的款会转移到在“account field.账号”指明的用户账号

服务器会尝试着到hook地址发送邀请。如果无法访问,服务器将尝试着再发4回隔断时间为5秒。

GEThttps://receive.edinarcoin.com/history/:token

答复将是受到该地址款的数组,生成在指定的token(令牌)下。

转回最后100个款

                                [
                                {
                                "id": "57d7fda3cf22a504647af6a4",
                                "date": "2016-09-13T13:22:43.000Z",
                                "amount": 0.002,
                                "isNotified": true
                                },
                                {
                                "id": "57d7f3bb8cacb802935f86d9",
                                "date": "2016-09-13T12:40:27.000Z",
                                "amount": 0.002,
                                "isNotified": true
                                }
                                ]
                                

isNotified – 将在true,如果hook答复收到,编码200

GEThttps://receive.edinarcoin.com/history/:token/:address

答复将是受到指定地址款的数组 address

转回最后100个款

                                [
                                {
                                "id": "57d7fda3cf22a504647af6a4",
                                "date": "2016-09-13T13:22:43.000Z",
                                "amount": 0.002,
                                "isNotified": true
                                },
                                {
                                "id": "57d7f3bb8cacb802935f86d9",
                                "date": "2016-09-13T12:40:27.000Z",
                                "amount": 0.002,
                                "isNotified": true
                                }
                                ]
                                

Get started

Incorrect e-mail


Message sent successfully!

在这边你们可以找到在自己服务器实施收及汇款的操作步骤说明。在这情况下无需注册。

本页内容可助你完成如下任务:

  • 安装并运行CLI钱包 CLI钱包可用来与区块链进行互动操作。向区块链添加新信息的任何操作都需要来自个人密钥的签名确认。此类须签名确认的交易可通过CLI钱包进行。
  • 最常用的CLI钱包命令 及API读取的使用示例
  • 区块链Websocket API – 如何连接并操作

查阅文档

本页内容可助你完成如下任务:

  • 安装并运行CLI钱包 CLI钱包可用来与区块链进行互动操作。向区块链添加新信息的任何操作都需要来自个人密钥的签名确认。此类须签名确认的交易可通过CLI钱包进行。
  • 最常用的CLI钱包命令 及API读取的使用示例
  • 区块链Websocket API – 如何连接并操作

CLI钱包有两种安装方式:

1

2

  • Get a container with a pre-installed CLI Wallet :
    需取得一个已经预装了CLI钱包的容器:docker pull elatome/edc_cli_wallet
  • CLI Wallet located in the folder
    CLI钱包的存储位置在这个文件夹:/EDINARCOIN

Running CLI Wallet installed :
运行已安装完毕的CLI 钱包

  • After successful installation of the CLI Wallet
    CLI钱包安装成功之后 ./programs/cli_wallet/cli_wallet –server-rpc-endpoint=wss://blockchain.edinarcoin.com –chain-id=979b29912e5546dbf47604692aafc94519f486c56221a5705f0c7f5f294df126 –rpc-endpoint=host:port
  • Previous step will open the cli-wallet and unless you already have a local wallet, it will ask you to provide a passphrase for your local wallet. It will prompt with new >>>. To set password, typeset_password my_password
    上一步的操作可打开CLI钱包,并要求用户给出本地钱包的密码,除非本地钱包已存在。这步的操作将会唤起一个命令:new >>>。如果需要设置密码,需键入设定_密码 我的_密码 set_password my_password
  • Once a wallet has been created (default wallet file is wallet.json), it will prompt with locked >>>. To unlock :
    旦创建钱包(缺省钱包文件是wallet.json),它将唤起锁定命令 locked >>>如需解锁,按如下步骤操作

    • locked >>> unlock my_password 锁定 >>> 解锁 我的_密码
    • null
    • unlocked >>>已解锁 >>>
  • After this point, you can issue any command available to the cli-wallet or construct your own transaction manually.
    此时,用户可以向CLI钱包发出任何的有效命令,或者手动创建自己的交易。

  • Call example :

    curl -X POST -d ‘{“method”: “suggest_brain_key”, “jsonrpc”: “2.0”, “params”: [], “id”: 1}’ http://localhost:8089

  • suggest_brain_key() – Suggests a safe brain key to use for creating your account. create_account_with_brain_key() requires you to specify a ‘brain key’, a long passphrase that provides enough entropy to generate cyrptographic keys. This function will suggest a suitably random string that should be easy to write down (and, with effort, memorize).
    suggest_brain_key() 建议一个安全的头脑密钥,可用于创建你的账号create_account_with_brain_key() create_account_with_brain_key() create_account_with_brain_key()需要你设定一个“头脑密钥”,即一个长的口令短语,其中包含着生成加密密钥的足量字段。此项功能将向用户建议一条符合要求的随机字符串,用户可以方便地记录下来(如果稍加努力,亦可以背诵下来)。

  • register_account(string name, public_key_type owner, public_key_type active, string registrar_account, string referrer_account, uint32_t referrer_percent, bool broadcast)
    – Registers a third party’s account on the blockckain. This function is used to register an account for which you do not own the private keys. When acting as a registrar, an end user will generate their own private keys and send you the public keys. The registrar will use this function to register the account on behalf of the end user.
    register_account(string name, public_key_type owner, public_key_type active, string registrar_account, string referrer_account, uint32_t referrer_percent, bool broadcast) 可在区块链上寄存第三方账号。此项功能可用来登记你没有个人密钥的账号。在以注册人身份进行操作时,终端用户可以生成自己的个人密钥并将公共密钥发给你。注册人可以通过这项功能来代表终端用户进行账号登记。

    Params 参数:
    • name – the name of the account, must be unique on the blockchain. Name should start with the letter, contain at least one dash, or a digit, It must also be in lowercase.
      name – 账户名,在区块链上必须具有唯一性。账户名的开头应以字母构成,其中包含至少一个连接号或数字。账户名必须是小写方式。
    • owner – the owner key for the new account.
      owner用户 – 新账户的用户密钥
    • active – the active key for the new account
      active动态 – 新账户的动态密钥
    • registrar_account – the account which will pay the fee to register the user
      registrar_account注册_账号将为用户注册而付费的账号
    • referrer_account – the account who is acting as a referrer, and may receive a portion of the user’s transaction fees. This can be the same as the registrar_account if there is no referrer.
      referrer_account推荐人_账号 – 推荐人的账号,可能会收到用户交易费用的一部分。如果推荐人不存在,此项可能与注册账号一致。
    • referrer_percent – the percentage (0 – 100) of the new user’s transaction fees not claimed by the blockchain that will be distributed to the referrer; the rest will be sent to the registrar. Will be multiplied by GRAPHENE_1_PERCENT when constructing the transaction.
      referrer_percent 推荐人_百分比 – 新用户的交易费用的百分比(数值为0至100),这一百分比是区块链不予收取的,可以发送给推荐人;其余部分将会发送给注册人。在创建交易时,此百分比会通过GRAPHENE_1_PERCENT而成倍增加。
    • broadcast – true to broadcast the transaction on the network
      broadcast广播 -与网上交易情况同步的广播
  • import_key(string account_name_or_id, string wif_key) – Imports the private key for an existing account. The private key must match either an owner key or an active key for the named account.
    import_key输入_密钥(string account_name_or_id, string wif_key) -输入一个现有账户的个人密钥。此密钥必须与账号用户的个人密钥相符,或与指定账户的动态密钥相符。

    Return 返回:
    • true if the key was imported
      输入密钥后出现
    Params 参数:
    • account_name_or_id – the account owning the key
      account_name_or_id账户_名称_或_id -持有密钥的账号
    • wif_key – he private key in WIF format
      wif_key -采用WIF格式的个人密钥
  • import_balance(string account_name_or_id, const vector &wif_keys, bool broadcast)) – This call will construct transaction(s) that will claim all balances controled by wif_keys and deposit them into the given account.
    import_balance 输入_余额(string account_name_or_id, const vector &wif_keys, bool broadcast) – 这项读取将发起一个对wif_keys保护下的余额的请求,并将此余额存入给定的账号。
  • transfer(string from, string to, string amount, string asset_symbol, string memo, bool broadcast) – Transfer an amount from one account to another. Before transfer, you have to import key and balance of the account which sending the funds
    transfer转账 (string from, string to, string amount, string asset_symbol, string memo, bool broadcast) –可将任何金额进行账号之间的转账。转账之前,必须输入密钥和转出账号的余额。

    Return 返回:
    • the signed transaction transferring funds
      经签名确认的资金转账。
    Params 参数:
    • from — the name or id of the account sending the funds
      from来自 – 转出资金的账号名或ID。
    • to — the name or id of the account receiving the funds
      to转至 – 接收资金的账号名或ID。
    • amount — the amount to send
      amount金额 –转账的金额
    • asset_symbol — EDC
      asset_symbol资产_符号 – EDC
    • memo — a memo to attach to the transaction. The memo will be encrypted in the transaction and readable for the receiver. There is no length limit other than the limit imposed by maximum transaction size, but transaction increase with transaction size
      memo备注 – 为交易所附的备注。此备注在交易中有密码保护,并可由资金接收方阅读。备注的长度不受限于对最大交易金额的限制,而是受限于交易金额的增加。
    • broadcast — true to broadcast the transaction on the network
      broadcast广播 -与网上交易情况同步的广播
  • get_account_history(string name, int limit)— Returns the most recent operations on the named account. This returns a list of operation history objects, which describe activity on the account.
    get_account_history获取_账户_历史(string name, int limit) – 返回指定账户最近的操作历史。返回内容为可描述指定账户活动情况的操作历史列表。

    Return 返回:
    • a list of operation_history_objects
      操作_历史_对象的列表
    Note 注:
    • this API doesn’t give a way to retrieve more than the most recent 100 transactions, you can interface directly with the blockchain to get more history
      此应用程序界面无法检索到超过100项的最近交易活动,如需获取更多历史交易列表,可连接区块链进行检索。
    Params 参数:
    • name — the name or id of the account
      name名称 – 账户名或id
    • limit — the number of entries to return (starting from the most recent) (max 100)
      limit上限 – 可返回的记录条数(从最近按倒序排列)(最大数量为100条)
  • get_account_id(string account_name_or_id) — Lookup the id of a named account.
    get_account_id获取_账户_id(string account_name_or_id) – 查找所指定的账户id.

    Return 返回:
    • the id of the named account
      指定账户的id
    Params 参数:
    • account_name_or_id — the name of the account to look up
      account_name_or_id账户_名称_或_id –需查找的账户名称

Connection url 连接网址 : : wss://blockchain.edinarcoin.com

Requesting API access:
请求API连接:

  1. Login to the Full Node
    全节点登录
  2. Request access to an API
    请求连接某一API
  3. Obtain the API identifier
    获取API的身份识别符
  4. Call methods of a specific API by providing the identifier:
    通过给出身份识别符而对某一特定API的读取方式:

Find below a list of available APIs:
以下为可用的API列表:

Database notifications list (数据库通知列表)

Example session 示例会话:

  • > {«method»: «call», «params»: [1, «login», [«», «»]], «id»: 2}
  • < {“id”:2,”result”:true}
  • > {«method»: «call», «params»: [1, «database», []], «id»: 3}
  • < {“id”:3,”result”:2}
  • > {«method»: «call», «params»: [1, «history», []], «id»: 4}
  • < {“id”:4,”result”:3}
  • > {«method»: «call», «params»: [2, «set_subscribe_callback», [5, false]], «id»: 6}
  • < {“id”:6,”result”:null}
  • > {«method»: «call», «params»: [2, «get_objects», [[«2.1.0»]]], «id»: 7}

Show example (php)

                                <?php

const EXCHANGE_ACCOUNT = "mainaccountname"; //Аккаунт на который будут переводится средства, поступившие на адреса биржи
const BLIND_ACCOUNT_LABEL = "testlabela"; //Label скрытого аккаунта. Для простоты поиска в дальнейшем
const INTERNAL_ACCOUNTS_PREFIX = 'edc'; //Префикс создаваемым адресам. просто чтобы можно было визуально определить, относится ли адрес к бирже

const ERROR_CODE_NOT_CONNECTED = 500;
const ERROR_CODE_INTERNAL_CLI_ERROR = 400;

class EDCAccount
{

    public static function generateNew($referrer = null)
    {
        $uuid = self::generateUUID();
        $exist = null;
        $accountName = null;
        try {
            EDC_RPC_API::request('get_account', [$uuid]);
        } catch (ErrorException $e) {
            $accountName = $uuid;
        }

        if (!$accountName) {
            return self::generateNew();
        }

        $result = EDC_RPC_API::request('suggest_brain_key', []);
        $result['name'] = $accountName;

        EDC_RPC_API::request('register_account', [$result['name'], $result['pub_key'], $result['pub_key'], EXCHANGE_ACCOUNT, $referrer ? $referrer : EXCHANGE_ACCOUNT, 0, true]);
        EDC_RPC_API::request('import_key', [$result['name'], $result['wif_priv_key']]);
        return $result;
    }

    private static function generateUUID()
    {
        return INTERNAL_ACCOUNTS_PREFIX . sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
            mt_rand(0, 0xffff), mt_rand(0, 0xffff),
            mt_rand(0, 0xffff),
            mt_rand(0, 0x0fff) | 0x4000,
            mt_rand(0, 0x3fff) | 0x8000,
            mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
        );
    }
}

class EDCTransactions
{
    public static function checkLastTransactions()
    {
        echo "======= Start balances checker =======\n";

        $accounts = EDC_RPC_API::request('list_my_accounts', []);

        $enrolledBalances = [];

        foreach ($accounts as $a) {
            if (!preg_match('/^' . INTERNAL_ACCOUNTS_PREFIX . '/', $a['name'])) {
                continue;
            }

            echo "Check last transactions for " . $a['name'] . "\n";
            $balance = EDC_RPC_API::request('list_account_balances', [$a['name']]);
            if (!count($balance)) {
                continue;
            }
            if ((float)$balance[0]['amount'] <= 0 || $balance[0]['asset_id'] != '1.3.1') { continue; } self::receiveBalance($a['name'],
(float)$balance[0]['amount']); $enrolledBalances[] = [$a['name'], self::fa($balance[0]['amount'])]; } return $enrolledBalances; } private static function receiveBalance($username, $amount) {
$amount = self::fa($amount); echo "Receive " . $amount . " EDC from " . $username . "\n"; $keys = EDC_RPC_API::request('suggest_brain_key', []); try {
EDC_RPC_API::request('create_blind_account', [BLIND_ACCOUNT_LABEL, $keys['brain_priv_key']]); } catch (ErrorException $e) {} EDC_RPC_API::request('transfer_to_blind', [$username, 'EDC',
[[BLIND_ACCOUNT_LABEL, $amount]], true]); $balances = EDC_RPC_API::request('get_blind_balances', [BLIND_ACCOUNT_LABEL]); EDC_RPC_API::request('transfer_from_blind', [BLIND_ACCOUNT_LABEL,
EXCHANGE_ACCOUNT, self::fa($balances[0]['amount']), 'EDC', true]); } // get Formatted Amount private static function fa($amount) { return (string)($amount / 1000); } } class EDC_RPC_API {
const CLI_RPC_ENDPOINT = "http://127.0.0.1:8089"; const CLI_PASSWORD = 'pass'; public static function request($method, array $params, $isRepeatRequest = false) { $data = [ "jsonrpc" => "2.0",
                                "method" => $method,
                                "params" => $params,
                                "id" => 0
                                ];

                                $data_string = json_encode($data);
                                $ch = curl_init(EDC_RPC_API::CLI_RPC_ENDPOINT);
                                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
                                curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
                                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                                curl_setopt($ch, CURLOPT_HTTPHEADER, array(
                                'Content-type: application/x-www-form-urlencoded',
                                'Content-Length: ' . strlen($data_string))
                                );

                                $result = curl_exec($ch);
                                curl_close($ch);

                                if (!$result)
                                throw new ErrorException(curl_error($ch), 500);

                                $result = json_decode($result, true);
                                if (isset($result['error'])) {
                                if (!$isRepeatRequest && EDC_RPC_API::request('is_locked', [], true)) {
                                self::unlockWallet();
                                return self::request($method, $params, true);
                                }
                                throw new ErrorException($result['error']['message'], 400);
                                }

                                return $result['result'];
                                }

                                public static function unlockWallet()
                                {
                                EDC_RPC_API::request('unlock', [self::CLI_PASSWORD]);
                                }
                                }

                                /**
                                * Generate new account
                                * return:
                                *      Array
                                *      (
                                *          [brain_priv_key] => KAMERAD DEPOSAL SIRDAR BUNKUM ACONIC DAIKON MUGWORT CANNON HERESY KINGCOB DAH FLORES PSYCH WHASLE SANDMAN ANTIWIT
                                *          [wif_priv_key] => 5KCcidccrmAD22jpyF1HonPeug11frpQbcH2wbcjjp9bquHDt3k
                                *          [pub_key] => EDC6XvwM9uCPvE5oayEW6rEoneoBtfGyknFB5hruuqab1zrrwLgti,
                                *          [name] => edce926893c-c716-4eca-a582-5a9833a8b26e
                                *      )
                                */
                                // EDCAccount::generateNew();



                                /**
                                * Check is exist new transactions to user account
                                * And transfer balance to EXCHANGE_ACCOUNT if exist (through blinded accounts without fee)
                                *
                                * If balances have been enrolled return array with username and enrolled balance
                                * return:
                                *      Array
                                *      (
                                *          Array
                                *          (
                                *              edce926893c-c716-4eca-a582-5a9833a8b26e
                                *              1000
                                *          )
                                *      )
                                */
                                // EDCTransactions::checkLastTransactions();



                                /**
                                * Custom request to CLI Wallet
                                */
                                // EDCTransactions::checkLastTransactions('get_account', ['alpha']);


                                //print_r();
                                echo "\n";