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

Receiving MobileCoin

PreviousCreate an AccountNextSending MobileCoin

Last updated 2 years ago

Was this helpful?

To receive , you must provide the sender with an account address.

When you created your in the previous section, the API response included a main_address that you can share to receive funds by default. The main_address is the for the at index 0.

Using the main_address generated in the previous section, send a transaction from an account that already has some .

After it has been sent, call , which should return with a balance of unspent of the amount that was sent by the sender.

Congratulations, you just received your first transaction!

Generating a Unique Subaddress

If an Exchange wants to have multiple people paying them, the Exchange will not be able to tell which customers have paid because MobileCoin is private, unlike some other cryptocurrencies. MobileCoin has provided public addresses for subaddresses in order to provide a unique for each with a customer.

All subaddresses up to unsigned int max (18_446_744_073_709_551_615) are automatically associated with an account; however, the Exchange will need to assign a range of subaddresses during or after account creation in order to get the public address for that subaddress or to check the balance to see if the customer has deposited funds at that subaddress.

To generate a new unique subaddress, you can call the .

async function assignAddressForAccount() {
  const response = await fetch('http://localhost:9090/wallet/v2', {
    method: 'POST',
    body: `{
      "method": "assign_address_for_account",
      "params": {
          "account_id": "1f32a...",
      },
      "jsonrpc": "2.0",
      "id": 1
    }`,
    headers: {
      'Content-Type': 'application/json'
    }
  });
  const json = await response.json();
  return json.result.address;
}

assignAddressForAccount().then((address) => {
  console.log(address.public_address_b58);
});

\

from mobilecoin.client import ClientSync
client = ClientSync()
address = client.assign_address_for_account(account_id='1f32a...')
print(address['public_address_b58'])

It is important that you keep track of which subaddress is for which customer depositing to your account

Using the public address that we just created, send some MOB to it.

async function getAddressStatus() {
  const response = await fetch('http://localhost:9090/wallet/v2', {
    method: 'POST',
    body: `{
      "method": "get_address_status",
      "params": {
          "address": "1f32a...",
      },
      "jsonrpc": "2.0",
      "id": 1
    }`,
    headers: {
      'Content-Type': 'application/json'
    }
  });
  const json = await response.json();
  return json.result;
}

getAccountStatus().then((accountStatus) => {
  // Show unspent balance for MOB, which is token_id 0.
  // The balance is in pico-MOB, so divide by 1e12 to get whole MOB.
  console.log(`${addressStatus.balance_per_token[0].unspent / 1e12} MOB`);
});
from mobilecoin.client import (
    ClientSync as Client,
    WalletAPIError
)

account_id = "ae15c..."
client = Client()
public_address = "<public address from previous step>"
status = client.get_address_status(public_address)
balance_per_token = status['balance_per_token']
mob_balance = balance_per_token['0'] # MOB is token 0
print(mob_balance)

To check the balance of this specific subaddress, you can call the .

MOB
account
subaddress
account
MOB
get_account_status
MOB
public address
transaction
Assign Address For Account endpoint
Get Address Status endpoint