From dc58bec13ff25adc1afedb6892630f3d445ca1a6 Mon Sep 17 00:00:00 2001 From: vekamo Date: Mon, 25 Nov 2024 16:00:00 +0400 Subject: [PATCH] push update --- .vitepress/config.mts | 235 ++----- {nodes => developers}/api.md | 0 developers/api/node.md | 475 +++++++++++++ developers/api/stratum.md | 478 +++++++++++++ developers/api/wallet.md | 400 +++++++++++ .../introduction.md => developers/commands.md | 0 developers/get-started.md | 58 ++ developers/integration.md | 648 ++++++++++++++++++ developers/integration/exchange/deposit.md | 237 +++++++ .../integration/exchange/introduction.md | 0 developers/integration/exchange/withdrawal.md | 0 developers/library.md | 0 node/api.md | 0 node/commands.md | 58 ++ node/introduction.md | 58 ++ 15 files changed, 2471 insertions(+), 176 deletions(-) rename {nodes => developers}/api.md (100%) create mode 100644 developers/api/node.md create mode 100644 developers/api/stratum.md create mode 100644 developers/api/wallet.md rename nodes/introduction.md => developers/commands.md (100%) create mode 100644 developers/get-started.md create mode 100644 developers/integration.md create mode 100644 developers/integration/exchange/deposit.md create mode 100644 developers/integration/exchange/introduction.md create mode 100644 developers/integration/exchange/withdrawal.md create mode 100644 developers/library.md create mode 100644 node/api.md create mode 100644 node/commands.md create mode 100644 node/introduction.md diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 7aa722f..d874f6a 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -66,12 +66,12 @@ function nav() { { text: "Quick start", items: [ - { text: "Nodes", link: "/node/overview" }, - { text: "Wallet", link: "/wallet/overview" }, - { text: "Miner", link: "/miner/overview" }, + { text: "Nodes", link: "/node/introduction" }, + { text: "Wallet", link: "/wallet/introduction" }, + { text: "Miner", link: "/miner/introduction" }, ], }, - { text: "Learn", link: "/learn/how-mwc-works/overview" }, + { text: "Learn", link: "/learn/introduction" }, //{ text: "Networks", link: "/nodes/participate" }, { text: "Developers", link: "/developers/build-modular" }, { text: "Community", link: "/community/overview" }, @@ -94,12 +94,12 @@ function sidebarHome() { link: "/node/introduction", }, { - text: "Setting up Your Node", - link: "/node/setup", + text: "Commands", + link: "/node/commands", }, { - text: "Commands", - link: "/node/setup", + text: "API", + link: "/node/api", }, ], }, @@ -267,7 +267,7 @@ function sidebarHome() { } ] }, - { + /*{ text: "Advanced Features", collapsed: true, items: [ @@ -288,7 +288,7 @@ function sidebarHome() { { text: "FAQ", link: "/wallet/web/faq" - } + }**/ ] }, { @@ -300,6 +300,14 @@ function sidebarHome() { link: "/wallet/console/get-started" }, { + text: "Commands", + link: "/wallet/console/commands" + }, + { + text: "API", + link: "/wallet/console/api" + } + /*{ text: "Setting Up Your Wallet", collapsed: true, items: [ @@ -352,7 +360,7 @@ function sidebarHome() { { text: "FAQ", link: "/wallet/console/faq" - } + }*/ ] }, { @@ -407,7 +415,7 @@ function sidebarHome() { text: "Miners", collapsed: true, items: [ - { + /*{ text: "Overview of mwc", collapsed: true, items: [ @@ -474,209 +482,84 @@ function sidebarHome() { link: "/learn/mwc", }, ], - }, + },*/ ], }, - /*{ + { text: "Developers", collapsed: true, items: [ - { text: "Build modular", link: "/developers/build-modular" }, { - text: "Submitting data blobs to mwc", - link: "/developers/submit-data", + text: "Getting Started", + link: "/developers/get-started", }, { - text: "Transaction resubmission guidelines", - link: "/developers/transaction-resubmission", + text: "Integration", + link: "/developers/integration", }, - { - text: "Node API", - link: "/developers/node-api", + /*{ + text: "Integration", collapsed: true, items: [ { - text: "Node RPC CLI tutorial", - link: "/developers/node-tutorial", + text: "Getting Started", + link: "/developers/get-started", }, { - text: "mwc-node RPC API documentation", - link: "https://node-rpc-docs.mwc.org/", + text: "Exchange", + collapsed: true, + items: [ + { text: "Deposit", link: "/developers/integration/exchange/deposit" }, + { text: "Withdrawal", link: "/developers/integration/exchange/withdrawal"}, + ], }, - { text: "Prompt Scavenger", link: "/developers/prompt-scavenger" }, + { text: "Mining Pool", link: "/developers/integration/mining-pool"}, ], - }, + },*/ { - text: "Integrate with Blobstream", + text: "API", collapsed: true, items: [ { - text: "Overview of Blobstream", - link: "/developers/blobstream", - }, - { - text: "Integrate with Blobstream contracts", - link: "/developers/blobstream-contracts", + text: "Node", + link: "/developers/api/node", }, { - text: "Integrate with Blobstream client", - link: "/developers/blobstream-offchain", + text: "Wallet", + link: "/developers/api/wallet", }, { - text: "Querying the Blobstream proofs", - link: "/developers/blobstream-proof-queries", - }, - { - text: "Local Blobstream X operators", - collapsed: true, - items: [ - { - text: "Requesting data commitment ranges", - link: "/developers/requesting-data-commitment-ranges", - }, - { - text: "New Blobstream X deployments", - link: "/developers/blobstream-x-deploy", - }, - ], + text: "Stratum", + link: "/developers/api/stratum", }, ], }, + ], + }, + { + text: "Learn", + collapsed: true, + items: [ { - text: "Deploy a rollup", - link: "/developers/rollup-overview", + text: "Integration", collapsed: true, items: [ { - text: "Ethereum L2s", - collapsed: true, - items: [ - { - text: "Ethereum fallback mechanism", - link: "/developers/ethereum-fallback", - }, - { - text: "Arbitrum", - collapsed: true, - items: [ - { - text: "Introduction to Arbitrum rollups with mwc as DA", - link: "/developers/arbitrum-integration", - }, - { - text: "Deploy an Arbitrum rollup devnet", - link: "/developers/arbitrum-deploy", - }, - // { - // text: "Deploy an Arbitrum rollup to Mocha testnet", - // link: "/developers/arbitrum-mocha", - // }, - { - text: "Nitrogen testnet", - link: "/developers/nitrogen", - }, - { - text: "Deploy a smart contract on Arbitrum rollup", - link: "/developers/arbitrum-smart-contract", - }, - { - text: "Deploy a dapp on your Arbitrum rollup devnet", - link: "/developers/arbitrum-dapp-deploy", - }, - ], - }, - { - text: "Optimism", - collapsed: true, - items: [ - { - text: "Intro to OP Stack integration", - link: "/developers/intro-to-op-stack", - }, - { - text: "Bubs testnet", - link: "/developers/bubs-testnet", - }, - { - text: "Deploy a smart contract on Bubs testnet", - link: "/developers/deploy-on-bubs", - }, - { - text: "Deploy a dapp on Bubs testnet", - link: "/developers/gm-portal-bubs", - }, - { - text: "Deploy an OP Stack devnet", - link: "/developers/optimism-devnet", - }, - { - text: "Deploy an OP Stack devnet on mwc", - link: "/developers/optimism", - }, - { - text: "Audit", - link: "https://docs.mwc.org/mwc_OP_Stack_Audit.pdf", - }, - { - text: "Deploy a dapp with thirdweb", - link: "https://thirdweb.com/bubs-testnet", - }, - { - text: "Rollups-as-a-Service", - collapsed: true, - items: [ - { - text: "Caldera", - link: "https://caldera.xyz/", - }, - ], - }, - ], - }, - ], + text: "Getting Started", + link: "/developers/get-started", }, - { text: "Rollkit", link: "/developers/rollkit" }, { - text: "Astria", + text: "Exchange", collapsed: true, items: [ - { text: "Documentation", link: "https://docs.astria.org" }, - { - text: "Deploy to Dusknet", - link: "https://docs.astria.org/docs/dusknet/overview/", - }, + { text: "Deposit", link: "/developers/integration/exchange/deposit" }, + { text: "Withdrawal", link: "/developers/integration/exchange/withdrawal"}, ], }, - { - text: "Sovereign SDK", - link: "https://github.com/Sovereign-Labs/sovereign-sdk/tree/stable/examples/demo-rollup#demo-rollup", - }, - { - text: "Vistara", - link: "https://docs.vistara.dev/", - }, - { - text: "Dymension", - link: "https://dymension.xyz/", - }, + { text: "Mining Pool", link: "/developers/integration/mining-pool"}, ], }, - { - text: "Wallets", - collapsed: true, - items: [ - { text: "mwc-node", link: "/developers/mwc-node-key" }, - { - text: "Integrating Wallets for developers", - link: "/developers/wallets", - }, - ], - }, - { - text: "Integrate mwc for service providers", - link: "/developers/integrate-mwc", - }, ], - },*/ + }, ]; } \ No newline at end of file diff --git a/nodes/api.md b/developers/api.md similarity index 100% rename from nodes/api.md rename to developers/api.md diff --git a/developers/api/node.md b/developers/api/node.md new file mode 100644 index 0000000..1fc21a1 --- /dev/null +++ b/developers/api/node.md @@ -0,0 +1,475 @@ + +# Node API + +The API is used to query a node about various information on the blockchain, networks and peers. By default, the API will listen on `localhost:3413`. The API is started at the same time as the mwc node. +This endpoint requires, by default, [basic authentication](https://en.wikipedia.org/wiki/Basic_access_authentication). The username is `mwcmain`. + + +## Node API v1 + +**Note:** version 1 of the API will be deprecated in v4.0.0 and subsequently removed in v5.0.0. Users of this API are encouraged to upgrade to API v2. + +This API uses REST for its requests. To learn about what specific calls can be made read the [node API v1 doc](https://github.com/mimblewimble/mwc/blob/master/doc/api/node_api_v1.md). + +Basic auth password can be found in `.api_secret` + + + +## Node API v2 + +This API version uses JSON-RPC for its requests. It is split up into a foreign API and an owner API. The documentation for these endpoints is automatically generated: + +* [Owner API](https://docs.rs/mwc_api/latest/mwc_api/trait.OwnerRpc.html) +* [Foreign API](https://docs.rs/mwc_api/latest/mwc_api/trait.ForeignRpc.html) + +Basic auth passwords can be found in `.api_secret`/`.foreign_api_secret` files respectively. + +::: tip +A complete Postman collection for the MWC Node API can be found [here](https://forum.mwc.mw/t/full-postman-collection-for-mwc-node-api/7696). +::: + + +## `OwnerRpc` + +The `OwnerRpc` trait in the `mwc_api` crate defines the interface for the Owner JSON-RPC API, enabling comprehensive node management operations such as retrieving status, validating the chain, and managing peers. + +### Overview + +Implementing the `OwnerRpc` trait facilitates the creation of an Owner JSON-RPC API, which is accessible when running `mwc` with default settings. The V2 API is available at `localhost:3413/v2/owner`, supporting POST operations with JSON-RPC requests as the body. + +### Required Methods + +The `OwnerRpc` trait mandates the implementation of the following methods: + +- `get_status`: Retrieves the current status of the node. +- `validate_chain`: Validates the blockchain. +- `compact_chain`: Compacts the blockchain to save space. +- `reset_chain_head`: Resets the chain head to a specific block. +- `invalidate_header`: Invalidates a specific block header. +- `get_peers`: Retrieves information about peers. +- `get_connected_peers`: Retrieves information about currently connected peers. +- `ban_peer`: Bans a specific peer. +- `unban_peer`: Unbans a specific peer. + +### Method Details + +#### `get_status` + +Retrieves the current status of the node. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "get_status", + "id": 1, + "params": [] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "protocol_version": "2", + "user_agent": "MW/Mwc 2.x.x", + "connections": "8", + "tip": { + "height": 371553, + "last_block_pushed": "00001d1623db988d7ed10c5b6319360a52f20c89b4710474145806ba0e8455ec", + "prev_block_to_last": "0000029f51bacee81c49a27b4bc9c6c446e03183867c922890f90bb17108d89f", + "total_difficulty": 1127628411943045 + }, + "sync_status": "header_sync", + "sync_info": { + "current_height": 371553, + "highest_height": 0 + } + } + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "get_status", + "id": 1, + "params": [] +}' +``` + +--- + +#### `validate_chain` + +Validates the blockchain. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "validate_chain", + "id": 1, + "params": [true] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "validate_chain", + "id": 1, + "params": [true] +}' +``` + +--- + +#### `compact_chain` + +Compacts the blockchain to save space. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "compact_chain", + "id": 1, + "params": [] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "compact_chain", + "id": 1, + "params": [] +}' +``` + +--- + +#### `reset_chain_head` + +Resets the chain head to a specific block. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "reset_chain_head", + "id": 1, + "params": ["00001d1623db988d7ed10c5b6319360a52f20c89b4710474145806ba0e8455ec"] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "reset_chain_head", + "id": 1, + "params": ["00001d1623db988d7ed10c5b6319360a52f20c89b4710474145806ba0e8455ec"] +}' +``` + +--- + +#### `invalidate_header` + +Invalidates a specific block header. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "invalidate_header", + "id": 1, + "params": ["00001d1623db988d7ed10c5b6319360a52f20c89b4710474145806ba0e8455ec"] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "invalidate_header", + "id": 1, + "params": ["00001d1623db988d7ed10c5b6319360a52f20c89b4710474145806ba0e8455ec"] +}' +``` + +--- + +#### `get_peers` + +Retrieves information about peers. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "get_peers", + "id": 1, + "params": [null] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": [ + { + "addr": "192.168.1.1:13414", + "capabilities": "FULL_NODE", + "user_agent": "MW/Mwc 2.x.x", + "last_seen": "2024-11-24T12:00:00Z", + "ban_reason": null, + "is_banned": false + }, + { + "addr": "192.168.1.2:13414", + "capabilities": "FULL_NODE", + "user_agent": "MW/Mwc 2.x.x", + "last_seen": "2024-11-24T12:01:00Z", + "ban_reason": null, + "is_banned": false + } + ] + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "get_peers", + "id": 1, + "params": [null] +}' +``` + +--- + +#### `get_connected_peers` + +Retrieves information about currently connected peers. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "get_connected_peers", + "id": 1, + "params": [] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": [ + { + "addr": "192.168.1.1:13414", + "capabilities": "FULL_NODE", + "user_agent": "MW/Mwc 2.x.x", + "last_seen": "2024-11-24T12:00:00Z", + "ban_reason": null, + "is_banned": false + } + ] + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "get_connected_peers", + "id": 1, + "params": [] +}' +``` + +--- + +#### `ban_peer` + +Bans a specific peer. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "ban_peer", + "id": 1, + "params": ["192.168.1.1:13414"] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "ban_peer", + "id": 1, + "params": ["192.168.1.1:13414"] +}' +``` + +--- + +#### `unban_peer` + +Unbans a specific peer. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "unban_peer", + "id": 1, + "params": ["192.168.1.1:13414"] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3413/v2/owner \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "unban_peer", + "id": 1, + "params": ["192.168.1.1:13414"] +}' +``` + +--- + +This concludes the documentation for the `OwnerRpc` trait in the `mwc_api` crate. Each method in this API provides a clear and standardized way to interact with the MWC blockchain for node and peer management. diff --git a/developers/api/stratum.md b/developers/api/stratum.md new file mode 100644 index 0000000..b4ee58f --- /dev/null +++ b/developers/api/stratum.md @@ -0,0 +1,478 @@ + +# Stratum RPC Protocol + +This document describes the current Stratum RPC protocol implemented in mwc. + +## Messages + +In this section, we detail each message and the potential response. + +### `getjobtemplate` + +A message initiated by the miner. +Miner can request a job with this message. + +#### Request + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "getjobtemplate" | +| params | null | + +Example: + +```json +{ + "id":"2", + "jsonrpc":"2.0", + "method":"getjobtemplate", + "params":null +} +``` + +The response can be of two types: + +#### OK response + +Example: + +```json +{ + "id":"0", + "jsonrpc":"2.0", + "method":"getjobtemplate", + "result":{ + "difficulty":1, + "height":13726, + "job_id":4, + "pre_pow":"00010000000000003c4d0171369781424b39c81eb39de10cdf4a7cc27bbc6769203c7c9bc02cc6a1dfc6000000005b50f8210000000000395f123c6856055aab2369fe325c3d709b129dee5c96f2db60cdbc0dc123a80cb0b89e883ae2614f8dbd169888a95c0513b1ac7e069de82e5d479cf838281f7838b4bf75ea7c9222a1ad7406a4cab29af4e018c402f70dc8e9ef3d085169391c78741c656ec0f11f62d41b463c82737970afaa431c5cabb9b759cdfa52d761ac451276084366d1ba9efff2db9ed07eec1bcd8da352b32227f452dfa987ad249f689d9780000000000000b9e00000000000009954" + } +} +``` + +#### Error response + +If the node is syncing, it will send the following message: + +| Field | Content | +| ------------- | --------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "getjobtemplate" | +| error | `{"code":-32701,"message":"Node is syncing - Please wait"}` | + +Example: + +```json +{ + "id":"10", + "jsonrpc":"2.0", + "method":"getjobtemplate", + "error":{ + "code":-32000, + "message":"Node is syncing - Please wait" + } +} +``` + + +### `job` + +A message initiated by the Stratum server. +Stratum server will send job automatically to connected miners. +The miner SHOULD interrupt current job if job_id = 0, and SHOULD replace the current job with this one after the current graph is complete. + +#### Request + +| Field | Content | +| ------------- | -------------------------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "job" | +| params | Int `difficulty`, `height`, `job_id` and string `pre_pow` | + +Example: + +```json +{ + "id":"Stratum", + "jsonrpc":"2.0", + "method":"job", + "params":{ + "difficulty":1, + "height":16375, + "job_id":5, + "pre_pow":"00010000000000003ff723bc8c987b0c594794a0487e52260c5343288749c7e288de95a80afa558c5fb8000000005b51f15f00000000003cadef6a45edf92d2520bf45cbd4f36b5ef283c53d8266bbe9aa1b8daaa1458ce5578fcb0978b3995dd00e3bfc5a9277190bb9407a30d66aec26ff55a2b50214b22cdc1f3894f27374f568b2fe94d857b6b3808124888dd5eff7e8de7e451ac805a4ebd6551fa7a529a1b9f35f761719ed41bfef6ab081defc45a64a374dfd8321feac083741f29207b044071d93904986fa322df610e210c543c2f95522c9bdaef5f598000000000000c184000000000000a0cf" + } +} +``` + +#### Response + +No response is required for this message. + + +### `keepalive` + +A message initiated by the miner in order to keep the connection alive. + +#### Request + +| Field | Content | +| ------------- | ---------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "keepalive" | +| params | null | + +Example: + +```json +{ + "id":"2", + "jsonrpc":"2.0", + "method":"keepalive", + "params":null +} +``` + +#### Response + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "keepalive" | +| result | "ok" | +| error | null | + +Example: + +```json +{ + "id":"2", + "jsonrpc":"2.0", + "method":"keepalive", + "result":"ok", + "error":null +} +``` + + +### `login` + +A message initiated by the miner. +Miner can log in on a mwc Stratum server with a login, password and agent (usually statically set by the miner program). + +#### Request + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "login" | +| params | Strings: login, pass and agent | + +Example: + +```json + +{ + "id":"0", + "jsonrpc":"2.0", + "method":"login", + "params":{ + "login":"login", + "pass":"password", + "agent":"mwc-miner" + } +} + +``` + +The response can be of two types: + +#### OK response + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "login" | +| result | "ok" | +| error | null | + +Example: + +```json +{ + "id":"1", + "jsonrpc":"2.0", + "method":"login", + "result":"ok", + "error":null +} +``` + +#### Error response + +Not yet implemented. Should return error -32500 "Login first" when login is required. + + +### `status` + +A message initiated by the miner. +This message allows a miner to get the status of its current worker and the network. + +#### Request + +| Field | Content | +| ------------- | ---------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "status" | +| params | null | + +Example: + +```json +{ + "id":"2", + "jsonrpc":"2.0", + "method":"status", + "params":null +} +``` + +#### Response + +The response is the following: + +| Field | Content | +| ------------- | -------------------------------------------------------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "status" | +| result | String `id`. Integers `height`, `difficulty`, `accepted`, `rejected` and `stale` | +| error | null | + +Example: + +```JSON +{ + "id":"5", + "jsonrpc":"2.0", + "method":"status", + "result":{ + "id":"5", + "height":13726, + "difficulty":1, + "accepted":0, + "rejected":0, + "stale":0 + }, + "error":null +} +``` + + +### `submit` + +A message initiated by the miner. +When a miner find a share, it will submit it to the node. + +#### Request + +The miner submit a solution to a job to the Stratum server. + +| Field | Content | +| ------------- | --------------------------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| params | Int `edge_bits`,`nonce`, `height`, `job_id` and array of integers `pow` | + +Example: + +```json +{ + "id":"0", + "jsonrpc":"2.0", + "method":"submit", + "params":{ + "edge_bits":29, + "height":16419, + "job_id":0, + "nonce":8895699060858340771, + "pow":[ + 4210040,10141596,13269632,24291934,28079062,84254573,84493890,100560174,100657333,120128285,130518226,140371663,142109188,159800646,163323737,171019100,176840047,191220010,192245584,198941444,209276164,216952635,217795152,225662613,230166736,231315079,248639876,263910393,293995691,298361937,326412694,330363619,414572127,424798984,426489226,466671748,466924466,490048497,495035248,496623057,502828197, 532838434 + ] + } +} +``` + + +The response can be of three types. + +#### OK response + +The share is accepted by the Stratum but is not a valid cuck(at)oo solution at the network target difficulty. + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| result | "ok" | +| error | null | + +Example: + +```json +{ + "id":"2", + "jsonrpc":"2.0", + "method":"submit", + "result":"ok", + "error":null +} +``` + +#### Blockfound response + +The share is accepted by the Stratum and is a valid cuck(at)oo solution at the network target difficulty. + +| Field | Content | +| ------------- | ------------------------------ | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| result | "block - " + hash of the block | +| error | null | + +Example: + +```json +{ + "id":"6", + "jsonrpc":"2.0", + "method":"submit", + "result":"blockfound - 23025af9032de812d15228121d5e4b0e977d30ad8036ab07131104787b9dcf10", + "error":null +} +``` + +#### Error response + +The error response can be of two types: stale and rejected. + +**Stale share error response** + +The share is a valid solution to a previous job not the current one. + +| Field | Content | +| ------------- | --------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| error | `{"code":-32503,"message":"Solution submitted too late"}` | + +Example: + +```JSON +{ + "id":"5", + "jsonrpc":"2.0", + "method":"submit", + "error":{ + "code":-32503, + "message":"Solution submitted too late" + } +} +``` + +**Rejected share error responses** + +Two possibilities: the solution cannot be validated or the solution is of too low difficulty. + +**Failed to validate solution error** + +The submitted solution cannot be validated. + +| Field | Content | +| ------------- | --------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| error | `{"code":-32502,"message":"Failed to validate solution"}` | + +Example: + +```JSON +{ + "id":"5", + "jsonrpc":"2.0", + "method":"submit", + "error":{ + "code":-32502, + "message":"Failed to validate solution" + } +} +``` + +**Share rejected due to low difficulty error** + +The submitted solution is of too low difficulty. + +| Field | Content | +| ------------- | ---------------------------------------------------------------- | +| id | ID of the request | +| jsonrpc | "2.0" | +| method | "submit" | +| error | `{"code":-32501,"message":"Share rejected due to low difficulty"}` | + +Example: + +```JSON +{ + "id":"5", + "jsonrpc":"2.0", + "method":"submit", + "error":{ + "code":-32501, + "message":"Share rejected due to low difficulty" + } +} +``` + +## Error Messages + +mwc Stratum protocol implementation contains the following error message: + +| Error code | Error Message | +| ----------- | -------------------------------------- | +| -32000 | Node is syncing - please wait | +| -32500 | Login first | +| -32501 | Share rejected due to low difficulty | +| -32502 | Failed to validate solution | +| -32503 | Solution Submitted too late | +| -32600 | Invalid Request | +| -32601 | Method not found | + +## Miner behavior + +Miners SHOULD, MAY or MUST respect the following rules: + +- Miners SHOULD randomize the job nonce before starting +- Miners MUST continue mining the same job until the server sends a new one, though a miner MAY request a new job at any time +- Miners MUST NOT send an rpc response to a job request from the server +- Miners MAY set the RPC "id" and expect responses to have that same id +- Miners MAY send a keepalive message +- Miners MAY send a login request (to identify which miner finds shares / solutions in the logs), the login request MUST have all 3 params. +- Miners MUST return the supplied job_id with submit messages. + +## Reference Implementation + +The current reference implementation is available at [mimblewimble/mwc-miner](https://github.com/mimblewimble/mwc-miner/blob/master/src/bin/client.rs). \ No newline at end of file diff --git a/developers/api/wallet.md b/developers/api/wallet.md new file mode 100644 index 0000000..6c4a976 --- /dev/null +++ b/developers/api/wallet.md @@ -0,0 +1,400 @@ + +# Wallet API + +The [wallet API](https://docs.rs/mwc_wallet_api/latest/mwc_wallet_api/) uses JSON-RPC requests and is split into two separate blocks of functionality: + +* [Owner API](https://docs.rs/mwc_wallet_api/latest/mwc_wallet_api/struct.Owner.html) +* [Foreign API](https://docs.rs/mwc_wallet_api/latest/mwc_wallet_api/struct.Foreign.html) + +Basic auth passwords: +Username: `mwcmain` +Password: `.api_secret`. + + + + + + +## Foreign API + +Implementing the `ForeignRpc` trait allows for the creation of a Foreign JSON-RPC API, which is accessible when running `mwc-wallet listen` with default settings. The V2 API is available at `localhost:3415/v2/foreign`, supporting only POST operations with the JSON-RPC request as the body. + +## Required Methods + +The `ForeignRpc` trait mandates the implementation of the following methods: + +- `check_version`: Checks the version of the Foreign API. +- `get_proof_address`: Retrieves the proof address. +- `build_coinbase`: Constructs a coinbase transaction. +- `verify_slate_messages`: Verifies messages within a slate. +- `receive_tx`: Receives a transaction slate. +- `finalize_invoice_tx`: Finalizes an invoice transaction. +- `receive_swap_message`: Processes a swap message. +- `marketplace_message`: Handles a marketplace message. + +## Method Details + +### `check_version` + +Checks the version of the Foreign API. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "check_version", + "id": 1, + "params": [] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "foreign_api_version": 2, + "supported_slate_versions": [ + "SP", + "V3B", + "V3", + "V2" + ] + } + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "check_version", + "id": 1, + "params": [] +}' +``` + +--- + +### `get_proof_address` + +Retrieves the proof address. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "get_proof_address", + "id": 1, + "params": [] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": "fffqrotuelaodwjblwmifg36xjedjw4azbwvfexmxmmzsb6xvzbkhuqd" + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "get_proof_address", + "id": 1, + "params": [] +}' +``` + +--- + +### `build_coinbase` + +Constructs a coinbase transaction. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "build_coinbase", + "id": 1, + "params": [ + { + "fees": 0, + "height": 0, + "key_id": null + } + ] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "kernel": { + "excess": "08dfe86d732f2dd24bac36aa7502685221369514197c26d33fac03041d47e4b490", + "excess_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be02fa098c54c9bf638e0ee1ad5eb896caa11565f632be7b9cd65643ba371044f", + "features": "Coinbase" + }, + "key_id": "0300000000000000000000000400000000", + "output": { + "commit": "08fe198e525a5937d0c5d01fa354394d2679be6df5d42064a0f7550c332fce3d9d", + "features": "Coinbase", + "proof": "9d8488fcb43c9c0f683b9ce62f3c8e047b71f2b4cd94b99a3c9a36aef3bb8361ee17b4489eb5f6d6507250532911acb76f18664604c2ca4215347a5d5d8e417d00ca2d59ec29371286986428b0ec1177fc2e416339ea8542eff8186550ad0d65ffac35d761c38819601d331fd427576e2fff823bbc3faa04f49f5332bd4de46cd4f83d0fd46cdb1dfb87069e95974e4a45e0235db71f5efe5cec83bbb30e152ac50a010ef4e57e33aabbeb894b9114f90bb5c3bb03b009014e358aa3914b1a208eb9d8806fbb679c256d4c1a47b0fce3f1235d58192cb7f615bd7c5dab48486db8962c2a594e69ff70029784a810b4eb76b0516805f3417308cda8acb38b9a3ea061568f0c97f5b46a3beff556dc7ebb58c774f08be472b4b6f603e5f8309c2d1f8d6f52667cb86816b330eca5374148aa898f5bbaf3f23a3ebcdc359ee1e14d73a65596c0ddf51f123234969ac8b557ba9dc53255dd6f5c0d3dd2c035a6d1a1185102612fdca474d018b9f9e81acfa3965d42769f5a303bbaabb78d17e0c026b8be0039c55ad1378c8316101b5206359f89fd1ee239115dde458749a040997be43c039055594cab76f602a0a1ee4f5322f3ab1157342404239adbf8b6786544cd67d9891c2689530e65f2a4b8e" + } + } + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "build_coinbase", + "id": 1, + "params": [ + { + "fees": 0, + "height": 0, + "key_id": null + } + ] +}' +``` + + +### `verify_slate_messages` + +Verifies messages within a slate. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "verify_slate_messages", + "id": 1, + "params": [ + { + "version": 2, + "id": "some-slate-id" + } + ] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": true + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "verify_slate_messages", + "id": 1, + "params": [ + { + "version": 2, + "id": "some-slate-id" + } + ] +}' +``` + +--- + +### `receive_tx` + +Receives a transaction slate. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "receive_tx", + "id": 1, + "params": [ + { + "slate": { + "id": "some-slate-id", + "amount": 1000000, + "fee": 10000 + }, + "dest_acct_name": null, + "message": "Transaction message" + } + ] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "id": "some-slate-id", + "amount": 1000000, + "fee": 10000 + } + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "receive_tx", + "id": 1, + "params": [ + { + "slate": { + "id": "some-slate-id", + "amount": 1000000, + "fee": 10000 + }, + "dest_acct_name": null, + "message": "Transaction message" + } + ] +}' +``` + +--- + +### `finalize_invoice_tx` + +Finalizes an invoice transaction. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "finalize_invoice_tx", + "id": 1, + "params": [ + { + "slate": { + "id": "some-invoice-id", + "amount": 500000 + } + } + ] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "id": "some-invoice-id", + "amount": 500000 + } + } +} +``` + +**cURL Example:** + +```bash +curl -X POST http://localhost:3415/v2/foreign \ +-H "Content-Type: application/json" \ +-d '{ + "jsonrpc": "2.0", + "method": "finalize_invoice_tx", + "id": 1, + "params": [ + { + "slate": { + "id": "some-invoice-id", + "amount": 500000 + } + } + ] +}' +``` + +--- + +### `receive_swap_message` + +Processes a swap message. + +**JSON-RPC Example:** + +```json +{ + "jsonrpc": "2.0", + "method": "receive_swap_message", + "id": 1, + "params": [ + { + "message": "some-swap-message" + } + ] +} +``` + +**Expected Response:** + +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": true + } +} +``` diff --git a/nodes/introduction.md b/developers/commands.md similarity index 100% rename from nodes/introduction.md rename to developers/commands.md diff --git a/developers/get-started.md b/developers/get-started.md new file mode 100644 index 0000000..45e605e --- /dev/null +++ b/developers/get-started.md @@ -0,0 +1,58 @@ +# MimbleWimbleCoin (MWC) Mining Overview + +## Introduction + +MimbleWimbleCoin (MWC) is a privacy-oriented cryptocurrency that implements the MimbleWimble protocol. The protocol allows for increased privacy, scalability, and fungibility by structuring transactions in a way that avoids much of the redundancy found in traditional blockchain systems. MWC aims to provide users with a decentralized, secure, and private means of transaction. + +## Why Mine MWC? + +Mining MWC not only helps secure the network but also rewards miners with MWC coins for their efforts in validating transactions and creating new blocks. It's a way to support the network's growth while earning cryptocurrency. + +## Prerequisites for Mining MWC + +Before you start mining MWC, ensure you have the following: + +- **A compatible hardware setup**: Ideally, a powerful GPU as MWC mining is GPU-optimized. +- **Mining software**: There are multiple mining software options available that support MWC. +- **An MWC wallet**: To store the MWC rewards you earn from mining. +- **Stable internet connection**: Mining requires a constant connection to the internet. +- **Membership in a mining pool** (optional): While solo mining is possible, joining a mining pool can offer more consistent rewards. + +## Recommended Mining Software + +Several mining software options support MWC. Some popular choices include: + +### GPU Mining Software +- **Gminer** +- **lolMiner** +- **MWCMiner** + +### Asics Machine +- **G1-Mini - Ipollo** +- **G1 - Ipollo** + +Ensure you download the software from the official or a reputable source to avoid malicious programs. + +## Getting Started with Mining MWC + +1. **Choose Your Mining Approach**: Decide whether you want to mine solo or join a mining pool. Mining solo might yield larger rewards per block, but they will be infrequent. Mining pools offer more consistent, but smaller, rewards. + +2. **Set Up Your Mining Software**: Follow the installation and setup instructions provided by your chosen mining software. This wsill typically involve extracting the software to a folder and editing a `.bat` file to include your wallet address and, if applicable, your pool's information. + +3. **Start Mining**: Run the mining software. If configured correctly, it should start communicating with the MWC network or your mining pool and begin mining. + +4. **Monitor Your Mining Activity**: Keep an eye on your mining software's dashboard or your mining pool's website to track your mining progress and earnings. + +## Tips for Successful Mining + +- **Stay Updated**: Keep your mining software and drivers up to date to maintain optimal mining efficiency. +- **Monitor Your Hardware**: Ensure your mining setup is in a cool, ventilated area to prevent overheating. +- **Consider Electricity Costs**: Mining consumes a lot of power. Make sure the cost of electricity does not negate your mining rewards. + +## Conclusion + +Mining MWC can be a rewarding way to participate in the cryptocurrency ecosystem. By ensuring you have the right setup and approach, you can start mining and contributing to the security of the network, while earning MWC as a reward for your efforts. + +Remember, the world of cryptocurrency mining is always evolving, so stay informed about the latest mining strategies and technologies to maximize your mining efforts. + +Happy mining! diff --git a/developers/integration.md b/developers/integration.md new file mode 100644 index 0000000..4da71dc --- /dev/null +++ b/developers/integration.md @@ -0,0 +1,648 @@ +# Integration + +The integration of the **MWC** into various systems or processes revolves around two core workflows: **Send** and **Receive**. These workflows ensure smooth, privacy-focused, and efficient transactions within the MWC ecosystem. + + +## Prerequisites + +Before you can successfully integrate the MWC (Grin Wallet) workflows, certain prerequisites must be met. These prerequisites ensure that the necessary infrastructure and configurations are in place for seamless transactions. + +**Software Requirements** +- **MWC Wallet Installation and setup** + - Download and install the official MWC (Grin Wallet) from the [official Grin website](https://grin.mw) or the official GitHub repository. + - Ensure you download the latest stable version for compatibility and security. + +- **Grin Node Setup** + - A Grin node is required to synchronize with the blockchain. + - The wallet interacts with this node to validate and broadcast transactions. + - The node must be fully synced before conducting transactions. + +## Workflow + +Ensure your MWC node is synced and running, and start the mwc-wallet listener in both Owner and Foreign modes to enable transaction handling and internal operations. For detailed instructions, refer to the below documentation: +- Node +- Wallet + +::: info +The MWC Python SDK provides an efficient way to interact with the MWC Wallet API for handling transactions programmatically. It simplifies integration by offering methods for managing the Owner API and Foreign API, such as transaction creation, finalization, and querying wallet balances. The SDK supports features like: + +Owner API: Internal wallet operations such as initiating transactions, retrieving balance, and managing keys. +Foreign API: External interactions for receiving and finalizing transactions. +::: + +## Sender Workflow + +The **Sender Workflow** is responsible for initiating, encoding, and finalizing the transaction. + +### **Step 1: Initiate Transaction** + +The sender creates a transaction slate by calling the method [init_send_tx](https://docs.rs/mwc_wallet_api/5.3.4/mwc_wallet_api/trait.OwnerRpcV3.html#tymethod.init_send_tx) + +`init_send_tx` + +| Parameter | Type | Description | +|------------------------------|----------|--------------------------------------------------------------------------| +| `token` | String | API token for authentication. | +| `amount` | Integer | Amount to send in micro-MWC (e.g., `500000000` for 0.5 MWC). | +| `minimum_confirmations` | Integer | Minimum confirmations for inputs (e.g., `500`). | +| `max_outputs` | Integer | Maximum outputs to use (e.g., `500`). | +| `num_change_outputs` | Integer | Number of change outputs (e.g., `1`). | +| `selection_strategy_is_use_all` | Boolean | Whether to use all available inputs (`true` or `false`). | +| `target_slate_version` | Integer | Slate version to use (e.g., `4`). | + + +::: details Request Example +```JSON +{ + "jsonrpc": "2.0", + "id": 1, + "method": "init_send_tx", + "params": { + "token": "ebff5ec5aa1d170558510b48aa278357f5c99f28bda846402ea5025b14e8298a", + "args": { + "src_acct_name": null, + "amount": 500000000, + "minimum_confirmations": 500, + "max_outputs": 500, + "num_change_outputs": 1, + "selection_strategy_is_use_all": false, + "target_slate_version": 4, + "payment_proof_recipient_address": null, + "ttl_blocks": null, + "send_args": null + } + } +} +``` +::: +::: details Ok Response +```JSON +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": "500000000", + "coin_type": "mwc", + "compact_slate": true, + "fee": "8000000", + "height": "2621642", + "id": "09d67b19-6105-4182-901b-cb55f8cdff41", + "lock_height": "0", + "network_type": "mainnet", + "num_participants": 2, + "participant_data": [ + { + "id": "0", + "message": null, + "message_sig": null, + "part_sig": null, + "public_blind_excess": "02ebbdb95cdd8a7040585128df651cce8617fa6c9a585522bf09aa0d18061a1028", + "public_nonce": "02057bd954e51dbfc5acaf3a0962e653a3312595eb0a811321d159ccc261bbdf9a" + } + ], + "payment_proof": null, + "ttl_cutoff_height": null, + "tx": { + "body": { + "inputs": [ + { + "commit": "08453eec87fe3038989739b2615e2ce2c227fea7780dec15322ace5b9281177b0a", + "features": "Plain" + } + ], + "kernels": [ + { + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "8000000", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "09162702cb78cb9e857952a0ccabb0b0c705cda5a1f7f30b8e66efc211056927ef", + "features": "Plain", + "proof": "4fa97f7876101111302f1c0d681a180ee0a08a21db85f2ea845bf192563a809a4a384a401b44f7713757b6cfcaa90735a145f6637f4c792310159565ed037aee09675f908a3b1015acdaa8eaf0a596b76b1ca697b57ff91bfa4f3b5bf53f914c540042d2407497958b90f95670471fb2a22e9203ec3f3c80b7ed2d8bdda818cdea999aa8360b1146a8cddad1a3c24a81f7eb21fbc7f2ea307148da0ee51b151027c20739e44e4fc0cdd26c196ddfd96d2eee31ffb032f9ee325d7e5fc94ac8f62d808d44651eaf6d193c51561c3b34dddbd0b166cf3b8caaacf7b06b1fcea76fa3fd3e3bfcc55d74fa9190e5f8fb2af3262751e917651ca001ee90b273794b3d592ac1c9f1e6c5d5723a8f96a55dd5cfc584f5396d6b40aeebdc247c8ad168f8078ecab4d557bc57f006fb9dac5a981805963454ad58d623bbe7766e5f1794600defea588a2f2783d8d086a83c10ec6ecc64ea9da5b7c800c14cf97303c72b692861027881d801a24434f4630963138aa83d0ee2591aec430ba16a54ff2a2299558a16256010a4b411620dc4c9f334a49676c1fc4e21153db5e9a81ba03bb7791644684c6cd0205bdc83221be7986f766ee635b1ee8075dec0dfd4da43469f81358201846c37c3fc326b34a982ffa02b5782a1f6c705c5283e44bbc66f0995249d77ead0e90ae97608491191f47a09e4d670509b615143bfff484b19756f0892d0742354a601eed0325790b2c25f108d1bf554dd07a2f6f98920f1eabad1bf0b3875146b6c581332d50fb483f54e28ce0f934f90ea6f7644e15d32d7453453d7af7ba3255132506b66dc9353c858c154dd901e0ed47bd247543edafe7777f7291117f39371f62bb0d495b6501dea41e046f8dc0b16d95d80c3808ad205c22ded65fb985017484f1006ad359dc37eb97f021cf2f661ca34dcdee9fb354d9abb820991b2" + } + ] + }, + "offset": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "version_info": { + "block_header_version": 2, + "orig_version": 3, + "version": 3 + } + } + } +} +``` +::: + + +### **Step 2: Encode Slatepack** + +The transaction slate is encoded into a Slatepack message for sharing with the recipient using [encode_slatepack_message](https://docs.rs/mwc_wallet_api/5.3.4/mwc_wallet_api/trait.OwnerRpcV3.html#tymethod.encode_slatepack_message). + +`encode_slatepack_message` + +| Parameter | Type | Description | +|------------------|---------|------------------------------------------------------------------------| +| `token` | String | API token for authentication. | +| `slate` | Object | The slate object returned from `init_send_tx`. | +| `content` | String | The content type of the Slatepack (e.g., `SendInitial`). | +| `recipient` | String | Optional. Recipient’s address for payment proof (if required). | +| `address_index` | Integer | Optional. Index of the sender's address for the Slatepack. | + +--- +::: details Request Example +```JSON +{ + "jsonrpc": "2.0", + "id": 1, + "method": "encode_slatepack_message", + "params": { + "token": "ebff5ec5aa1d170558510b48aa278357f5c99f28bda846402ea5025b14e8298a", + "slate": { + "amount": "500000000", + "coin_type": "mwc", + "compact_slate": true, + "fee": "8000000", + "height": "2621642", + "id": "09d67b19-6105-4182-901b-cb55f8cdff41", + "lock_height": "0", + "network_type": "mainnet", + "num_participants": 2, + "participant_data": [ + { + "id": "0", + "message": null, + "message_sig": null, + "part_sig": null, + "public_blind_excess": "02ebbdb95cdd8a7040585128df651cce8617fa6c9a585522bf09aa0d18061a1028", + "public_nonce": "02057bd954e51dbfc5acaf3a0962e653a3312595eb0a811321d159ccc261bbdf9a" + } + ], + "payment_proof": null, + "ttl_cutoff_height": null, + "tx": { + "body": { + "inputs": [ + { + "commit": "08453eec87fe3038989739b2615e2ce2c227fea7780dec15322ace5b9281177b0a", + "features": "Plain" + } + ], + "kernels": [ + { + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "8000000", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "09162702cb78cb9e857952a0ccabb0b0c705cda5a1f7f30b8e66efc211056927ef", + "features": "Plain", + "proof": "4fa97f7876101111302f1c0d681a180ee0a08a21db85f2ea845bf192563a809a4a384a401b44f7713757b6cfcaa90735a145f6637f4c792310159565ed037aee09675f908a3b1015acdaa8eaf0a596b76b1ca697b57ff91bfa4f3b5bf53f914c540042d2407497958b90f95670471fb2a22e9203ec3f3c80b7ed2d8bdda818cdea999aa8360b1146a8cddad1a3c24a81f7eb21fbc7f2ea307148da0ee51b151027c20739e44e4fc0cdd26c196ddfd96d2eee31ffb032f9ee325d7e5fc94ac8f62d808d44651eaf6d193c51561c3b34dddbd0b166cf3b8caaacf7b06b1fcea76fa3fd3e3bfcc55d74fa9190e5f8fb2af3262751e917651ca001ee90b273794b3d592ac1c9f1e6c5d5723a8f96a55dd5cfc584f5396d6b40aeebdc247c8ad168f8078ecab4d557bc57f006fb9dac5a981805963454ad58d623bbe7766e5f1794600defea588a2f2783d8d086a83c10ec6ecc64ea9da5b7c800c14cf97303c72b692861027881d801a24434f4630963138aa83d0ee2591aec430ba16a54ff2a2299558a16256010a4b411620dc4c9f334a49676c1fc4e21153db5e9a81ba03bb7791644684c6cd0205bdc83221be7986f766ee635b1ee8075dec0dfd4da43469f81358201846c37c3fc326b34a982ffa02b5782a1f6c705c5283e44bbc66f0995249d77ead0e90ae97608491191f47a09e4d670509b615143bfff484b19756f0892d0742354a601eed0325790b2c25f108d1bf554dd07a2f6f98920f1eabad1bf0b3875146b6c581332d50fb483f54e28ce0f934f90ea6f7644e15d32d7453453d7af7ba3255132506b66dc9353c858c154dd901e0ed47bd247543edafe7777f7291117f39371f62bb0d495b6501dea41e046f8dc0b16d95d80c3808ad205c22ded65fb985017484f1006ad359dc37eb97f021cf2f661ca34dcdee9fb354d9abb820991b2" + } + ] + }, + "offset": "0000000000000000000000000000000000000000000000000000000000000000" + }, + "version_info": { + "block_header_version": 2, + "orig_version": 3, + "version": 3 + } + }, + "content": "SendInitial", + "recipient": null, + "address_index": 0 + } +} +``` + +::: details Ok response +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": "BEGINSLATE_BIN. 8kBm8dTRtrskDCU TRruCj5bDo56r2p o9Ux7QHP3Jk7zYz ijPWx8nxhLHzNEY oce1HTx2aCozuTM jKU9NtS82yq4Nrv qxR8YL2tJ9sxjoh deDHf4S2Rzi9bXo i9gNY4z1LAwpjHi HV. ENDSLATE_BIN." + } +} +``` +::: + + +#### tx_lock_outputs + +The sender ensures the outputs for the transaction are locked using [tx_lock_outputs](https://docs.rs/mwc_wallet_api/5.3.4/mwc_wallet_api/trait.OwnerRpcV3.html#tymethod.encode_slatepack_message). + +`encode_slatepacktx_lock_outputs_message` + +| Parameter | Type | Description | +|-------------------|--------|-------------------------------------------------------------------| +| `token` | String | API token for authentication. | +| `slate` | String | Encoded Slatepack message from `encode_slatepack_message`. | +| `participant_id` | Integer | ID of the participant locking the funds (typically `0` for sender). | + + +::: details Request Example +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "tx_lock_outputs", + "params": { + "token": "ebff5ec5aa1d170558510b48aa278357f5c99f28bda846402ea5025b14e8298a", + "slate": "BEGINSLATE_BIN. 8kBm8dTRtrskDCU TRruCj5bDo56r2p o9Ux7QHP3Jk7zYz ijPWx8nxhLHzNEY oce1HTx2aCozuTM jKU9NtS82yq4Nrv qxR8YL2tJ9sxjoh deDHf4S2Rzi9bXo i9gNY4z1LAwpjHi HV. ENDSLATE_BIN.", + "participant_id": 0 + } +} +``` +::: + +::: details Ok Response +```json +{ + "jsonrpc": "2.0", + "id": 1, + "result": { + "Ok": null + } +} +``` +::: + +we'll then return to user this text +``` +BEGINSLATE_BIN. 9ahjQefP9gsCcVt 25Po4VP34y95yxE wMmTzzckUkh1tu3 y7WwT5j1ZTL7UyC 4byFhRQM4BmhM92 Y1ukWPJ8BVdpEGU MAJUrU2YbXFLAYT tdqamYotCv4Co3z keD8RdPpX4b. ENDSLATE_BIN. +``` + + +The user on his side need to make his response. +Once he made his response slate +he should give you a slate like this + +such as this one +```json +BEGINSLATEPACK. BMPbuLeVjyFSo36 NvoGhFVYSFxK58D 7ENH2twNyFzuukP mHsGxDrNnBRg5Vd fbKWgneT6YxtUR2 nSmKgFrokk1NEYY qA5cHKVdKaRaKCA J9oX86S4ToB2GEC yHKuKQRe8mwgxn3 PnjdLhtxvuLvXaD 5G8FAqEdWF2RNy1 jAH2xaUsus2onwt 1QM8oENbqUXSSP1 rxo54eupY5ECeiP RW9NY4tM1M6DEf1 BDRhK13rkJRyBzV o2fyjddd4HftuFe d3eHyC1ZEhSxitC 3mi5CmPYzV1JmMp bjwDKGH3jonnxfr 7Ah3ysctRymaXUM 4dH1Ln6UVvD5umC nyam9s4XusiCAky x7VaZGR36MmLzyw eMHSNXBYi12hmq3 D4iouD74YEcPSKD 2JoV5YqZGueBRH4 p8c47hboNujhko2 SPqzY2LiecEfkSK CojyRCQH1C5TE2K QbqNVMniZQQjmN4 TxZNr2kx1D7GFGH CriBfZDoDyDHtYk S4bE6TqA8WGE7oA 9AM2XMoCsZpVyS9 TYTM6wAwXAPhMZU ELo5bZBpMC5GnwN 3LDyFAxuPjxj2Bw eVQNKhLNtUpcstW x1gkYDTNtQTaXyD n8s9oTE7cuJZ5YK 1oooXzP9T31Mmzf kahNCcmtEZipQVb 8e1ba7ormFGegug RS7TTutor3EfxDC yCBRZBuwxFf3Uxq B55wb7yZN53fAMm Zn8SBTxNBzuZiX8 16GyVZx9xbrcB64 krz7XigXGf7hWFd wmuvYqzj7yqson1 hrNftRpEhJbvk3h QFJd7AcxwHwJH2L GdT2xe3DAqBtW4e zgSkQjNnoPhPhii JXBZay4z4eaKBie 1J9KFb6YcXHtcsH dffsHHgXs6GQRZG 71od7BKQVzTWuwv r95CZp6kSpYMqfd G5MfFpjBcD9v9bq WvkoYPuWN6Jf7dA Sou wi2fXznZReqLmZzt TGtcahQF5iPLmTr MoE15UceR5bNMBY MAN3AzctE3Vr2fa BDmaMrpHvRCb7pw Y2QUv2R6ZoztGtW Tssap8D7KJtp3g9 fg7kByVQSceSvQE opCAtY7VACJdyag 9D2jmuXZLCawnLM cH3E7MuLqNADMcj PebyUeKE93ttcmW JYGifAGr6cS7WYC Ujwrzg9EhhfjVSd KpArBHx1wvXUzdP kZojuqo2cr7DVqD zQGfUDWGXMbHYbX UJuLtbwFnkQt7Cg rjnn4kj4HZfx7fj uLeS3VaBtMyxLGF 5yECTWgQ2HcGnSK iRDMM9dqncWR6rc 1nXYww6LfUzZxj7 WB1ioS9kAD3XZXw SQX8VZ54tvPbBJ3 pGz3q9RxdvbhcS2 cgxj8K4qCMjJfoM AxDNdcpD2gXuy79 whZfDJ4H6gYvTsp uUfQazqTD46yudj UhXn5X1tZgcExVx FwDUVMTHUTmqmjT 9iJ4Xox2K9HDytN XuJoEk7nH2DCQyi NgPGg4FTibENxZv DB22bb2FQR7W8mu 2hjsx8CWnqWJ56u oyYCXkqynhcKLtb G18knjmUYx3xjyN BVe1u5XHw8HJak5 C9goSRBv29hbf6z Mm4hH7waqL5kAVC vo3vwBrVPeA8K8X QE2JoJ8vuVCFXbM GWJRLnAiYTcUxtq i5aNtAgViPt6GRA 7K5rYdxRAeTc6Ym NZDeoGHoPKrLHwF D5cb8YB7JkmEtnR puX22WD1pagcRph uZJ8xw2gt6RQFQN ypXgHrDFv6W8HNX jNRDvFHpbrmceRR DTBPeWwdpYoTogg E7gnQE1U1ULRi3R XLJJLY5fAVKesTN HyutbMxBvJ3DUz3 CfWDXrRZgG6vQDM 8CboKtLz7dAs5Ui GTLbS5ZYXxpKQbY TXmfDW4wVNXS5G2 NA8gokJPRZ9phXt tYhDG3E9pfVK4mK 8Gmf9Mt6iPRxzvf aQkwRY81peGzJSz ZpPVXAhNFXjnENN MTW8pvTVfYH4Dxt Sabo3XdiBusHygj A8PbFAon6fCAySo jworMXbsSKrrFyA eM7whDYiZJVYFwR SJnqGPTnMtJy9pZ JzsUoTLJFUegFXr YVeHFDTcBJ3qniU Kbc9RsmRrTv512C HajdTQmdrVDR9c7 wC4wcRm7rmXTqny xMYLL6v62RhWcPz C315C3PZtXyxzke WhsCxvctHcS4Wd7 sVLRNvFsxfbN7be FkAjdTLP7oo2Aq9 6bn3GWTypxAdQyZ kWDxEaq8jcBDgR1 EpSLVeJJ7Vd4CrN PxMNvhhTdJs5nUp WzuZNfRNZhajTNZ FLgjbUTUnyk3u92 9PLbPmhSLvVZZHU Yw5PPiaKWWgx1AZ EpY2TxjvgMFRXJy CTFHhms1FAjDE7Q LNizD7TPNyCSbM2 Ha3RZHxPHt8gqSJ ZVbVpFdPJcWWNrQ ms9hr66LU144dgo KLKJedbLSg1sLMo vW8GA5e8hyCMQZG 3JqJKCXnfh7dyjP 5zNRzKYd9FdiR71 gSQBgVEVRavCpJV aXKco2M8kNWdPtw ZNgX. ENDSLATEPACK. +``` + + +you will need to call decode_slatepack_message + +```json +{ + "jsonrpc": "2.0", + "method": "decode_slatepack_message", + "params": { + "token": "d202964900000000d302964900000000d402964900000000d502964900000000", + "address_index": null, + "message": "BEGINSLATEPACK. BMPbuLeVjyFSo36 NvoGhFVYSFxK58D 7ENH2twNyFzuukP mHsGxDrNnBRg5Vd fbKWgneT6YxtUR2 nSmKgFrokk1NEYY qA5cHKVdKaRaKCA J9oX86S4ToB2GEC yHKuKQRe8mwgxn3 PnjdLhtxvuLvXaD 5G8FAqEdWF2RNy1 jAH2xaUsus2onwt 1QM8oENbqUXSSP1 rxo54eupY5ECeiP RW9NY4tM1M6DEf1 BDRhK13rkJRyBzV o2fyjddd4HftuFe d3eHyC1ZEhSxitC 3mi5CmPYzV1JmMp bjwDKGH3jonnxfr 7Ah3ysctRymaXUM 4dH1Ln6UVvD5umC nyam9s4XusiCAky x7VaZGR36MmLzyw eMHSNXBYi12hmq3 D4iouD74YEcPSKD 2JoV5YqZGueBRH4 p8c47hboNujhko2 SPqzY2LiecEfkSK CojyRCQH1C5TE2K QbqNVMniZQQjmN4 TxZNr2kx1D7GFGH CriBfZDoDyDHtYk S4bE6TqA8WGE7oA 9AM2XMoCsZpVyS9 TYTM6wAwXAPhMZU ELo5bZBpMC5GnwN 3LDyFAxuPjxj2Bw eVQNKhLNtUpcstW x1gkYDTNtQTaXyD n8s9oTE7cuJZ5YK 1oooXzP9T31Mmzf kahNCcmtEZipQVb 8e1ba7ormFGegug RS7TTutor3EfxDC yCBRZBuwxFf3Uxq B55wb7yZN53fAMm Zn8SBTxNBzuZiX8 16GyVZx9xbrcB64 krz7XigXGf7hWFd wmuvYqzj7yqson1 hrNftRpEhJbvk3h QFJd7AcxwHwJH2L GdT2xe3DAqBtW4e zgSkQjNnoPhPhii JXBZay4z4eaKBie 1J9KFb6YcXHtcsH dffsHHgXs6GQRZG 71od7BKQVzTWuwv r95CZp6kSpYMqfd G5MfFpjBcD9v9bq WvkoYPuWN6Jf7dA S2fXznZReqLmZzt TGtcahQF5iPLmTr MoE15UceR5bNMBY MAN3AzctE3Vr2fa BDmaMrpHvRCb7pw Y2QUv2R6ZoztGtW Tssap8D7KJtp3g9 fg7kByVQSceSvQE opCAtY7VACJdyag 9D2jmuXZLCawnLM cH3E7MuLqNADMcj PebyUeKE93ttcmW JYGifAGr6cS7WYC Ujwrzg9EhhfjVSd KpArBHx1wvXUzdP kZojuqo2cr7DVqD zQGfUDWGXMbHYbX UJuLtbwFnkQt7Cg rjnn4kj4HZfx7fj uLeS3VaBtMyxLGF 5yECTWgQ2HcGnSK iRDMM9dqncWR6rc 1nXYww6LfUzZxj7 WB1ioS9kAD3XZXw SQX8VZ54tvPbBJ3 pGz3q9RxdvbhcS2 cgxj8K4qCMjJfoM AxDNdcpD2gXuy79 whZfDJ4H6gYvTsp uUfQazqTD46yudj UhXn5X1tZgcExVx FwDUVMTHUTmqmjT 9iJ4Xox2K9HDytN XuJoEk7nH2DCQyi NgPGg4FTibENxZv DB22bb2FQR7W8mu 2hjsx8CWnqWJ56u oyYCXkqynhcKLtb G18knjmUYx3xjyN BVe1u5XHw8HJak5 C9goSRBv29hbf6z Mm4hH7waqL5kAVC vo3vwBrVPeA8K8X QE2JoJ8vuVCFXbM GWJRLnAiYTcUxtq i5aNtAgViPt6GRA 7K5rYdxRAeTc6Ym NZDeoGHoPKrLHwF D5cb8YB7JkmEtnR puX22WD1pagcRph uZJ8xw2gt6RQFQN ypXgHrDFv6W8HNX jNRDvFHpbrmceRR DTBPeWwdpYoTogg E7gnQE1U1ULRi3R XLJJLY5fAVKesTN HyutbMxBvJ3DUz3 CfWDXrRZgG6vQDM 8CboKtLz7dAs5Ui GTLbS5ZYXxpKQbY TXmfDW4wVNXS5G2 NA8gokJPRZ9phXt tYhDG3E9pfVK4mK 8Gmf9Mt6iPRxzvf aQkwRY81peGzJSz ZpPVXAhNFXjnENN MTW8pvTVfYH4Dxt Sabo3XdiBusHygj A8PbFAon6fCAySo jworMXbsSKrrFyA eM7whDYiZJVYFwR SJnqGPTnMtJy9pZ JzsUoTLJFUegFXr YVeHFDTcBJ3qniU Kbc9RsmRrTv512C HajdTQmdrVDR9c7 wC4wcRm7rmXTqny xMYLL6v62RhWcPz C315C3PZtXyxzke WhsCxvctHcS4Wd7 sVLRNvFsxfbN7be FkAjdTLP7oo2Aq9 6bn3GWTypxAdQyZ kWDxEaq8jcBDgR1 EpSLVeJJ7Vd4CrN PxMNvhhTdJs5nUp WzuZNfRNZhajTNZ FLgjbUTUnyk3u92 9PLbPmhSLvVZZHU Yw5PPiaKWWgx1AZ EpY2TxjvgMFRXJy CTFHhms1FAjDE7Q LNizD7TPNyCSbM2 Ha3RZHxPHt8gqSJ ZVbVpFdPJcWWNrQ ms9hr66LU144dgo KLKJedbLSg1sLMo vW8GA5e8hyCMQZG 3JqJKCXnfh7dyjP 5zNRzKYd9FdiR71 gSQBgVEVRavCpJV aXKco2M8kNWdPtw ZNgX. ENDSLATEPACK." + }, + "id": 1 +} +``` + +::: details Ok Response +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "content": "SendResponse", + "recipient": { + "public_key": "fffqrotuelaodwjblwmifg36xjedjw4azbwvfexmxmmzsb6xvzbkhuqd", + "domain": "", + "port": null + }, + "sender": { + "public_key": "7rky2tvk763cq5kvhyxv7zkjxfytmao3qttqvoc6fsiawo4kzgii7bqd", + "domain": "", + "port": null + }, + "slate": { + "amount": "0", + "coin_type": "mwc", + "compact_slate": true, + "fee": "0", + "height": "5", + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": "0", + "network_type": "automatedtests", + "num_participants": 2, + "participant_data": [ + { + "id": "1", + "message": null, + "message_sig": null, + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bb9128fbee3070329b28c635090138e2b78fe1fbb840117b2f65777508179be0a", + "public_blind_excess": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "payment_proof": null, + "ttl_cutoff_height": null, + "tx": { + "body": { + "inputs": [], + "kernels": [ + { + "excess": "08e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "0", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "082967b3fe580cd110355010ef45450314fb067720db01b0e6873bb083d76708c9", + "features": "Plain", + "proof": "828bb24121aa0332c872062a42a8333c3ef81f8ae37d24053d953217368b3cada90410a50509a0b9fcbb5aded41397fc00ca1ff5acdac20d48afb0a3281d21e7026d32fdc6c5157461a35f98a809ffa09187c1e170ea24652ad213b7e4c9878654ac3dd9a8915eaf742db53182fcb42d2d341fbdfe8bd31bd001f4ff2c1ca9f9b1531da29137214f211edb7a5eb8f494cb8945f8527dd25bf7e698515043db4249540720008a708db5342230d05b069c094688ccb7c07d4a4a2293ea76cf999c555dc0ddc757891c360db1901bbb4dc20cae997f875f8de482d8160e05d60f9b0135e0fc313d8f953db78f1ea252449dd81cfa22dd895512ed39d566f0924542b543d25fc9fc7a819d228f3b0ee5e381f088f54893e86437dafc49dd923b3e6dff956ca843f951910379531fac9bb5fd01a182dd32a4c597f92da3c01af37cb9b0ec984500884438e74e54d7e76fa1ae7241d5050b13376310b24761634a6f6eb7cf000082f50ed7c1899d7918023d4f877586f964932a7af72e7a4984ddecfdd1921a2e1b80b00d6bd2e64a3f4cb6915a27a8d17a69d163cf45220a13fcddd15dc2bb91ae4f1b6a67224ab3b23e8d7d785df178ec78a84cf42cea086426f563822c8a4271a0b89bb21f84b643dbf1de21b6395039d673a376492767199fa36ccd9a13628ce61695424091acc16059450d59bc59fa7879e7306f5727217211b0264a6a560f886d520e41406ef45b1668805b88d246c5b2ca5a1762042c85be34fcd420ac3843f32236d079b4bd57d6b8d8013d9d18f8efb55e8e443cd9e1af9b144e7a56c8c6be0138af3b4a6c99bee9109bed2bce2e5145e736b125a2ec19aaf3fff713f6897fdd4158ce2ab04706b062ca2847bf70259c0fc4b0d390dc7fdaf0362047f775a912bd22da9d40f04d9790bcd5ece4b36b74c6c340b48c2926b916e8a9" + }, + { + "commit": "096e1669267c22ecb38c466d73b8578261d8e91c14dd66702dd5bf34f4232e10db", + "features": "Plain", + "proof": "7d567b0895a1103d19446929da8b98f2086819507ddce4b9dbb5ce6327107744e74aba59ef1834937da1b86eb7c1c1b0bc11d1c5d5ec79d25bc1e52aed1656f60d46f6878ba5ca8639efdbb9203e378e91171c11527c4a34713f06dc22f58ca4a08e68d83ff897e61cfc145fe376fa428b55e25cf20d15f10b9054778229798b30fb4e45d817a5053b682dcf591481a3c8174cfbba81e31aa525d5b884ca7a016713178f26c0fe8ae1f88b5382f8e70c4d91fb3828c0f307d828aa028281d3551525e68d20827ab0e6785c6b5747e895dcd38429b44e62b7f6c1c921d87ae954a9dd6e967ac52e6cd13a1d4bb2f1434da25a0723ef9c869cc573019577552dd0e0f808f8cc57723b041320025f6433779fe907998a4ec7606bf884b2199253b502065bed8e0625c2df858d6508c1aa44deddc68d06d00d81e97720e23e15a3464ed4733fc547e9fb772e563a1dbcd27ac55e40f674f9006e7dd4465444f3eb7527cb01905dee69a51cf2fc1810c861dd0834e7649d594c3e1740d85343a6b63c8a9e0a0f63059031899b38dfd9a192034d54029bd35e683ccab46282519b26cae20d398b754357abe1cf0370890f2897b5d8ada4fb3da777a8f8f1daa4197a380e6734504117dd2a92ea1917f174c44c59e0b50c6b7a5f9eb14e6d96cb6b3e5dbcb3d0eaf0e4aac1b6616d674bb708b7559e37de608e8a828bee7f25f627e2f06d9a87e8d651ade39e1e65db7204b94abc0b7ca6fdd75aadeeac6a876b6297e38039734ebdfa9a555152b4293cb00e423a66d64f827afa4748dd6fdc1dc33332bffb820dacbf5a6d347042db985bbd9cf476dceb45d6978035ba03d25612243fc164c0a902017ce7ffd632d041fa3c56554739e78c6d725ecbfdaa0739d3649239fb53294b7a46ee6ed403bf3815f6c78f06a8ca4e3c9b066234f7574fb6ea8f17d199" + } + ] + }, + "offset": "97e0fccd0b805d10065a4f8ca46aa6cc73f0962e829c7f13836e2c8371da6293" + }, + "version_info": { + "block_header_version": 1, + "orig_version": 3, + "version": 3 + } + } + } + } +} +``` +::: +you can optionali decode the slapack +you will need to call finalize_tx + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "decode_slatepack_message", + "params": { + "token": "9ad802ba3f3288d434b28bce9102aff35e953c4239cfd76c64ad2ac23202c0cf", + "message": "BEGINSLATE_BIN. usqHiSmrwTbxJD1 BKq9tdQUBJCLmRF unXjpYfGsr1hDhH XQSGvUyUKrGPttp dfMqT2LyGtDiSbJ LBaLwqyamCRQ6ga 4SyMzhP1D4CuTpr PjXwfvXqzZiEB4R LAKt3pe9WSPcBSK MuF6Dw9Y4mDJpka zkZ8uDRM4sUzhk8 SDk3ZY5FeeEoPG8 ug7miFxCZKCfMn7 8G2hf7KLobevDeX yQHV5Jja7vRH9kx sQ6PsUN2518EJm2 kc8wtAoHyP6KQTg znNkxvdJ6aXzvEU 5BL9UqS7x2d3U1B aunvhgyEVfE3LXk 7BMp8yPrzF3BBHX KJWLsftycvZwcvM eDZMREoZzMGQWNV PE37U3tEaFbHTWM hy5nNefS4TCoKCk b8WXrZUsRnHw4eX e26LQ94RQoTbXh9 9veAK2ECuU9ttre aK7VNEKmzE9hUea YcFdzXFkSGVcxJL J58T9vdBBUkK9PQ ncoN4aMhiwHwSfr MbJfyUQCLWwjFGY V8qiiVwMLApauyW 35fHztkvtoswH3z cZTJTn1aeYCvBt8 x3mqeMGtw6sFP7u YPEkbQx4ZbNHVaw 3AYsmFLKUS6D2rV EcCaUi3c4wjGopq yjfMh8Sw1irbxDh z55XmSSD1iqu7BV XqGRpjbdEe3ks8E TCW3GpkoDBA96Hm EDvT5d1FEFDefJU eZReffaiKAj54HA MmibCcS8ZPAfLa5 4dJkDqH9Xmquqeb Ut1gRt1HjLJ78mT GLDyMEiBWGw2RVj JNJZNxXy5PZcrfr x5D3U65hobmk7ZT 6VDKzyPNYHwhiug q9QkcmKVTYwUoDT LhhXJCvw3oyNmVP GvWThjWpebSxjsv 6LobgE59ap2NTPx eHHsfhU9fSXZMpn J389tVGkPJtotdQ DHw8rqi8JS6MX6m pdo2tFr2MdKvs5f Zq4oyFBuojGrz3S 5UZgDjK1NLUuDrG ZQJpBwYGSqFza4m 559DieAWLe38khU FmM6uqh8i2ZyEHG qNBok3kCa7JHYpt 4iA93S33PXH5CS7 VowPonFVgpAofK5 oYzopFRdmJU2DUa b1VW3ANdCtNZKpb re2W2rwoDbLP34G QiddN7u1jXWuJj9 HBREYcvGzdxk4EB FfLoMG2tWERLrct 77tnwWZhcaanXTK RDibv4S9Hs912b8 HbV5XtB8d1WJhyS w2N9L9zPzoJnHN7 LQzq7KrFiwitGaK HMURznkkrWQrHuN xbAMAoZsH1rwmwo SCsSRsw6uxHzcnL ZdADUmYCVHpMUkU HThZhVwW2xaAWBY y6MpaJoEXv15JCx swhhXNGkmm5ZRf9 L3kgVcGpjDS69kN QMCpFdswUHcj5Xu 3cKkRuV6DZ7jMLn u6kLGhxh9ECGSzt As. ENDSLATE_BIN.", + "address_index": null + } +} +``` + + +::: details Ok Response +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": "2000000000", + "coin_type": "mwc", + "compact_slate": true, + "fee": "7000000", + "height": "5", + "id": "0436430c-2b02-624c-2032-570501212b01", + "lock_height": "0", + "network_type": "automatedtests", + "num_participants": 2, + "participant_data": [ + { + "id": "0", + "message": null, + "message_sig": null, + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be4f05245454b9681075ed2f92baefea88971d1b8192abdc79d08683e9ef18c98", + "public_blind_excess": "02e89cce4499ac1e9bb498dab9e3fab93cc40cd3d26c04a0292e00f4bf272499ec", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + }, + { + "id": "1", + "message": null, + "message_sig": null, + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bb9128fbee3070329b28c635090138e2b78fe1fbb840117b2f65777508179be0a", + "public_blind_excess": "02e3c128e436510500616fef3f9a22b15ca015f407c8c5cf96c9059163c873828f", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "payment_proof": null, + "ttl_cutoff_height": null, + "tx": { + "body": { + "inputs": [ + { + "commit": "098778ce2243fa34e5876c8cb7f6dbbbd6a5649c1561973a807a6811941c12363c", + "features": "Coinbase" + }, + { + "commit": "0910c1752100733bae49e877286835aab76d5856ef8139b6c6e3f51798aa461b03", + "features": "Coinbase" + } + ], + "kernels": [ + { + "excess": "09eac5f5872fa5e08e0c29fd900f1b8f77ff3ad1d0d1c46aeb202cbf92363fe0af", + "excess_sig": "66074d25a751c4743342c90ad8ead9454daa00d9b9aed29bca321036d16c4b4d9d03e203295399aab9ea354abcc18cd40170f1739e2bd4799460df8e1f6b4ba3", + "features": "Plain", + "fee": "7000000", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "082967b3fe580cd110355010ef45450314fb067720db01b0e6873bb083d76708c9", + "features": "Plain", + "proof": "828bb24121aa0332c872062a42a8333c3ef81f8ae37d24053d953217368b3cada90410a50509a0b9fcbb5aded41397fc00ca1ff5acdac20d48afb0a3281d21e7026d32fdc6c5157461a35f98a809ffa09187c1e170ea24652ad213b7e4c9878654ac3dd9a8915eaf742db53182fcb42d2d341fbdfe8bd31bd001f4ff2c1ca9f9b1531da29137214f211edb7a5eb8f494cb8945f8527dd25bf7e698515043db4249540720008a708db5342230d05b069c094688ccb7c07d4a4a2293ea76cf999c555dc0ddc757891c360db1901bbb4dc20cae997f875f8de482d8160e05d60f9b0135e0fc313d8f953db78f1ea252449dd81cfa22dd895512ed39d566f0924542b543d25fc9fc7a819d228f3b0ee5e381f088f54893e86437dafc49dd923b3e6dff956ca843f951910379531fac9bb5fd01a182dd32a4c597f92da3c01af37cb9b0ec984500884438e74e54d7e76fa1ae7241d5050b13376310b24761634a6f6eb7cf000082f50ed7c1899d7918023d4f877586f964932a7af72e7a4984ddecfdd1921a2e1b80b00d6bd2e64a3f4cb6915a27a8d17a69d163cf45220a13fcddd15dc2bb91ae4f1b6a67224ab3b23e8d7d785df178ec78a84cf42cea086426f563822c8a4271a0b89bb21f84b643dbf1de21b6395039d673a376492767199fa36ccd9a13628ce61695424091acc16059450d59bc59fa7879e7306f5727217211b0264a6a560f886d520e41406ef45b1668805b88d246c5b2ca5a1762042c85be34fcd420ac3843f32236d079b4bd57d6b8d8013d9d18f8efb55e8e443cd9e1af9b144e7a56c8c6be0138af3b4a6c99bee9109bed2bce2e5145e736b125a2ec19aaf3fff713f6897fdd4158ce2ab04706b062ca2847bf70259c0fc4b0d390dc7fdaf0362047f775a912bd22da9d40f04d9790bcd5ece4b36b74c6c340b48c2926b916e8a9" + }, + { + "commit": "096e1669267c22ecb38c466d73b8578261d8e91c14dd66702dd5bf34f4232e10db", + "features": "Plain", + "proof": "7d567b0895a1103d19446929da8b98f2086819507ddce4b9dbb5ce6327107744e74aba59ef1834937da1b86eb7c1c1b0bc11d1c5d5ec79d25bc1e52aed1656f60d46f6878ba5ca8639efdbb9203e378e91171c11527c4a34713f06dc22f58ca4a08e68d83ff897e61cfc145fe376fa428b55e25cf20d15f10b9054778229798b30fb4e45d817a5053b682dcf591481a3c8174cfbba81e31aa525d5b884ca7a016713178f26c0fe8ae1f88b5382f8e70c4d91fb3828c0f307d828aa028281d3551525e68d20827ab0e6785c6b5747e895dcd38429b44e62b7f6c1c921d87ae954a9dd6e967ac52e6cd13a1d4bb2f1434da25a0723ef9c869cc573019577552dd0e0f808f8cc57723b041320025f6433779fe907998a4ec7606bf884b2199253b502065bed8e0625c2df858d6508c1aa44deddc68d06d00d81e97720e23e15a3464ed4733fc547e9fb772e563a1dbcd27ac55e40f674f9006e7dd4465444f3eb7527cb01905dee69a51cf2fc1810c861dd0834e7649d594c3e1740d85343a6b63c8a9e0a0f63059031899b38dfd9a192034d54029bd35e683ccab46282519b26cae20d398b754357abe1cf0370890f2897b5d8ada4fb3da777a8f8f1daa4197a380e6734504117dd2a92ea1917f174c44c59e0b50c6b7a5f9eb14e6d96cb6b3e5dbcb3d0eaf0e4aac1b6616d674bb708b7559e37de608e8a828bee7f25f627e2f06d9a87e8d651ade39e1e65db7204b94abc0b7ca6fdd75aadeeac6a876b6297e38039734ebdfa9a555152b4293cb00e423a66d64f827afa4748dd6fdc1dc33332bffb820dacbf5a6d347042db985bbd9cf476dceb45d6978035ba03d25612243fc164c0a902017ce7ffd632d041fa3c56554739e78c6d725ecbfdaa0739d3649239fb53294b7a46ee6ed403bf3815f6c78f06a8ca4e3c9b066234f7574fb6ea8f17d199" + } + ] + }, + "offset": "e88c17b8cdcb6606c3d263a8fb4be8fd6bd9d435852c6ff78602385bb31a8849" + }, + "version_info": { + "block_header_version": 2, + "orig_version": 3, + "version": 3 + } + } + } +} +``` +::: + +you will need to call finalize_tx + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "finalize_tx", + "params": { + "token": "9ad802ba3f3288d434b28bce9102aff35e953c4239cfd76c64ad2ac23202c0cf", + "slate": "BEGINSLATE_BIN. usqHiSmrwTbxJD1 BKq9tdQUBJCLmRF unXjpYfGsr1hDhH XQSGvUyUKrGPttp dfMqT2LyGtDiSbJ LBaLwqyamCRQ6ga 4SyMzhP1D4CuTpr PjXwfvXqzZiEB4R LAKt3pe9WSPcBSK MuF6Dw9Y4mDJpka zkZ8uDRM4sUzhk8 SDk3ZY5FeeEoPG8 ug7miFxCZKCfMn7 8G2hf7KLobevDeX yQHV5Jja7vRH9kx sQ6PsUN2518EJm2 kc8wtAoHyP6KQTg znNkxvdJ6aXzvEU 5BL9UqS7x2d3U1B aunvhgyEVfE3LXk 7BMp8yPrzF3BBHX KJWLsftycvZwcvM eDZMREoZzMGQWNV PE37U3tEaFbHTWM hy5nNefS4TCoKCk b8WXrZUsRnHw4eX e26LQ94RQoTbXh9 9veAK2ECuU9ttre aK7VNEKmzE9hUea YcFdzXFkSGVcxJL J58T9vdBBUkK9PQ ncoN4aMhiwHwSfr MbJfyUQCLWwjFGY V8qiiVwMLApauyW 35fHztkvtoswH3z cZTJTn1aeYCvBt8 x3mqeMGtw6sFP7u YPEkbQx4ZbNHVaw 3AYsmFLKUS6D2rV EcCaUi3c4wjGopq yjfMh8Sw1irbxDh z55XmSSD1iqu7BV XqGRpjbdEe3ks8E TCW3GpkoDBA96Hm EDvT5d1FEFDefJU eZReffaiKAj54HA MmibCcS8ZPAfLa5 4dJkDqH9Xmquqeb Ut1gRt1HjLJ78mT GLDyMEiBWGw2RVj JNJZNxXy5PZcrfr x5D3U65hobmk7ZT 6VDKzyPNYHwhiug q9QkcmKVTYwUoDT LhhXJCvw3oyNmVP GvWThjWpebSxjsv 6LobgE59ap2NTPx eHHsfhU9fSXZMpn J389tVGkPJtotdQ DHw8rqi8JS6MX6m pdo2tFr2MdKvs5f Zq4oyFBuojGrz3S 5UZgDjK1NLUuDrG ZQJpBwYGSqFza4m 559DieAWLe38khU FmM6uqh8i2ZyEHG qNBok3kCa7JHYpt 4iA93S33PXH5CS7 VowPonFVgpAofK5 oYzopFRdmJU2DUa b1VW3ANdCtNZKpb re2W2rwoDbLP34G QiddN7u1jXWuJj9 HBREYcvGzdxk4EB FfLoMG2tWERLrct 77tnwWZhcaanXTK RDibv4S9Hs912b8 HbV5XtB8d1WJhyS w2N9L9zPzoJnHN7 LQzq7KrFiwitGaK HMURznkkrWQrHuN xbAMAoZsH1rwmwo SCsSRsw6uxHzcnL ZdADUmYCVHpMUkU HThZhVwW2xaAWBY y6MpaJoEXv15JCx swhhXNGkmm5ZRf9 L3kgVcGpjDS69kN QMCpFdswUHcj5Xu 3cKkRuV6DZ7jMLn u6kLGhxh9ECGSzt As. ENDSLATE_BIN." + } +} +``` + + +::: details Ok Response +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": "BEGINSLATE_BIN. b2RNEZb7VUWmqf6 qixEg51cwYSF5Km yufpLtpbPdkFCfp jmtMDEgJKjbvqSm A7jrbQSfz7Yorky 5EwhBfG1W9Jkd47 Lj8S1BdkdM2vMfC aMV3huudT8iYzzJ cQ1Wa62WCU1Wrgr zfL5P3uupbKv5Pj KceHWVbo87w2r1U d31F6pMGNQ4ZZdX drTov3NjciyHhuE 9xYodxaY6tAFpRj Tshitd1kCzoGZaf AgmnXjKPMuUsbB6 D8UzkBw4pTZRtfy 2hHBXqQJBBAwX9F Xgsrq6xiiYzv9UF vbeF9FUMRLg3jfE QiPHzKEH4hXLyM2 TUdRmicKf6uBnz2 crQRpWJh5gzBP9x HHvKd6mxTfyzuMZ rKymbwQpuPULc1m dLWw5UiQA8jrRGv t7bCDD3qdPkpLBz 9ucjqJwuxZ3mFX5 eWThz57LmNnEz9N RNEvxby7xG1JpgD ZFQLKgyWPmmSY9p 8rJTQ3Le45tKXNk zjNjN5vqX88MiEN tEPEt3Ss9WkmDYG Kp7vVCFL93FxAuS C46s6LFYT2RuL56 ZAK92DeWh4D4gGW mJHJFugdFhHxPKX 5hAWaUtJKD3sEja k5nkgdHwaWQT91c jw9xqBgTFwMkRcv KKxFvHDUWTAj1mU yMHpydTdbeNtGep XXtZ1GjKVkGSqnL 4WiCbEQQnb3pmo8 efJE2SDDcB7Cs9L wixpfm7g4TJ2J28 Wh1jNfNcxUSSHsf xErxNtKbXnHZstK ByfHxhfDRZ42Yhk Jqcr9YKdp5DPaSP RrQLm3GPeyiuach yXWEtvobAGpqRJe dbq756GdiQKcVCw FFn5XMtZCqMpCPV PMq1DpAjRcKJhVN cA5zPPJw4MkZpzr V1m7yHq25ER5ZZL 9fpENr3pcTtqEum BU3Kc7htf8YesyF FdypKTrxbc3QmJv VprcGhVq4dUfDwG AKhaurhJiXbpivf J3JiVaRV6Fq61Rz hJ8AiCLLZ965xWL KCeB17xNjFD3HyT shMKX1g9zj9spie uimi6VMxKTh4U36 sZbjfzfVNDwuYDH BXqA8JWCprYNzLZ 2ZiGaZRyoY39EY5 AprieP7cgDsJtwR b4jXs27S6jBh3bm A75toW2sCsvPZAF 3tmtQgXr1iFjRL5 Rf3519obpfxXkKZ EwD57kQYw2GtGCN ugpgBPgUn3G389i bUbAapCxH1YwazL sjTZ6ZqKrJFSWkn B1xTXj4ofYVBdLX SmZEi1Lj8VEn8bN uYagMcGooWrxNRU bgTpj1J7wMwo7Lz kb7iAqqswW21as1 Uf8wxRQXfU1GGvz 2b6bcGQ7pFkGP3j 9MZ6UKtn7Rx4DG8 hE1NFb6BQx6mEnL SrgVKpaXhxEgCDN kC7ZC1bYR3Ee382 vSHNY2adq8hXWeq UEwvrrEAVVkuZRC 89uFVjzFEttwjUq cNPJXDZdrvVAczm JdmdfJ4GvFxTJEG kG1biy6Hh9EDbqu PzocyrsLQnpUy7K Mh4CczgBx8ipEpY dtTPtgRk2ygoUfd gcdf13iNbkDFzey E1JYNaFFup13w5Q J28zNMdybyvQ2Ww Ch54esBmK1iJg2g y9H3oS2Px8XSqGK MzMDtfo6asTpdF5 qM4wBG6BN6GbhjF Moq5jrhdHYovMjn BgH8ULKvjkF4D8D TeVYcBvDu6zX7aY oHHb89Ge7NEjEBe 9zMnPJfq9E2K79C AjtGHBfDv4KoKKi cNz1cWp3sBkMsVF BLS8BV3JoURgGKt 5NmgWoDJZdACNWz eddDPyu5eViCk93 wpY66b9VwxhQuVu wdEfuV3zQBXjqke zduwYjdMMcKjjmA synLsZH9TomQDWf okbsGARZ8LnASba i2RTh4By5aBj45B dqoE2xgCCAiGvm8 G9iZn8NfZXGbHhE 3pbL86S7zZPgUHp 4RygbWNLbVvLW3Y ggtYAha71S5WXjS 9K8RgZVbzGLazSB HNmyJCZ93n5KevP Phg4qSRDDLKWx37 2UxFK7kEgDGHCdN RQHg67jX4VhDpYA FL1PXby9LUMeP46 roYaYhGykZgv815 LPQ5nXXw2HeuWMi mrkxGRs3dtEMpFj rC8sEpPukAmQG4g oDHikNNWA2ffqzx 5qCqA2ihB2B2yNo h1d7pidFMgWMj65 qKkg5kuY5hHwdbq Dn6tR7zPFcws9dK sciFj8n5bN2dq2f NEsy3hngBfSadLM eGhWXiRcBjb5kfS WUkRQYsgwcbzBiZ EFVUnwYbioPNey6 J7MtFyVdNuSfGxL wcSkpmaMQqZ6b2P tv4uBNiUzz1rRM9 USFvWNP93n2hw2a 7ayMB1m9KCYc787 KovcetggqsBqsC2 hLQ2DDseDJ3TWZ9 zryvdDVVRrNZjMj A5Urn5cefCo1rnj i2wKLw6H2aBUF1B WXfCCmxT81ZAHLS Qgjq6Gxb8syX9qH Feo8brWYwHm1qcP PBan7wsaXDuGX3L XvVkoXhdip9QYyc nj4Ey7zXLaUp5sD fCjTRE5Q2JsauhV RQbHbrEHGqA6Pva jxEFubfMbZRQHEs QoyLWcscbJM8kE5 He9B6XanbgVvqTF nmjkgpQwZoW2fQ2 eKvfbh7RRgAegNS T. ENDSLATE_BIN." + } +} +``` +::: + + +And finally once the transaction is finalized you will need to submit it to the node to propagate it through the network: +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "post_tx", + "params": { + "token": "d202964900000000d302964900000000d402964900000000d502964900000000", + "tx": { + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000", + "body": { + "inputs": [ + { + "commit": "098778ce2243fa34e5876c8cb7f6dbbbd6a5649c1561973a807a6811941c12363c", + "features": "Coinbase" + }, + { + "commit": "0910c1752100733bae49e877286835aab76d5856ef8139b6c6e3f51798aa461b03", + "features": "Coinbase" + } + ], + "outputs": [ + { + "commit": "082967b3fe580cd110355010ef45450314fb067720db01b0e6873bb083d76708c9", + "features": "Plain", + "proof": "828bb24121aa0332c872062a42a8333c3ef81f8ae37d24053d953217368b3cada90410a50509a0b9fcbb5aded41397fc00ca1ff5acdac20d48afb0a3281d21e7026d32fdc6c5157461a35f98a809ffa09187c1e170ea24652ad213b7e4c9878654ac3dd9a8915eaf742db53182fcb42d2d341fbdfe8bd31bd001f4ff2c1ca9f9b1531da29137214f211edb7a5eb8f494cb8945f8527dd25bf7e698515043db4249540720008a708db5342230d05b069c094688ccb7c07d4a4a2293ea76cf999c555dc0ddc757891c360db1901bbb4dc20cae997f875f8de482d8160e05d60f9b0135e0fc313d8f953db78f1ea252449dd81cfa22dd895512ed39d566f0924542b543d25fc9fc7a819d228f3b0ee5e381f088f54893e86437dafc49dd923b3e6dff956ca843f951910379531fac9bb5fd01a182dd32a4c597f92da3c01af37cb9b0ec984500884438e74e54d7e76fa1ae7241d5050b13376310b24761634a6f6eb7cf000082f50ed7c1899d7918023d4f877586f964932a7af72e7a4984ddecfdd1921a2e1b80b00d6bd2e64a3f4cb6915a27a8d17a69d163cf45220a13fcddd15dc2bb91ae4f1b6a67224ab3b23e8d7d785df178ec78a84cf42cea086426f563822c8a4271a0b89bb21f84b643dbf1de21b6395039d673a376492767199fa36ccd9a13628ce61695424091acc16059450d59bc59fa7879e7306f5727217211b0264a6a560f886d520e41406ef45b1668805b88d246c5b2ca5a1762042c85be34fcd420ac3843f32236d079b4bd57d6b8d8013d9d18f8efb55e8e443cd9e1af9b144e7a56c8c6be0138af3b4a6c99bee9109bed2bce2e5145e736b125a2ec19aaf3fff713f6897fdd4158ce2ab04706b062ca2847bf70259c0fc4b0d390dc7fdaf0362047f775a912bd22da9d40f04d9790bcd5ece4b36b74c6c340b48c2926b916e8a9" + }, + { + "commit": "096e1669267c22ecb38c466d73b8578261d8e91c14dd66702dd5bf34f4232e10db", + "features": "Plain", + "proof": "7d567b0895a1103d19446929da8b98f2086819507ddce4b9dbb5ce6327107744e74aba59ef1834937da1b86eb7c1c1b0bc11d1c5d5ec79d25bc1e52aed1656f60d46f6878ba5ca8639efdbb9203e378e91171c11527c4a34713f06dc22f58ca4a08e68d83ff897e61cfc145fe376fa428b55e25cf20d15f10b9054778229798b30fb4e45d817a5053b682dcf591481a3c8174cfbba81e31aa525d5b884ca7a016713178f26c0fe8ae1f88b5382f8e70c4d91fb3828c0f307d828aa028281d3551525e68d20827ab0e6785c6b5747e895dcd38429b44e62b7f6c1c921d87ae954a9dd6e967ac52e6cd13a1d4bb2f1434da25a0723ef9c869cc573019577552dd0e0f808f8cc57723b041320025f6433779fe907998a4ec7606bf884b2199253b502065bed8e0625c2df858d6508c1aa44deddc68d06d00d81e97720e23e15a3464ed4733fc547e9fb772e563a1dbcd27ac55e40f674f9006e7dd4465444f3eb7527cb01905dee69a51cf2fc1810c861dd0834e7649d594c3e1740d85343a6b63c8a9e0a0f63059031899b38dfd9a192034d54029bd35e683ccab46282519b26cae20d398b754357abe1cf0370890f2897b5d8ada4fb3da777a8f8f1daa4197a380e6734504117dd2a92ea1917f174c44c59e0b50c6b7a5f9eb14e6d96cb6b3e5dbcb3d0eaf0e4aac1b6616d674bb708b7559e37de608e8a828bee7f25f627e2f06d9a87e8d651ade39e1e65db7204b94abc0b7ca6fdd75aadeeac6a876b6297e38039734ebdfa9a555152b4293cb00e423a66d64f827afa4748dd6fdc1dc33332bffb820dacbf5a6d347042db985bbd9cf476dceb45d6978035ba03d25612243fc164c0a902017ce7ffd632d041fa3c56554739e78c6d725ecbfdaa0739d3649239fb53294b7a46ee6ed403bf3815f6c78f06a8ca4e3c9b066234f7574fb6ea8f17d199" + } + ], + "kernels": [ + { + "excess": "08b3b8b83c622f630141a66c9cad96e19c78f745e4e2ddea85439f05d14a404640", + "excess_sig": "66074d25a751c4743342c90ad8ead9454daa00d9b9aed29bca321036d16c4b4d1f1ac30ec6809c5e1a983a83af0deb0635b892e5e0ea3a3bd7f68be99f721348", + "features": "Plain", + "fee": "7000000", + "lock_height": "0" + } + ] + } + }, + "fluff": false + } +} +``` +::: details Ok Response +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": null + } +} +``` +::: + +If the response is Ok we can assume that the transactions was correctly built and sent to the node and correctly progated to the network. +2. **Interaction with the Receiver** + + +### Receive + +receive_tx +```json +{ + "jsonrpc": "2.0", + "id": 0, + "method": "receive_tx", + "params": [ + "BEGINSLATE_BIN. 8kBm8dTRtrskDCU TRruCj5bDo56r2p o9Ux7QHP3Jk7zYz ijPWx8nxhLHzNEY oce1HTx2aCozuTM jKU9NtS82yq4Nrv qxR8YL2tJ9sxjoh deDHf4S2Rzi9bXo i9gNY4z1LAwpjHi HV. ENDSLATE_BIN.", + null, + null + ] +} +``` +``` +BEGINSLATE_BIN. usqHiSmrwTbxJD1 BKq9tdQUBJCLmRF unXjpYfGsr1hDhH XQSGvUyUKrGPttp dfMqT2LyGtDiSbJ LBaLwqyamCRQ6ga 4SyMzhP1D4CuTpr PjXwfvXqzZiEB4R LAKt3pe9WSPcBSK MuF6Dw9Y4mDJpka zkZ8uDRM4sUzhk8 SDk3ZY5FeeEoPG8 ug7miFxCZKCfMn7 8G2hf7KLobevDeX yQHV5Jja7vRH9kx sQ6PsUN2518EJm2 kc8wtAoHyP6KQTg znNkxvdJ6aXzvEU 5BL9UqS7x2d3U1B aunvhgyEVfE3LXk 7BMp8yPrzF3BBHX KJWLsftycvZwcvM eDZMREoZzMGQWNV PE37U3tEaFbHTWM hy5nNefS4TCoKCk b8WXrZUsRnHw4eX e26LQ94RQoTbXh9 9veAK2ECuU9ttre aK7VNEKmzE9hUea YcFdzXFkSGVcxJL J58T9vdBBUkK9PQ ncoN4aMhiwHwSfr MbJfyUQCLWwjFGY V8qiiVwMLApauyW 35fHztkvtoswH3z cZTJTn1aeYCvBt8 x3mqeMGtw6sFP7u YPEkbQx4ZbNHVaw 3AYsmFLKUS6D2rV EcCaUi3c4wjGopq yjfMh8Sw1irbxDh z55XmSSD1iqu7BV XqGRpjbdEe3ks8E TCW3GpkoDBA96Hm EDvT5d1FEFDefJU eZReffaiKAj54HA MmibCcS8ZPAfLa5 4dJkDqH9Xmquqeb Ut1gRt1HjLJ78mT GLDyMEiBWGw2RVj JNJZNxXy5PZcrfr x5D3U65hobmk7ZT 6VDKzyPNYHwhiug q9QkcmKVTYwUoDT LhhXJCvw3oyNmVP GvWThjWpebSxjsv 6LobgE59ap2NTPx eHHsfhU9fSXZMpn J389tVGkPJtotdQ DHw8rqi8JS6MX6m pdo2tFr2MdKvs5f Zq4oyFBuojGrz3S 5UZgDjK1NLUuDrG ZQJpBwYGSqFza4m 559DieAWLe38khU FmM6uqh8i2ZyEHG qNBok3kCa7JHYpt 4iA93S33PXH5CS7 VowPonFVgpAofK5 oYzopFRdmJU2DUa b1VW3ANdCtNZKpb re2W2rwoDbLP34G QiddN7u1jXWuJj9 HBREYcvGzdxk4EB FfLoMG2tWERLrct 77tnwWZhcaanXTK RDibv4S9Hs912b8 HbV5XtB8d1WJhyS w2N9L9zPzoJnHN7 LQzq7KrFiwitGaK HMURznkkrWQrHuN xbAMAoZsH1rwmwo SCsSRsw6uxHzcnL ZdADUmYCVHpMUkU HThZhVwW2xaAWBY y6MpaJoEXv15JCx swhhXNGkmm5ZRf9 L3kgVcGpjDS69kN QMCpFdswUHcj5Xu 3cKkRuV6DZ7jMLn u6kLGhxh9ECGSzt As. ENDSLATE_BIN. +``` + + MWC transactions require an interactive exchange between the sender and receiver. Options include: + - **File Transfer:** The transaction slate is exported as a file and sent to the receiver (via email, messenger, etc.). + - **HTTP Listener:** The receiver runs a listener, allowing real-time communication and transaction negotiation. + - **TOR:** The sender connects to the receiver’s TOR address for enhanced privacy. + +3. **Sign and Finalize** + - After the receiver adds their information to the transaction slate, it is returned to the sender for signing and finalization. + - The finalized transaction is then broadcast to the MWC blockchain. + +4. **Transaction Confirmation** + - Once broadcast, the transaction is confirmed by the network. + - Both sender and receiver can verify the status of the transaction via their wallet or node. + +--- + + + +The process of receiving MWC involves securely accepting, completing, and confirming the transaction initiated by the sender. + +1. **Prepare to Receive** + - The receiver sets up their wallet to accept transactions. + - This may include running an HTTP listener, configuring TOR, or preparing to exchange files with the sender. + +2. **Share Transaction Details** + - The receiver provides the necessary interaction method (file, HTTP listener URL, or TOR address) to the sender. + +3. **Add Information to the Transaction Slate** + - Upon receiving the initial transaction slate from the sender, the receiver adds their information to the slate. + - This includes their portion of the signature to maintain transaction privacy and integrity. + +4. **Return the Slate to the Sender** + - The updated transaction slate is sent back to the sender for finalization. + +5. **Monitor and Confirm** + - Once the sender broadcasts the finalized transaction, the receiver monitors the wallet for confirmation. + - The transaction status is updated, and funds are credited after network confirmation. + +--- + +### Benefits of MWC Workflows + +- **Enhanced Privacy:** The interactive nature of transactions ensures that no public addresses or identifiable information are exposed. +- **Multiple Communication Channels:** Users can choose between file-based, HTTP listener, or TOR methods for added flexibility. +- **Secure and Decentralized:** The workflows rely on cryptographic signatures and decentralized validation through the MWC blockchain. + +These workflows form the backbone of integrating MWC into any payment or transaction system, maintaining the core values of privacy, simplicity, and decentralization. diff --git a/developers/integration/exchange/deposit.md b/developers/integration/exchange/deposit.md new file mode 100644 index 0000000..a45319c --- /dev/null +++ b/developers/integration/exchange/deposit.md @@ -0,0 +1,237 @@ +# Integrate Deposit with Slatepack Method + +### Steps: + + +1. **User API Request to Generate Slatepack Address** + - **Functionality:** Use the `mwc-wallet` API to create a unique Slatepack Address for the user. + - **API Call:** + - **Endpoint:** `GET /v3/owner/wallet/receive_address` + - **Response Example:** + ```json + { + "address": "slatepack_address_here" + } + ``` + - **Attribution:** Store this Slatepack address in your database and associate it with the user's account. + + + +2. **Monitor for Incoming Transactions** + - Use the `listen` command or polling via `grin-wallet` APIs to check for new Slatepack transactions. + + - **Function: Listen for Incoming Slatepack** + - Run a Slatepack listener in the background: + ```bash + grin-wallet listen + ``` + This listens for incoming transactions. + + - **Polling API Call:** + - **Endpoint:** `GET /v3/owner/wallet/transactions` + - **Purpose:** List all wallet transactions, including pending ones. + - **Response Example:** + ```json + [ + { + "id": 1, + "tx_slate_id": "slate-id", + "amount": 1000000000, + "status": "received", + "timestamp": "2024-11-24T12:34:56Z", + "user_id": "user_123" + } + ] + ``` + + + +3. **Match Deposits to Users** + - Use the `tx_slate_id` or metadata in the transaction to match it with the user who initiated it. + - Record the status as "pending" until the transaction is confirmed on the blockchain. + + + +4. **Confirm and Credit User’s Account** + - Once a transaction is confirmed: + - Change its status to "confirmed." + - Credit the user's account with the equivalent Grin balance. + + +--- + +## Withdrawal Using Slatepack + +### Steps: + + +1. **User Requests Withdrawal** + - Through your API, the user specifies: + - Amount to withdraw. + - Their **Slatepack Address**. + + + +2. **Initiate Transaction** + - Use the `send` API or CLI to create an initial Slatepack transaction: + - **CLI Command:** + ```bash + grin-wallet send --to 'recipient_slatepack_address' --amount 10.0 + ``` + - **API Call:** + - **Endpoint:** `POST /v3/owner/wallet/transaction/send` + - **Request Body:** + ```json + { + "address": "recipient_slatepack_address", + "amount": 1000000000, + "fee": null + } + ``` + - **Response:** + ```json + { + "slatepack_message": "slatepack_data", + "tx_slate_id": "slate-id" + } + ``` + + - Store the **Slatepack Message** and associate it with the user withdrawal request. + + + +3. **Send the Slatepack to the User** + - Provide the **Slatepack Message** to the user via your API response or UI. + + + +4. **Wait for User to Finalize** + - Wait for the user to process the Slatepack and send back the finalized transaction. + - **Receive Finalized Slatepack:** + - **CLI Command:** + ```bash + grin-wallet receive --slate 'finalized_slatepack_data' + ``` + - **API Call:** + - **Endpoint:** `POST /v3/owner/wallet/transaction/finalize` + - **Request Body:** + ```json + { + "slate": "finalized_slatepack_data" + } + ``` + - **Response Example:** + ```json + { + "tx_id": "finalized_transaction_id", + "broadcasted": true + } + ``` + + + +5. **Broadcast the Transaction** + - Use the `finalize` command or API to broadcast the finalized transaction to the network. + - **CLI Command:** + ```bash + grin-wallet finalize --file slatepack_finalized + ``` + - **API Call:** + - **Endpoint:** `POST /v3/owner/wallet/transaction/post` + - **Request Body:** + ```json + { + "tx_id": "finalized_transaction_id" + } + ``` + + + +6. **Confirm Completion** + - Once the transaction is confirmed on the blockchain: + - Mark the user’s withdrawal request as "completed." + - Notify the user via API response or email. + + +--- + +## API Workflow Example + +### User Deposit + + +1. **User Fetches Slatepack Address:** + - `GET /api/grin/deposit` + - Response: + ```json + { + "slatepack_address": "slatepack_address_here" + } + ``` + + + +2. **System Monitors Incoming Deposits**: + - Poll `/v3/owner/wallet/transactions` for deposits. + - Map deposits to users based on the `slate_id`. + + + +3. **Confirm and Credit User:** + - On confirmation, credit the user's account. + + +### User Withdrawal + + +1. **User Requests Withdrawal:** + - `POST /api/grin/withdraw` + - Request Body: + ```json + { + "amount": 10.0, + "slatepack_address": "user_slatepack_address" + } + ``` + + + +2. **API Creates Slatepack Transaction:** + - Calls `POST /v3/owner/wallet/transaction/send`. + + + +3. **Provide Slatepack to User:** + - Response: + ```json + { + "slatepack_message": "slatepack_data" + } + ``` + + + +4. **User Returns Finalized Slatepack:** + - `POST /api/grin/withdraw/finalize` + - Request Body: + ```json + { + "finalized_slatepack": "finalized_slatepack_data" + } + ``` + + + +5. **API Finalizes and Broadcasts Transaction.** + + +--- + +## Security Considerations + + +- Ensure secure communication for sharing Slatepack messages. +- Use HTTPS and authenticated API endpoints. +- Implement strict validation on amounts and Slatepack data to prevent misuse. + + diff --git a/developers/integration/exchange/introduction.md b/developers/integration/exchange/introduction.md new file mode 100644 index 0000000..e69de29 diff --git a/developers/integration/exchange/withdrawal.md b/developers/integration/exchange/withdrawal.md new file mode 100644 index 0000000..e69de29 diff --git a/developers/library.md b/developers/library.md new file mode 100644 index 0000000..e69de29 diff --git a/node/api.md b/node/api.md new file mode 100644 index 0000000..e69de29 diff --git a/node/commands.md b/node/commands.md new file mode 100644 index 0000000..45e605e --- /dev/null +++ b/node/commands.md @@ -0,0 +1,58 @@ +# MimbleWimbleCoin (MWC) Mining Overview + +## Introduction + +MimbleWimbleCoin (MWC) is a privacy-oriented cryptocurrency that implements the MimbleWimble protocol. The protocol allows for increased privacy, scalability, and fungibility by structuring transactions in a way that avoids much of the redundancy found in traditional blockchain systems. MWC aims to provide users with a decentralized, secure, and private means of transaction. + +## Why Mine MWC? + +Mining MWC not only helps secure the network but also rewards miners with MWC coins for their efforts in validating transactions and creating new blocks. It's a way to support the network's growth while earning cryptocurrency. + +## Prerequisites for Mining MWC + +Before you start mining MWC, ensure you have the following: + +- **A compatible hardware setup**: Ideally, a powerful GPU as MWC mining is GPU-optimized. +- **Mining software**: There are multiple mining software options available that support MWC. +- **An MWC wallet**: To store the MWC rewards you earn from mining. +- **Stable internet connection**: Mining requires a constant connection to the internet. +- **Membership in a mining pool** (optional): While solo mining is possible, joining a mining pool can offer more consistent rewards. + +## Recommended Mining Software + +Several mining software options support MWC. Some popular choices include: + +### GPU Mining Software +- **Gminer** +- **lolMiner** +- **MWCMiner** + +### Asics Machine +- **G1-Mini - Ipollo** +- **G1 - Ipollo** + +Ensure you download the software from the official or a reputable source to avoid malicious programs. + +## Getting Started with Mining MWC + +1. **Choose Your Mining Approach**: Decide whether you want to mine solo or join a mining pool. Mining solo might yield larger rewards per block, but they will be infrequent. Mining pools offer more consistent, but smaller, rewards. + +2. **Set Up Your Mining Software**: Follow the installation and setup instructions provided by your chosen mining software. This wsill typically involve extracting the software to a folder and editing a `.bat` file to include your wallet address and, if applicable, your pool's information. + +3. **Start Mining**: Run the mining software. If configured correctly, it should start communicating with the MWC network or your mining pool and begin mining. + +4. **Monitor Your Mining Activity**: Keep an eye on your mining software's dashboard or your mining pool's website to track your mining progress and earnings. + +## Tips for Successful Mining + +- **Stay Updated**: Keep your mining software and drivers up to date to maintain optimal mining efficiency. +- **Monitor Your Hardware**: Ensure your mining setup is in a cool, ventilated area to prevent overheating. +- **Consider Electricity Costs**: Mining consumes a lot of power. Make sure the cost of electricity does not negate your mining rewards. + +## Conclusion + +Mining MWC can be a rewarding way to participate in the cryptocurrency ecosystem. By ensuring you have the right setup and approach, you can start mining and contributing to the security of the network, while earning MWC as a reward for your efforts. + +Remember, the world of cryptocurrency mining is always evolving, so stay informed about the latest mining strategies and technologies to maximize your mining efforts. + +Happy mining! diff --git a/node/introduction.md b/node/introduction.md new file mode 100644 index 0000000..45e605e --- /dev/null +++ b/node/introduction.md @@ -0,0 +1,58 @@ +# MimbleWimbleCoin (MWC) Mining Overview + +## Introduction + +MimbleWimbleCoin (MWC) is a privacy-oriented cryptocurrency that implements the MimbleWimble protocol. The protocol allows for increased privacy, scalability, and fungibility by structuring transactions in a way that avoids much of the redundancy found in traditional blockchain systems. MWC aims to provide users with a decentralized, secure, and private means of transaction. + +## Why Mine MWC? + +Mining MWC not only helps secure the network but also rewards miners with MWC coins for their efforts in validating transactions and creating new blocks. It's a way to support the network's growth while earning cryptocurrency. + +## Prerequisites for Mining MWC + +Before you start mining MWC, ensure you have the following: + +- **A compatible hardware setup**: Ideally, a powerful GPU as MWC mining is GPU-optimized. +- **Mining software**: There are multiple mining software options available that support MWC. +- **An MWC wallet**: To store the MWC rewards you earn from mining. +- **Stable internet connection**: Mining requires a constant connection to the internet. +- **Membership in a mining pool** (optional): While solo mining is possible, joining a mining pool can offer more consistent rewards. + +## Recommended Mining Software + +Several mining software options support MWC. Some popular choices include: + +### GPU Mining Software +- **Gminer** +- **lolMiner** +- **MWCMiner** + +### Asics Machine +- **G1-Mini - Ipollo** +- **G1 - Ipollo** + +Ensure you download the software from the official or a reputable source to avoid malicious programs. + +## Getting Started with Mining MWC + +1. **Choose Your Mining Approach**: Decide whether you want to mine solo or join a mining pool. Mining solo might yield larger rewards per block, but they will be infrequent. Mining pools offer more consistent, but smaller, rewards. + +2. **Set Up Your Mining Software**: Follow the installation and setup instructions provided by your chosen mining software. This wsill typically involve extracting the software to a folder and editing a `.bat` file to include your wallet address and, if applicable, your pool's information. + +3. **Start Mining**: Run the mining software. If configured correctly, it should start communicating with the MWC network or your mining pool and begin mining. + +4. **Monitor Your Mining Activity**: Keep an eye on your mining software's dashboard or your mining pool's website to track your mining progress and earnings. + +## Tips for Successful Mining + +- **Stay Updated**: Keep your mining software and drivers up to date to maintain optimal mining efficiency. +- **Monitor Your Hardware**: Ensure your mining setup is in a cool, ventilated area to prevent overheating. +- **Consider Electricity Costs**: Mining consumes a lot of power. Make sure the cost of electricity does not negate your mining rewards. + +## Conclusion + +Mining MWC can be a rewarding way to participate in the cryptocurrency ecosystem. By ensuring you have the right setup and approach, you can start mining and contributing to the security of the network, while earning MWC as a reward for your efforts. + +Remember, the world of cryptocurrency mining is always evolving, so stay informed about the latest mining strategies and technologies to maximize your mining efforts. + +Happy mining!