Minka Ledger Docs
ReferencesApi referenceIntentIntents

Create an intent

Intents describe all ledger balance movements. Each intent can contain one or more claims. A claim is a statement about an action that a user or a system wants to record in a ledger. Claims can describe various actions, and number of supported actions is expected to grow over time as new use cases are supported. All claims that are part of an intent are going to be cleared by the ledger atomically. This means that either all or none of the intent claims are going to be accepted by the ledger. Currently, supported actions for claims are: - `issue` - used when issuing new balance from symbol to target wallet. This action increases the total value of balances in the system. - `transfer` - used when transfering balance from source to target wallet. - `destroy` - used when destroying a balance from source wallet. This action decreases the total value of balances in the system. - `limit` - used when applying a limit to a wallet. This action will update the limit for the specified metric on the requested wallet.

POST
/intents

Authorization

AuthorizationRequiredBearer <token>

JWT signed by private key. The presence of this token is not mandatory. It becomes required through the configuration of authorization access rules that requires a token to grant access. Once sent, the token is validated for its format, signature and expiration, regardless of the presence of access rules.

In: header

Request Body

application/jsonRequired

Intent body

hashRequiredstring
Pattern: "^[A-Fa-f0-9]{64}$"
metaRequiredobject
dataRequiredobject & object

Header Parameters

x-ledgerstring | string

The unique identifier of ledger in context for multi tenant requests.

curl -X POST "http://localhost:3000/v2/intents" \
  -H "x-ledger: bog" \
  -H "Content-Type: application/json" \
  -d '{
    "hash": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
    "meta": {
      "proofs": [
        {
          "method": "ed25519-v2",
          "public": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE=",
          "digest": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
          "result": "0G2gvSfBx6MwPT8ShBaiYx7zwa5Kqc4Cq3S3NXV1m5/ZPozoH/SUouuhi9sQU+f0yo0eX4ygH7PzE3PAdlxsCQ==",
          "custom": {
            "moment": "2019-01-01T00:00:00.000Z",
            "type": "PERSON",
            "reference": 3284759238475
          }
        }
      ],
      "thread": "tran:12345@pbz.hr",
      "status": "aborted",
      "routed": true
    },
    "data": {
      "handle": "tran:12345@pbz.hr",
      "parent": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
      "access": [
        {
          "signer": {
            "format": "ed25519-raw",
            "public": {
              "$eq": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE="
            },
            "custom": {
              "type": "person",
              "age": {
                "$gte": 21
              }
            },
            "handle": {
              "$in": [
                "admin"
              ]
            }
          },
          "record": "any",
          "action": "any",
          "invoke": "wallet.canSpendAllChangedRouteTargets",
          "bearer": {
            "iss": "company.org",
            "sub": "admin",
            "aud": "ledger",
            "hsh": true,
            "$signer": {
              "format": "ed25519-raw",
              "public": {
                "$eq": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE="
              },
              "custom": {
                "type": "person",
                "age": {
                  "$gte": 21
                }
              },
              "handle": {
                "$in": [
                  "admin"
                ]
              }
            }
          },
          "filter": {
            "schema": "bank"
          },
          "change": {
            "schema": "p2p"
          }
        }
      ],
      "custom": {
        "type": "PERSON",
        "reference": 3284759238475
      },
      "schema": "tran:12345@pbz.hr",
      "claims": [
        {
          "action": "issue",
          "target": {
            "handle": "tran:12345@pbz.hr",
            "custom": {
              "type": "PERSON",
              "reference": 3284759238475
            }
          },
          "symbol": {
            "handle": "tran:12345@pbz.hr",
            "custom": {
              "type": "PERSON",
              "reference": 3284759238475
            }
          },
          "amount": 1000
        }
      ],
      "config": {
        "commit": "auto"
      },
      "origin": "tran:12345@pbz.hr"
    }
  }'

Created intent

{
  "hash": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
  "meta": {
    "proofs": [
      {
        "method": "ed25519-v2",
        "public": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE=",
        "digest": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
        "result": "0G2gvSfBx6MwPT8ShBaiYx7zwa5Kqc4Cq3S3NXV1m5/ZPozoH/SUouuhi9sQU+f0yo0eX4ygH7PzE3PAdlxsCQ==",
        "custom": {
          "moment": "2019-01-01T00:00:00.000Z",
          "type": "PERSON",
          "reference": 3284759238475
        }
      }
    ],
    "owners": [
      "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE="
    ],
    "moment": "2019-08-24T14:15:22Z",
    "status": "aborted",
    "labels": [
      "preferred"
    ],
    "thread": "tran:12345@pbz.hr",
    "routed": true
  },
  "luid": "$wlt.7mSVWFKX-Tfx2NsNj",
  "data": {
    "handle": "tran:12345@pbz.hr",
    "parent": "4969e3c012b66d88cec597bf337fc01eab8d651e6ed2d5c40236cc1f7d93435a",
    "access": [
      {
        "signer": {
          "format": "ed25519-raw",
          "public": {
            "$eq": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE="
          },
          "custom": {
            "type": "person",
            "age": {
              "$gte": 21
            }
          },
          "handle": {
            "$in": [
              "admin"
            ]
          }
        },
        "record": "any",
        "action": "any",
        "invoke": "wallet.canSpendAllChangedRouteTargets",
        "bearer": {
          "iss": "company.org",
          "sub": "admin",
          "aud": "ledger",
          "hsh": true,
          "$signer": {
            "format": "ed25519-raw",
            "public": {
              "$eq": "WAweF9PHlboQoW0z8NqhZXFmzUTaV74NRFAd/aILprE="
            },
            "custom": {
              "type": "person",
              "age": {
                "$gte": 21
              }
            },
            "handle": {
              "$in": [
                "admin"
              ]
            }
          }
        },
        "filter": {
          "schema": "bank"
        },
        "change": {
          "schema": "p2p"
        }
      }
    ],
    "custom": {
      "type": "PERSON",
      "reference": 3284759238475
    },
    "schema": "tran:12345@pbz.hr",
    "claims": [
      {
        "action": "issue",
        "target": {
          "handle": "tran:12345@pbz.hr",
          "custom": {
            "type": "PERSON",
            "reference": 3284759238475
          }
        },
        "symbol": {
          "handle": "tran:12345@pbz.hr",
          "custom": {
            "type": "PERSON",
            "reference": 3284759238475
          }
        },
        "amount": 1000
      }
    ],
    "config": {
      "commit": "auto"
    },
    "origin": "tran:12345@pbz.hr"
  }
}