API
API Reference (Cosmos)
Builder API
Transaction Builder
Build Transaction

Build Transactions

[POST] /v1/:network/tx-builder

This API returns the SignDoc data for broadcasting transactions.
The response includes tx for generating the signature, original messages used to create the SignDoc, fee value, and basic information of the account.
Users can either generate the signature directly without 0x from the value and broadcast it, or use the provided broadcast API to send the tx.


Multi sign account is not supported yet.

Request

Headers
Authorization: Bearer {access_token}
Content-Type: application/json

Response

Example
{
  // SignDoc for generating the signature. Use the data without '0x'
  "tx": "0x0aa6010a98010a232f636f736d6f732e7374616b696e612e763162657461312e4d736744656c656761746512710a2d636f736d6f73316772306533706a3379366671767a79666d3071787977396835647766727668387a76337839701234636f736d6f7376616c6f70657231636c707172346e726b346b68676b786a3738666377776836646c337577346570736c7566666e1a0a0a057561746f6d120131120974657374206d656d6f12660a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034d09bdfbf996ebc038336238f20c6690d3592abbaafa0557c93ba6d76c0ea2d412040a020801185c12120a0c0a057561746f6d120337363010c7c5121a0b636f736d6f736875622d3420f1ca26",
  // Original data that user transfer
  "messages": [
    {
      "type": "cosmos.staking.v1beta1.MsgDelegate",
      "delegatorAddress": "osmo1gr0e3pj3y6fqvzyam0qxyw9h5dwfrvh8zv3x9p",
      "validatorAddress": "osmovaloper1clpqr4nrc4khgkxj78fcwwh6dl3uw4epsluffn",
      "amount": { "denom": "uosmo", "amount": "1" }
    }
  ],
  // Transaction fee
  "fee": { "amount": [{ "denom": "uosmo", "amount": "760" }], "gas": "303815" },
  // Account public key of signer
  "publicKey": {
    "@type": "/cosmos.crypto.secp256k1.PubKey",
    "key": "A00Jvfv1luvAODaiOPIMZpDTWSq7qvoFV8k7ptdsDqLU"
  },
  // Account number of signer
  "accountNumber": "63277",
  // Account sequence of signer
  "sequence": "12"
}

How to make a public key from private key

Make Public Key
const privateKey = Buffer.from(
  '1acbcaf3fec7fcbe93afa3cafd8bacf8b1fbcaccc0accdb9ef896fd8eafc135a',
  'hex',
);
const pubKeyUint8Array = TinySecp256k1.pointFromScalar(privateKey, true);
if (!pubKeyUint8Array) {
  throw new Error('Invalid private key');
}
 
// Use this publicKey when sending a transaction (tx) for the first time.
const publicKey = Buffer.from(pubKeyUint8Array).toString('base64');

