Skip to main content

contracts_get_all

Returns every escrow contract this wallet participates in, on either side, together with its current state and private terms.

Request

{
"jsonrpc": "2.0",
"id": 0,
"method": "contracts_get_all"
}

Response

{
"id": 0,
"jsonrpc": "2.0",
"result": {
"contracts": [
{
"contract_id": "b6f2c3d18e47a05b9c2d4e6f81a30b57cd94e2f16a8b0c37d5e19f4a2b6c08d3",
"state": 2,
"is_a": true,
"expiration_time": 1701436800,
"cancel_expiration_time": 0,
"timestamp": 1701350400,
"height": 203114,
"payment_id": "60900e5603bf96e3",
"private_detailes": {
"t": "Laptop purchase, order #4471",
"c": "Ship to the address given in the order, tracking number required",
"a_addr": "NiRqzHVJfBJUj1WBUvHTPzYAJ4cKA6PQb2ZR33ZmS4Zp7DDcUxUE29nAkMtLPfCPXwPUgvYRZZ9NM2gN4uRRP1e12wTGSCMzn",
"b_addr": "NiRs1YkQ8jTPzVCkR4h8nDdWq7BvXZ2LmA6ecNu3TgKoP9RfHy5UwJ4bMxLc7DnQaEuVt2SgYkRp8NwFz3XmB6dK14vHTQjRa",
"to_pay": 1200000000000,
"a_pledge": 600000000000,
"b_pledge": 600000000000
}
}
]
}
}

Response information

  • contracts - array of every escrow contract known to this wallet, regardless of state or of which side the wallet is on.
  • contracts[].contract_id - string; hex-encoded contract identifier — the id of the multisig output holding the escrowed coins. This is the handle passed to contracts_accept_proposal, contracts_release, contracts_request_cancel and contracts_accept_cancel.
  • contracts[].state - unsigned int; current contract state:
    • 1 — proposal sent: side A has published the proposal and is waiting for side B to accept.
    • 2 — contract accepted: side B accepted, the escrowed coins are locked in the multisig output.
    • 3 — contract released normally: side A completed the deal, the payment went to side B and both pledges were returned.
    • 4 — contract released burned: the contract was terminated and all escrowed coins, including both pledges, were destroyed.
    • 5 — cancel proposal sent: side A requested cancellation and is waiting for side B to accept it.
    • 6 — contract released cancelled: side B accepted the cancellation, the payment and both pledges went back to their owners.
  • contracts[].is_a - boolean; true when this wallet is side A of the contract (normally the buyer, the party that sent the proposal), false when it is side B (normally the seller). It determines which operations this wallet may perform: only side A can call contracts_release and contracts_request_cancel, and only side B can call contracts_accept_proposal and contracts_accept_cancel.
  • contracts[].expiration_time - unsigned int; unix timestamp after which the proposal can no longer be accepted, derived from the expiration_period given when the proposal was sent.
  • contracts[].cancel_expiration_time - unsigned int; unix timestamp after which a pending cancellation request can no longer be accepted, derived from the expiration_period given to contracts_request_cancel. Zero while no cancellation has been requested.
  • contracts[].timestamp - unsigned int; unix timestamp of the contract's creation.
  • contracts[].height - unsigned int; height of the block in which the last state change of this contract was confirmed.
  • contracts[].payment_id - string; payment ID attached to the contract, or an empty string if none was supplied.
  • contracts[].private_detailes - object; the private terms agreed by both parties, decrypted by this wallet. Field names are the compact keys used on the wire.
  • contracts[].private_detailes.t - string; contract title or short description.
  • contracts[].private_detailes.c - string; free-form comment.
  • contracts[].private_detailes.a_addr - string; address of side A (normally the buyer).
  • contracts[].private_detailes.b_addr - string; address of side B (normally the seller).
  • contracts[].private_detailes.to_pay - unsigned int; payment for the goods or service, in atomic units (1 coin = 10^12 atomic units).
  • contracts[].private_detailes.a_pledge - unsigned int; collateral deposited by side A, in atomic units.
  • contracts[].private_detailes.b_pledge - unsigned int; collateral deposited by side B, in atomic units.