跳到主要内容

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_interface127.0.0.1api_listen_port3415config/src/types.rs:71

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

owner_api_include_foreign为true时,Owner监听器也提供相同的六个方法(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.0.3, wallet 4.0.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:65

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:116
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:119
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:201
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:359
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:532
Parameters

Funded invoice slate.

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

来源

下一个