跳到主要内容

Wallet Foreign API

Foreign API是钱包供他人调用的一侧。发送方将slate(交易协商数据)提交至此,并取回部分签名的slate;付款方的发票在此完成最终确认;挖矿节点向此请求构建支付给本钱包的coinbase输出。

  • 端点:http://127.0.0.1:3415/v2/foreign,通过epic-wallet listen启动
  • 协议:JSON-RPC 2.0 over HTTP POST
  • 凭据:无
  • 默认绑定:api_listen_interface为127.0.0.1,api_listen_port为3415(config/src/types.rs:71)

此处不支持凭据,因为完成转账的对方是陌生人,必须能够访问该端点。默认绑定为回环地址,因此对方通过HTTP访问此钱包时,需要扩大绑定接口范围或在其前面部署反向代理,且只能在前置层限制访问。改用epicbox中继接收则完全不需要开放入站端口。

当owner_api_include_foreign为true时,owner监听器也提供相同的6方法(controller/src/controller.rs:151)。

Endpoint
http://127.0.0.1:3415/v2/foreign
Credential
None. This is what a counterparty pays you through
Methods here
6
Documented against
node 4.1.0, wallet 4.1.0

check_version

Read only

Report the Foreign API and supported slate versions.

Surface
/v2/foreign on port 3415
Parameters
none
Declared in
api/src/foreign_rpc.rs:66

This method takes no parameters.

6 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "check_version",
  "params": []
}
Response
N/A

build_coinbase

Changes state

Build a coinbase output and kernel for a candidate block.

Surface
/v2/foreign on port 3415
Parameters
1 positional
Declared in
api/src/foreign_rpc.rs:117
Parameters

Candidate block fees, height and optional key id.

12 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "build_coinbase",
  "params": [
    {
      "fees": 0,
      "height": 1,
      "key_id": null
    }
  ]
}
Response
N/A

build_foundation

Changes state

Build the foundation output and kernel for a candidate block.

Surface
/v2/foreign on port 3415
Parameters
1 positional
Declared in
api/src/foreign_rpc.rs:120
Parameters

Candidate block fees, height and optional key id.

12 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "build_foundation",
  "params": [
    {
      "fees": 0,
      "height": 1,
      "key_id": null
    }
  ]
}
Response
N/A

Verify message signatures attached to a slate.

Surface
/v2/foreign on port 3415
Parameters
1 positional
Declared in
api/src/foreign_rpc.rs:202
Parameters

Slate containing participant messages.

8 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "verify_slate_messages",
  "params": [
    {}
  ]
}
Response
N/A

receive_tx

Changes state

Add the listener wallet output and signature to an incoming slate.

Surface
/v2/foreign on port 3415
Parameters
4 positional
Declared in
api/src/foreign_rpc.rs:357
Parameters

Incoming slate.

Account to receive into.

Recipient message.

Sender address.

11 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "receive_tx",
  "params": [
    {},
    null,
    null,
    null
  ]
}
Response
N/A

finalize_invoice_tx

Changes state

Finalize an invoice slate after the payer has funded it.

Surface
/v2/foreign on port 3415
Parameters
1 positional
Declared in
api/src/foreign_rpc.rs:525
Parameters

Funded invoice slate.

8 lines
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "finalize_invoice_tx",
  "params": [
    {}
  ]
}
Response
N/A

来源​

下一个​