Send Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.bank.v1beta1.MsgSend",
      // Sender Address
      "fromAddress": "string",
      // Receiver Address
      "toAddress": "string",
      // Amount Array
      "amount": [
        {
          "denom": "string",
          "amount"": string"
        }
      ]
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Delegate Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.staking.v1beta1.MsgDelegate",
      // Sender Address
      "delegatorAddress": "string",
      // Validator Address to delegate
      "validatorAddress": "string",
      // Amount
      "amount": {
        "denom": "string",
        "amount"": string"
      }
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Undelegate Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.staking.v1beta1.MsgUndelegate",
      // Sender Address
      "delegatorAddress": "string",
      // Validator Address to undelegate
      "validatorAddress": "string",
      // Amount
      "amount": {
        "denom": "string",
        "amount"": string"
      }
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Begin Redelegate Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.staking.v1beta1.MsgBeginRedelegate",
      // Sender Address
      "delegatorAddress": "string",
      // From Validator Address to redelegate
      "validatorSrcAddress": "string",
      // To Validator Address to redelegate
      "validatorDstAddress": "string",
      // Amount
      "amount": {
        "denom": "string",
        "amount"": string"
      }
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Claim Delegate Rewards Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
      // Sender Address
      "delegatorAddress": "string",
      // Validator Address to claim rewards
      "validatorAddress"": string"
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Claim Validator Commissions Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission",
      // Validator Address to withdraw validator commission
      "validatorAddress"": string"
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Governance Vote Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{"type": "string", "key": "string"}],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmos.gov.v1beta1.MsgVote",
      // Proposal ID
      "proposalId": "string",
      // Voter
      "voter": "string",
      // Vote Option("VOTE_OPTION_UNSPECIFIED" | "VOTE_OPTION_YES" | "VOTE_OPTION_ABSTAIN" | "VOTE_OPTION_NO" | "VOTE_OPTION_NO_WITH_VETO")
      "option"": string"
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Wasm Contract Execute Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{ "type": "string", "key": "string" }],
  // Message Array
  "messages": [
    {
      // Message Type
      "type": "cosmwasm.wasm.v1.MsgExecuteContract",
      // Sender
      "sender": "string",
      // Contract Address
      "contract": "string",
      // Execute Messages
      "msg": {},
      // Funds
      "funds": []
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Authz Grant Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{ "type": "string", "key": "string" }],
  // Message Array
  "messages": [
    {
      // GeneraicAuthorization
      "type": "cosmos.authz.v1beta1.MsgGrant",
      "granter": "string",
      "grantee": "string",
      "grant": {
        "authorization": {
          // Auth Type("GenericAuthorization" | "StakeAuthorization" | "SendAuthorization")
          "type": "GenericAuthorization",
          "msg": "string"
        },
        "expiration": "datetime"
      }
    },
    {
      // StakeAuthorization
      "type": "cosmos.authz.v1beta1.MsgGrant",
      "granter": "string",
      "grantee": "string",
      "grant": {
        "authorization": {
          // Auth Type("GenericAuthorization" | "StakeAuthorization" | "SendAuthorization")
          "type": "StakeAuthorization",
          "maxTokens": { "denom": "string", "amount": "string" },
          // When used in conjunction with a denyList, the allowList is not applied
          "allowList": { "address": ["string"] },
          "denyList": { "address": ["string"] },
          // Authorization Type("AUTHORIZATION_TYPE_DELEGATE" | "AUTHORIZATION_TYPE_UNDELEGATE" | "AUTHORIZATION_TYPE_REDELEGATE")
          "authorizationType": "string"
        },
        "expiration": "datetime"
      }
    },
    {
      // SendAuthorization
      "type": "cosmos.authz.v1beta1.MsgGrant",
      "granter": "string",
      "grantee": "string",
      "grant": {
        "authorization": {
          // Auth Type("GenericAuthorization" | "StakeAuthorization" | "SendAuthorization")
          "type": "SendAuthorization",
          "spendLimit": [{ "denom": "string", "amount": "string" }]
        },
        "expiration": "datetime"
      }
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Authz Execute Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{ "type": "string", "key": "string" }],
  // Message Array
  "messages": [
    {
      "type": "cosmos.authz.v1beta1.MsgExec",
      "grantee": "string",
      "msgs": [
        {
          // type_url excluding '/' (ex: cosmos.bank.v1beta1.MsgSend)
          "type": "string"
          // the values included in the corresponding type message
        }
      ]
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Authz Revoke Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{ "type": "string", "key": "string" }],
  // Message Array
  "messages": [
    {
      "type": "cosmos.authz.v1beta1.MsgRevoke",
      "granter": "string",
      "grantee": "string",
      // msgTypeUrl
      // GenericAuthorization, you can simply use the msg value of that authorization as it is
      // SendAuthorization, you should use /cosmos.bank.v1beta1.MsgSend
      // StakeAuthorization, you should provide values based on the Authorization Type granted.
      //   - AUTHORIZATION_TYPE_DELEGATE, use /cosmos.staking.v1beta1.MsgDelegate.
      //   - AUTHORIZATION_TYPE_UNDELEGATE, use /cosmos.staking.v1beta1.MsgUndelegate
      //   - AUTHORIZATION_TYPE_REDELEGATE, use /cosmos.staking.v1beta1.MsgBeginRedelegate
      "msgTypeUrl": "string"
    }
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body

Multiple Message Type of Transaction

Body
{
  // Signer Address
  "signer": "string",
  // Tx Memo
  "memo": "string",
  // !!! When sending a transaction (tx) for the first time, must provide the public key
  // pubkey type ("tendermint/PubKeySecp256k1" | "ethermint/PubKeyEthSecp256k1" | "injective/PubKeyEthSecp256k1")
  "pubkey": [{ "type": "string", "key": "string" }],
  // Message Array
  "messages": [
    // The message types within the messages defined above
  ]
}

Try API

Method : POST
URL
/v1/:network/tx-builder
CallURL
https://apis.mintscan.io/v1/:network/tx-builder
Header
Bear Token*
Parameters
network*
Body