--- openapi: 3.0.0 info: title: Blockstream Asset Management Platform version: 0.0.0 description: "This is an API for interacting with Blockstream Asset Management Platform version 2." servers: - url: https://amp2.testnet.blockstream.com/ tags: - name: Info description: "General information" - name: Tx Lifecycle description: "Transaction lifecycle actions: register wallets, get addresses, create PSETs (issue, reissue, send, burn), cosign and broadcast." - name: Monitoring description: "Monitor AMP2 assets: get transaction history and other details." - name: Restrictions description: "Restrictions for AMP2 assets" - name: Assets description: "Assets actions" - name: Wallets description: "Wallets actions" - name: LBTC description: "LBTC actions" - name: Admin description: "Admin actions" - name: Auth description: "Authentication actions" # -------------------------------------------------------------- # -------------------------------------------------------------- paths: # -------------------------------------------------------------- /assets/: get: description: Assets issued by this issuer tags: - Assets security: - bearerAuth: [] responses: "200": description: List of assets content: application/json: schema: $ref: "#/components/schemas/assets" # -------------------------------------------------------------- /assets/{assetId}: get: description: Asset details tags: - Assets security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: Asset details content: application/json: schema: $ref: "#/components/schemas/asset" # -------------------------------------------------------------- /assets/{assetId}/txos: get: description: Asset transaction outputs tags: - Assets - Monitoring security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: Asset transaction outputs content: application/json: schema: $ref: "#/components/schemas/txos" # -------------------------------------------------------------- /assets/{assetId}/utxos: get: description: Asset UTXOs tags: - Assets - Monitoring security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: Asset UTXOs content: application/json: schema: $ref: "#/components/schemas/utxos" # -------------------------------------------------------------- /assets/{assetId}/txs: get: description: Asset transactions tags: - Assets - Monitoring security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: query name: height_from schema: type: integer required: false description: "Only return transactions included from this blockheight" responses: "200": description: Asset transactions content: application/json: schema: $ref: "#/components/schemas/txs" # -------------------------------------------------------------- /assets/{assetId}/txs/unconfirmed: get: description: "Unconfirmed asset transactions\n\n Note: unconfirmed transaction might be conflicting with each other, i.e. they can be spending the same inputs." tags: - Assets - Monitoring security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: Unconfirmed asset transactions content: application/json: schema: type: array items: $ref: "#/components/schemas/unconfirmed-tx" # -------------------------------------------------------------- /assets/{assetId}/balance: get: description: "Asset balance\n\n AMP2 assets are owned by AMP2 wallets. This endpoint tells how much of the asset each wallet has." tags: - Assets - Monitoring security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: query name: flag schema: type: string enum: ["name"] description: Optional - name is used for wallet name instead id responses: "200": description: Balance content: application/json: schema: type: object properties: wid: type: integer description: satoshi owned by this wallet # -------------------------------------------------------------- /wallets/register: post: description: "Register a wallet\n\n Only registered wallets can receive AMP2 assets." tags: - Wallets - Tx Lifecycle requestBody: description: Register new wallet request required: true content: application/json: schema: $ref: "#/components/schemas/newWalletRequest" responses: "200": description: Wallet created content: application/json: schema: $ref: "#/components/schemas/registerResponse" # -------------------------------------------------------------- /wallets/{wid}/address: get: description: Get an address for this wallet tags: - Wallets - Tx Lifecycle security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id - in: query name: index schema: type: integer required: false description: "Address index" responses: "200": description: Wallet address content: application/json: schema: $ref: "#/components/schemas/address" # -------------------------------------------------------------- /wallets/{wid}/balance: get: description: Get AMP2 assets balance for this wallet tags: - Wallets - Tx Lifecycle - Monitoring security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id - in: query name: flag schema: type: string enum: ["name"] responses: "200": description: Balance content: application/json: schema: type: object properties: asset_id: type: integer description: "amount (in satoshi) of asset owned by this wallet" # -------------------------------------------------------------- /wallets/{wid}/balance/lbtc: get: description: Get LBTC balance for this wallet tags: - Wallets - Tx Lifecycle - Monitoring - LBTC security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: Balance content: application/json: schema: type: object properties: asset_id: type: integer description: "amount (in satoshi) of LBTC owned by this wallet" # -------------------------------------------------------------- /assets/issue: post: description: Issue a new AMP2 asset tags: - Assets - Tx Lifecycle security: - bearerAuth: [] requestBody: description: Issue request required: true content: application/json: schema: $ref: "#/components/schemas/issueRequest" responses: "200": description: Unsigned PSET with issuance content: application/json: schema: $ref: "#/components/schemas/unsignedPSET" # -------------------------------------------------------------- /assets/{assetId}/reissue: post: description: "Reissue this asset\n\n The funding wallet must have the corresponding reissuance token and some LBTC for fees." tags: - Assets - Tx Lifecycle security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id requestBody: description: Reissue request required: true content: application/json: schema: $ref: "#/components/schemas/reissueRequest" responses: "200": description: Unsigned PSET with reissuance content: application/json: schema: $ref: "#/components/schemas/unsignedPSET" # -------------------------------------------------------------- /assets/{assetId}/send: post: description: Send this asset tags: - Assets - Tx Lifecycle security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id requestBody: description: send request required: true content: application/json: schema: $ref: "#/components/schemas/sendRequest" responses: "200": description: Unsigned PSET sending the asset content: application/json: schema: $ref: "#/components/schemas/unsignedPSET" # -------------------------------------------------------------- /assets/{assetId}/burn: post: description: Burn this asset tags: - Assets - Tx Lifecycle security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id requestBody: description: burn request required: true content: application/json: schema: $ref: "#/components/schemas/burnRequest" responses: "200": description: Unsigned PSET burning the asset content: application/json: schema: $ref: "#/components/schemas/unsignedPSET" # -------------------------------------------------------------- /wallets/{wid}/send/lbtc: post: description: "Create a PSET sending LBTC\n\n Note: unlike AMP2 assets, LBTC can be sent to any Liquid address" tags: - Wallets - Tx Lifecycle - LBTC security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: Unsigned PSET sending LBTC content: application/json: schema: type: object properties: recipients: type: array items: type: object properties: satoshi: type: integer description: Asset amount (is satoshi) to send address: type: string description: Recipient address # -------------------------------------------------------------- /assets/{assetId}/lock: post: description: "Lock this asset\n\n When an asset is locked it cannot be sent or received." tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /assets/{assetId}/unlock: post: description: "Unlock this asset\n\n When an asset is locked it cannot be sent or received." tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /assets/{assetId}/utxos/{outpoint}/lock: post: description: Lock a UTXO tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: path name: outpoint schema: type: string required: true description: The UTXO outpoint, in the form txid:vout responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /assets/{assetId}/utxos/{outpoint}/unlock: post: description: Unlock a UTXO tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: path name: outpoint schema: type: string required: true description: The UTXO outpoint, in the form txid:vout responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /assets/{assetId}/wallets/{wid}/restrictions: get: description: Get restrictions for this asset/wallet pair tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: Restrictions content: application/json: schema: $ref: "#/components/schemas/restrictions" # -------------------------------------------------------------- post: description: Add or modify a restrictions for this asset/wallet pair tags: - Assets - Restrictions security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id - in: path name: wid schema: type: string required: true description: Wallet id requestBody: description: restrictions request required: true content: application/json: schema: $ref: "#/components/schemas/restrictionsRequest" responses: "200": description: Restrictions content: application/json: schema: $ref: "#/components/schemas/restrictions" # -------------------------------------------------------------- /assets/{assetId}/set-notes: post: description: Set notes for this asset tags: - Assets security: - bearerAuth: [] parameters: - in: path name: assetId schema: type: string required: true description: Asset id requestBody: description: Set notes request required: true content: application/json: schema: $ref: "#/components/schemas/setNotesRequest" responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- # -------------------------------------------------------------- /auth/new-user: post: description: Create a new user (admin only) tags: - Auth - Admin security: - bearerAuth: [] requestBody: description: Username and password for the new user required: true content: application/json: schema: $ref: "#/components/schemas/tokenRequest" responses: "200": description: User details content: application/json: schema: $ref: "#/components/schemas/token" # -------------------------------------------------------------- /auth/token: post: description: Get authentication token tags: - Auth requestBody: description: Username and password required: true content: application/json: schema: $ref: "#/components/schemas/tokenRequest" responses: "200": description: User token content: application/json: schema: $ref: "#/components/schemas/token" # -------------------------------------------------------------- /auth/refresh-token: post: description: Refresh authentication token tags: - Auth requestBody: description: Username and password required: true content: application/json: schema: $ref: "#/components/schemas/tokenRequest" responses: "200": description: New token generated content: application/json: schema: $ref: "#/components/schemas/token" # -------------------------------------------------------------- /auth/change-password: post: description: Change password tags: - Auth security: - bearerAuth: [] requestBody: description: Change password request required: true content: application/json: schema: $ref: "#/components/schemas/changePasswordRequest" responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /auth/user: get: description: Get name of the issuer identified by token tags: - Auth security: - bearerAuth: [] responses: "200": description: Username of the issuer content: application/json: schema: $ref: "#/components/schemas/user" # -------------------------------------------------------------- /auth/issuers: get: description: Get the list of issuers (admin only) tags: - Auth - Admin security: - bearerAuth: [] responses: "200": description: List of issuers content: application/json: schema: $ref: "#/components/schemas/issuers" # -------------------------------------------------------------- # -------------------------------------------------------------- /elements/status: get: description: Get status of connected elements node tags: - Admin responses: "200": description: Node status content: application/json: schema: $ref: "#/components/schemas/status" # -------------------------------------------------------------- /elements/blockheight: get: description: Get blockheight of connected elements node tags: - Admin responses: "200": description: Node blockheight content: application/json: schema: $ref: "#/components/schemas/blockheight" # -------------------------------------------------------------- /elements/update: get: description: Update information from node tags: - Admin responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- # -------------------------------------------------------------- /info/status: get: description: Get AMP2 status tags: - Info responses: "200": description: AMP2 status content: application/json: schema: $ref: "#/components/schemas/infoStatus" # -------------------------------------------------------------- /info/spec: get: description: Get OpenApi specification file (in yaml format) tags: - Info responses: "200": description: yaml specification content: application/json: schema: type: object # -------------------------------------------------------------- /info/xpub: get: description: Get AMP2 XPUB tags: - Info responses: "200": description: AMP2 XPUB content: application/json: schema: $ref: "#/components/schemas/XPUB" # -------------------------------------------------------------- /info/changelog: get: description: Get changelog tags: - Info responses: "200": description: Changelog content: application/json: schema: type: object # -------------------------------------------------------------- # -------------------------------------------------------------- /wallets/: get: description: Wallets registered with AMP2 tags: - Wallets security: - bearerAuth: [] responses: "200": description: Wallets list content: application/json: schema: $ref: "#/components/schemas/wallets" # -------------------------------------------------------------- /wallets/{wid}: get: description: wallets details tags: - Wallets security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: Wallet content: application/json: schema: $ref: "#/components/schemas/wallet" # -------------------------------------------------------------- /wallets/{wid}/lock: post: description: "Lock this wallet\n\n When a wallet is locked it cannot receive or send AMP2 assets; Note: this is only enforced for the assets issued by this issuer." tags: - Wallets - Restrictions security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /wallets/{wid}/unlock: post: description: "Unlock this wallet\n\n When a wallet is locked it cannot receive or send AMP2 assets; Note: this is only enforced for the assets issued by this issuer." tags: - Wallets - Restrictions security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- /wallets/sign: post: description: Ask AMP2 to cosign a PSET tags: - Wallets - Tx Lifecycle requestBody: description: Sign PSET request required: true content: application/json: schema: $ref: "#/components/schemas/signPSETRequest" responses: "200": description: Signed PSET content: application/json: schema: $ref: "#/components/schemas/signedPSET" # -------------------------------------------------------------- /wallets/broadcast: post: description: Broadcast a transaction tags: - Wallets - Tx Lifecycle security: - bearerAuth: [] requestBody: description: Broadcast PSET request required: true content: application/json: schema: $ref: "#/components/schemas/broadcastPSETRequest" responses: "200": description: Transaction details content: application/json: schema: type: object properties: txid: type: string description: Transaction id # -------------------------------------------------------------- /wallets/{wid}/set-notes: post: description: Set notes for this wallet tags: - Wallets security: - bearerAuth: [] parameters: - in: path name: wid schema: type: string required: true description: Wallet id requestBody: description: Set wallet notes request required: true content: application/json: schema: $ref: "#/components/schemas/setNotesRequest" responses: "200": description: OK content: application/json: schema: type: object # -------------------------------------------------------------- # -------------------------------------------------------------- # -------------------------------------------------------------- components: # -------------------------------------------------------------- securitySchemes: bearerAuth: type: http scheme: bearer # -------------------------------------------------------------- schemas: # -------------------------------------------------------------- assets: type: array items: $ref: "#/components/schemas/asset" description: List of assets # -------------------------------------------------------------- asset: type: object properties: asset_id: type: string description: Asset id issuer: type: string description: Identifier of the issuer name: type: string description: Name of the asset contract: $ref: "#/components/schemas/contract" notes: $ref: "#/components/schemas/notes" locked: type: boolean description: > If `true`, all transactions with this asset are not cosigned. reissuance_token_id: type: string description: > The reissuance token id in HEX. Empty if the asset cannot be reissued. reissuance_token_locked: type: boolean description: > If `true`, all transactions with this reissuance token are not cosigned. # -------------------------------------------------------------- notes: type: object properties: note: type: string description: Note # -------------------------------------------------------------- contract: type: object properties: name: type: string description: Asset Name ticker: type: string description: Asset ticker entity: type: object properties: domain: type: string description: Issuer domain name precision: type: number description: Asset precision version: type: number description: contract version (actually set to 0) issuer_pubkey: type: string description: issuer public key # -------------------------------------------------------------- unsignedPSET: type: object properties: pset: type: string description: PSET serialization # -------------------------------------------------------------- txos: type: array items: $ref: "#/components/schemas/txo" description: List of transaction outputs # -------------------------------------------------------------- utxo: type: object properties: txid: type: string description: Transaction id vout: type: integer description: Output index wid: type: string description: Wallet id is_change: type: boolean description: If true the output is a change index: type: number description: Index in the wallet asset_id: type: string description: Asset id abf: type: string description: Asset blinder vbf: type: string description: Value blinder satoshi: type: integer description: Amount (in satoshi) minimum: 1 maximum: 2100000000000000 included_blockheight: type: integer description: The height of block of this output locked: type: boolean description: If `true`, all transactions spending this UTXO are not cosigned. # -------------------------------------------------------------- utxos: type: array items: $ref: "#/components/schemas/utxo" description: List of UTXOs # -------------------------------------------------------------- txs: type: array items: $ref: "#/components/schemas/tx" description: List of transactions # -------------------------------------------------------------- tx: type: object properties: txid: type: string description: Identifier of the transaction height: type: string description: Height of the confirmed transaction unblinded_url: type: string description: Umblinded url for the transaction inputs: type: array items: $ref: "#/components/schemas/txIn" description: List of transaction inputs outputs: type: array items: $ref: "#/components/schemas/txOut" description: List of transaction outputs # -------------------------------------------------------------- unconfirmed-tx: type: object properties: txid: type: string description: Identifier of the transaction inputs: type: array items: $ref: "#/components/schemas/txIn" description: List of transaction inputs outputs: type: array items: $ref: "#/components/schemas/txOut" description: List of transaction outputs # -------------------------------------------------------------- txo: type: object properties: txid: type: string description: Transaction id vout: type: integer description: Output index wid: type: string description: Wallet id is_change: type: boolean description: If true the output is a change index: type: number description: Index in the wallet asset_id: type: string description: Asset id abf: type: string description: Asset blinder vbf: type: string description: Value blinder satoshi: type: integer description: Amount (in satoshi) minimum: 1 maximum: 2100000000000000 included_blockheight: type: integer description: The height of block of this output spent_blockheight: type: integer description: If spent the height of block including the spending tx spend_vin: type: integer description: if spent the input index in the spending transaction spend_txid: type: integer description: if spent the if of the spending transaction # -------------------------------------------------------------- txOut: type: object properties: vout: type: integer description: Output index wid: type: string description: Wallet id satoshi: type: integer description: Amount (in satoshi) minimum: 1 maximum: 2100000000000000 # -------------------------------------------------------------- txIn: type: object properties: vin: type: integer description: Input index wid: type: string description: Wallet id satoshi: type: integer description: Amount (in satoshi) minimum: 1 maximum: 2100000000000000 # -------------------------------------------------------------- token: type: object properties: token: type: string description: Authentication token # -------------------------------------------------------------- user: type: object properties: username: type: string description: Username name # -------------------------------------------------------------- issuers: type: array items: $ref: "#/components/schemas/issuer" description: List of issuers # -------------------------------------------------------------- issuer: type: object properties: username: type: string description: Issuer name # -------------------------------------------------------------- status: type: object properties: elements_best_block_hash: type: string description: Hash id of the best block elements_version: type: string description: Software version of the elements node # -------------------------------------------------------------- blockheight: type: object properties: blocks: type: number description: Number of valid blocks in elements chain # -------------------------------------------------------------- infoStatus: type: object properties: amp2_version: type: string description: AMP2 version flask_version: type: string description: Flask version local_time: type: string description: Server timestamp lwk_version: type: string description: LWK version python_version: type: string description: Python version network: type: string description: Elements network # -------------------------------------------------------------- XPUB: type: object properties: keyorigin_xpub: type: string description: Service XPUB with keyorigin # -------------------------------------------------------------- wallets: type: array items: $ref: "#/components/schemas/wallet" description: List of wallets # -------------------------------------------------------------- wallet: type: object properties: wid: type: string description: Wallet id descriptor: type: string description: Descriptor name: type: string description: Name of the wallet locked: type: boolean description: Locking flag # -------------------------------------------------------------- registerResponse: type: object properties: wid: type: string description: Wallet id descriptor: type: string description: Descriptor # -------------------------------------------------------------- address: type: object properties: address: type: string description: Address index: type: number description: Derivation index # -------------------------------------------------------------- signedPSET: type: object properties: pset: type: string description: PSET serialization # -------------------------------------------------------------- # -------------------------------------------------------------- sendRequest: type: object properties: wid: type: string description: Funding wallet id recipients: type: array items: type: object properties: satoshi: type: integer description: Asset amount (in satoshi) to send wid: type: string description: Recipient wallet id # -------------------------------------------------------------- burnRequest: type: object properties: wid: type: string description: Funding wallet id satoshi: type: integer description: Asset amount (in satoshi) to burn minimum: 1 maximum: 2100000000000000 # -------------------------------------------------------------- issueRequest: type: object properties: wid: type: string description: Funding wallet id satoshi_asset: type: integer description: Asset amount (in satoshi) to issue minimum: 1 maximum: 2100000000000000 satoshi_token: type: integer description: (Optional) Reissuance token amount (in satoshi) to issue minimum: 1 maximum: 2100000000000000 contract: type: string description: (Optional) Contract for the issued asset # -------------------------------------------------------------- reissueRequest: type: object properties: wid: type: string description: Funding wallet id satoshi_to_reissue: type: integer description: Asset amount (in satoshi) to reissue minimum: 1 maximum: 2100000000000000 asset_receiver_wid: type: string description: > Send the newly issued assets to this wallet. If this value is not specified, the asset is sent to the funding wallet. # -------------------------------------------------------------- setNotesRequest: type: object properties: note: type: string description: Note # -------------------------------------------------------------- tokenRequest: type: object properties: username: type: string description: Username password: type: string description: Password # -------------------------------------------------------------- changePasswordRequest: type: object properties: username: type: string description: Username password: type: string description: Old password new-password: type: string description: New password # -------------------------------------------------------------- newWalletRequest: type: object properties: descriptor: type: string description: Descriptor of the new wallet # -------------------------------------------------------------- signPSETRequest: type: object properties: pset: type: string description: PSET to be signed # -------------------------------------------------------------- broadcastPSETRequest: type: object properties: pset: type: string description: PSET to be broadcast # -------------------------------------------------------------- restrictions: type: object properties: wid: type: string description: Wallet id asset_id: type: string description: Asset id can_burn: type: boolean description: "If `false`, transactions spending an input with this `wid`-`asset_id` pair will not be cosigned" use_to_whitelist: type: boolean description: "If `true`, transactions spending an input with this `wid`-`asset_id` pair must send the asset to wallets in `to_whitelist`" to_whitelist: type: array items: type: string description: Wallet id # -------------------------------------------------------------- restrictionsRequest: type: object properties: can_burn: type: boolean description: Can burn flag use_to_whitelist: type: boolean description: Use to whitelist flag to_whitelist: type: array items: type: string description: Wallet id