9. Addresses

Ethereum addresses are represented by 40 hexadecimal digits prefixed with "0x". An address can refer to an account controlled by an individual public and private key pair or it can refer to the address of a smart contract.

For convenience, you can associate addresses with labels in MultiBaas.

  • You will be able to refer to the address with a human readable name in both the UI and the API
  • The label can be used consistently in the API if you want to change the underlying smart contract in a live application for example from a test contract to a production contract

When you deploy or link a contract you will be prompted to apply a label which will refer to the address. See 4.3 Deploy a smart contract and 4.4 Link a deployed smart contract instance. You can also associate a label with an address via the API.

Request
POST .../chains/ethereum/addresses
{
    "address": "0xcA8A074B51D285F43b0d9b2b7503d6486Db16b19",
    "label": "fox"
}
Response
{
    "status": 201,
    "message": "success",
    "result": {
        "label": "fox",
        "address": "0xcA8A074B51D285F43b0d9b2b7503d6486Db16b19",
        "balance": "0",
        "chain": "ethereum",
        "isContract": true,
        "modules": [],
        "contracts": [],
        "codeAt": "..."
    }
}

To list all labelled addresses known to MultiBaas, you can use the following request:

Request
GET .../chains/ethereum/addresses
Response
{
    "status": 200,
    "message": "success",
    "result": [
        {
            "label": "fox",
            "address": "0xcA8A074B51D285F43b0d9b2b7503d6486Db16b19"
        }
    ]
}

Personal Accounts

From the UI, personal accounts can also be labelled so that they will appear in the Singer Selector and be recognized and usable in other parts of the application.

To label a personal address for use:

  1. Select Accounts from the main menu
  2. Select My Account from the sub menu
  3. Scroll to the Personal Ethereum Accounts section or the Recipient Ethereum Accounts section
  4. Enter a label and a valid ethereum address
  5. Click Add

To remove a labelled personal address:

  1. Select Accounts from the main menu
  2. Select My Account from the sub menu
  3. Scroll to the Personal Ethereum Accounts section or the Recipient Ethereum Accounts section
  4. Click the rubbish bin icon under the Remove column next to the address you wish to remove
  5. Click Delete in the confirmation dialogue to confirm