Skip to content
oysheng edited this page Mar 12, 2019 · 2 revisions

Welcome to the bufferserver wiki!

RPC API

JSON RPC is a stateless, light-weight remote procedure call (RPC) protocol. For example:

curl -X POST http://127.0.0.1:3100/dapp/list-utxos -d '{"asset":"d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f","program":"2022e829107201c6b975b1dc60b928117916285ceb4aa5c6d7b4b8cc48038083e074037caa8700c0","sort":{"by":"amount","order": "desc"}}'

list-utxos

http://127.0.0.1:3100/dapp/list-utxos

request

{
  "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f",
  "program": "2022e829107201c6b975b1dc60b928117916285ceb4aa5c6d7b4b8cc48038083e074037caa8700c0",
  "sort": {
    "by": "amount",
    "order": "desc"
  }
}

response

[
  {
    "hash": "cc4e6501ce7d566e337523eeee0a696b38a20a040c9621b66fe4abaf86dedd81",
    "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f",
    "amount": 200
  },
  {
    "hash": "cc4e6501ce7d566e337523eeee0a696b38a20a040c9621b66fe4abaf86dedd81",
    "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f",
    "amount": 100
  }
]

list-balances

http://127.0.0.1:3100/dapp/list-balances

request

{
  "address": "sm1qg5pq4qvk79h6nxt5ksqvu45rt7a9cstcfxctwq",
  "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f"
}

response

[
  {
    "address": "sm1qg5pq4qvk79h6nxt5ksqvu45rt7a9cstcfxctwq",
    "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f",
    "amount": 10000,
    "create_at": 1550650095
  },
  {
    "address": "sm1qg5pq4qvk79h6nxt5ksqvu45rt7a9cstcfxctwq",
    "asset": "0bb838d531a29dc96114cad8b86aa577fc1b22a683745eba53cde03c6850fba8",
    "amount": -10000,
    "create_at": 1550650096
  }
]

update-base

http://127.0.0.1:3100/dapp/update-base

request

{
  "program": "207d4b5c1f33bbd758ddc74e32c044bbd455b67f8ce90ce4add22def142bb2c5d8160014ed6c9062d3174230d53e916d616f132932c635fd02260202f40102f4010600204aa9d101050010a5d4e8200bb838d531a29dc96114cad8b86aa577fc1b22a683745eba53cde03c6850fba84d4302597a64370200005479cda069c35b790400e1f5059600a05c797ba19a53795579a19a695a790400e1f5059653790400e1f505967800a07800a09a6955797b957c9600a069c35b797c9f9161645b010000005b79c2547951005e79895d79895c79895b7989597989587989537a894ca4587a64980000005479cd9f6959790400e1f5059653790400e1f505967800a07800a09a5c7956799f9a6955797b957c967600a069c3787c9f91616481000000005b795479515b79c1695178c2515d79c16952c3527994c251005d79895c79895b79895a79895979895879895779895679890274787e008901c07ec1696393000000005b795479515b79c16951c3c2515d79c16963a4000000557acd9f69577a577aae7cac890274787e008901c07ec169515b79c2515d79c16952c35c7994c251005d79895c79895b79895a79895979895879895779895679895579890274787e008901c07ec1696332020000005b79c2547951005e79895d79895c79895b7989597989587989537a894ca4587a64980000005479cd9f6959790400e1f5059653790400e1f505967800a07800a09a5c7956799f9a6955797b957c967600a069c3787c9f91616481000000005b795479515b79c1695178c2515d79c16952c3527994c251005d79895c79895b79895a79895979895879895779895679890274787e008901c07ec1696393000000005b795479515b79c16951c3c2515d79c16963a4000000557acd9f69577a577aae7cac890274787e008901c07ec16951c3c2515d79c1696343020000547acd9f69587a587aae7cac747800c0",
  "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f"
}

response

null


update-utxo

http://127.0.0.1:3100/dapp/update-utxo

request

{
  "hash": "db2dfa5e98dc9c94596b0689abb18b34e04003ad613a731d8ccf0c56b49400f3"
}

response

null


update-balance

http://127.0.0.1:3100/dapp/update-balance

request

{
  "address": "sm1qg5pq4qvk79h6nxt5ksqvu45rt7a9cstcfxctwq",
  "asset": "d8202143b5ae3c607fbeb0b9f920149f551ed13c1a1c70f23f61a2cd19cc6c6f",
  "amount": 300000000,
  "tx_id": "d9b5acb305a8272d6ee29c606e85c84da258bacf7e6fd92fde59fcb5b0a1a17a"
}

response

null