Full Service API
  • Welcome!
  • Overview
  • API Endpoints
    • v2
      • Account
        • Account
          • Create Account
          • Import Account
          • Import Account Legacy
          • Get Accounts
          • Get Account Status
          • Get Balance
          • Update Account Name
          • Set Require Spend Subaddress
          • Remove Account
        • Account Secrets
          • Export Account Secrets
        • Address
          • Assign Address For Account
          • Get Address For Account
          • Get Addresses
          • Get Address Status
          • Verify Address
        • View Only Account
          • Import View Only Account
          • Create View Only Account Import Request
          • Create View Only Account Sync Request
          • Sync View Only Account
      • Transaction
        • Transaction
          • Build Transaction
          • Submit Transaction
          • Build And Submit Transaction
          • Build Burn Transaction
          • Build Unsigned Transaction
          • Build Unsigned Burn Transaction
        • Transaction Output TXO
          • Memo
            • Validate Sender Memo
          • Get TXO
          • Get TXOs
          • Get MobileCoin Protocol TXO
          • Get TXO Membership Proofs
          • Sample Mixins
          • Get TXO Block Index
        • Confirmation
          • Get Confirmations
          • Validate Confirmations
        • Receiver Receipt
          • Check Receiver Receipt Status
          • Create Receiver Receipts
        • Transaction Log
          • Get Transaction Log
          • Get Transaction Logs
          • Get MobileCoin Protocol Transaction
        • Payment Request
          • Create Payment Request
          • Check B58 Type
      • Block
        • Get Block
        • Get Blocks
        • Get Recent Blocks
        • Search Ledger
      • Network Status
        • Get Network Status
      • Wallet Status
        • Get Wallet Status
      • Version
        • Get Version
    • v1 (deprecated)
      • Account
        • Account
          • Create Account
          • Import Account
          • Import Account Legacy
          • Get Account
          • Get All Accounts
          • Get Account Status
          • Update Account Name
          • Remove Account
        • Account Secrets
          • Export Account Secrets
        • Address
          • Assign Address For Account
          • Get Addresses For Account
          • Verify Address
        • Balance
          • Get Balance For Account
          • Get Balance For Address
      • Transaction
        • Transaction
          • Build Transaction
          • Submit Transaction
          • Build And Submit Transaction
          • Build Split Txo Transaction
        • Transaction Output TXO
          • Get TXO
          • Get MobileCoin Protocol TXO
          • Get TXOs For Account
          • Get TXOs For View Only Account
          • Get All TXOs For Address
        • Confirmation
          • Get Confirmations
          • Validate Confirmations
        • Receiver Receipt
          • Check Receiver Receipt Status
          • Create Receiver Receipts
        • Transaction Log
          • Get Transaction Object
          • Get Transaction Log
          • Get Transaction Logs For Account
          • Get All Transaction Logs For Block
          • Get All Transaction Logs Ordered By Block
          • Get MobileCoin Protocol Transaction
        • Payment Request
          • Create Payment Request
          • Check B58 Type
      • Gift Code
        • Build Gift Code
        • Submit Gift Code
        • Get Gift Code
        • Get All Gift Codes
        • Check Gift Code Status
        • Claim Gift Code
        • Remove Gift Code
      • Block
        • Get Block
      • Network Status
        • Get Network Status
      • Wallet Status
        • Get Wallet Status
      • Version
        • Get Version
    • Signer Service
      • Create Account
      • Get Account
      • Sign Transaction
      • Sync Txos
  • Usage
    • Getting Started
      • Running Full Service
      • Create an Account
      • Receiving MobileCoin
      • Sending MobileCoin
      • Next Steps
    • Full Service Network Diagram
    • Supported Token Metadata
    • Database Usage
    • API Key
    • View Only Account
      • Signer
      • Signer Service
    • No Wallet Mode
    • Validator Service
      • Running
      • Running With TLS
    • Mirror Service
      • Running
      • Running With TLS
      • Running With Encryption
    • Logging
      • Text Logs (syslog style)
      • Crash Reports
    • T3
    • Sender Memos
  • FAQ
    • Resolving Disputes
    • How do I check if Full-Service is operational?
    • Where are logs stored?
    • How do I speed up account import?
    • What is the precision of MOB?
  • Glossary
    • Account
    • Block
    • Blockchain
    • Consensus Protocol
    • Fog
    • Full Service
    • Key Image
    • Ledger
    • MOB
    • Public Address
    • Secure Enclave
    • Subaddress
    • Transaction
    • Transaction Proposal
    • Validator Node
    • Validator Service
Powered by GitBook
On this page

Was this helpful?

  1. Usage
  2. Getting Started

Sending MobileCoin

The last step in developing your Wallet Interface is to connect to the build and submit transaction endpoint. Sending transactions enables the Exchange to send MOB to customers, as well as to transfer MOB between accounts that the Exchange controls.

For all transactions, the input txos will be selected automatically unless the input txos are specified during the transaction build step. This is generally not recommended and users should let input txos be automatically selected.

Review the initial balance of your account by calling get_account_status with your account_id generated from the Create an Account section.

Since you are running a test that doesn't require you to review the transaction proposal before submitting it to the ledger, call the convenience method build_and_submit_transaction to send MOB to a public address. Keep note of the transaction_log_id from the response, as we will need for the next step.

async function buildAndSubmitTransaction() {
 const response = await fetch('http://127.0.0.1:9090/wallet/v2', {
   method: 'POST',
   body: `{
     "method": "build_and_submit_transaction",
     "params": {
         "account_id": "1f32a...",
         "recipient_public_address": "3yNzpvKEpis...",
         "amount": {"value": "1000000000", "token_id": "0"}
     },
     "id": 1,
     "jsonrpc": "2.0"
   }`,
   headers: {
     'Content-Type': 'application/json'
   }
 });
 return await response.json();
}

buildAndSubmitTransaction().then((response) => {
 console.log(response);
});
from mobilecoin.client import ClientSync, Amount
client = ClientSync()
transaction_log, tx_proposal = client.build_and_submit_transaction(
    account_id='1f32a...',
    amount=Amount.from_display_units(1.0, 'MOB'),
    to_address='3yNzpvKEpis...',
)

To verify whether the transaction was successful, call get_transaction_log with the transaction_log_id from the previous step. The response will have a field called status which should say succeeded once the transaction clears on the blockchain.

async function getTransactionLog() {
 const response = await fetch('http://127.0.0.1:9090/wallet/v2', {
   method: 'POST',
   body: `{
     "method": "get_transaction_log",
     "params": {
         "transaction_log_id": "ewvvf4...1f32a"
     },
     "id": 1,
     "jsonrpc": "2.0"
   }`,
   headers: {
     'Content-Type': 'application/json'
   }
 });
 return await response.json();
}

getTransactionLog().then((response) => {
 console.log(response);
});
from mobilecoin.client import ClientSync, Amount
client = ClientSync()
transaction_log = client.get_transaction_log(
    transaction_log_id='ewvvf4...'
)

Transactions typically get processed by consensus and are added to the blockchain in a few seconds. Once a block has appeared on the blockchain, it is finalized and does not require waiting for a certain number of blocks to pass (unlike many other cryptocurrencies).

Congratulations, you just sent your first transaction!

PreviousReceiving MobileCoinNextNext Steps

Last updated 2 years ago

Was this helpful?