Before Getting Started

  • The x-chain-id value for calling the API is 8217 (Mainnet) or 1001 (Kairos).
  • Essential parameters for calling APIs are described in individual examples.

Values that a user needs to enter for calling APIs will be represented with one pair of braces ({}). A user must enter the following values.

Item Description Note
chain-id 8217 or 1001 Kaia Mainnet or Kairos
access-key-id Auth ID accessKeyId obtained from KAS Console > [Security] > [Credential]
secret-access-key Auth Password secretAccessKey obtained from KAS Console > [Security] > [Credential]
krn (optional) ID of Account Pool Unnecessary when using Default Account Pool

A KAS API Authentication Key (API Auth Key) provides access to all KAS services and all the rights to a Kaia account which was created by calling Wallet API via this API Auth Key. The rights here include accessing and transferring all the assets (KAIA, etc.) of or sending a transaction from a Kaia account. If you shared your API Auth Key with any unauthorized personnel, your Kaia account could be compromised and might cause unwanted transaction execution.

danger

DO NOT share your API Auth Key (Secret AccessKey or Authorization) with any unauthorized personnel DO PUT efforts necessary to keep your API Auth Key safe for the security of your KAS/Kaia account.

Multiple Signing

The term "multisig" means multiple signatures. Kaia needs transactions to be signed before sending them. In some cases, a single transaction must be signed by several Kaia accounts as the account used to send the transaction is a multisig with Multiple Signing Key.

info

For more details on transactions and signing transactions, refer to the followings. For changing the account key into a multisig key, refer to the followings.

Send Multiple Signing Transaction

You can use a multisig account (the account that owns Multiple Signing Key) to send a transaction that has been signed by multiple Kaia accounts. Follow the instructions below for sending a multisig KAIA transmission transaction.

To send KAIA, the user must send the transaction using KAS to Kaia Node and pay the transaction fee for this. To call the API, he/she must first create an Account Pool and account, and then select an account to use. In this example, the deploying account must directly pay the transaction fee for sending KAIA.

As an example of sending a transaction with multiple signing, the following steps show how a sending KAIA transaction receives multiple signatures to be sent.

  1. Create Kaia account in KAS
  2. Update Account to Multiple Signing Account(=Update AccountKey to AccountKeyWeightedMultiSig)
  3. Create KAIA Sending Transaction
  4. Receive All Required Signatures on KAIA Sending Transaction in Pending
info

Once the pending transaction is fully signed as required, it is automatically sent to Kaia.

Get List of Pending Transactions

Search for the list of pending transactions from the current account.

The transaction status will be set to "Pending" if the current account is a multisig account that has not obtained enough signatures for sending a transaction (=sum of the weights of keys used for signing did not exceed the threshold). It will remain pending until it gets the required number of signatures if the signatures are not enough for sending a transaction, although the transaction is sent by a multisig account.

To call the API, he/she must first create an Account Pool and account, and then select an account to use.

info

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

API Request

Call the API for loading pending transactions among those entered Kaia EOAs. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

Query Parameter

You can receive API response values with Cursor-based Pagination. The search range can also be set by second.

Parameter Description Example Required or Not
size the number of items in the API response (min=1, max=1000, default=100) size=100 False
cursor the cursor required to get the next batch of response items cursor=J9Ag...VM6z False
to-timestamp Search Range: The last timestamp (sec) to-timestamp=15921809920 False
from-timestamp Search Range: The first timestamp (sec) from-timestamp=1592360291 False
cURLJavaScriptJava
Copy
Copied
curl --location --request GET "https://wallet-api.klaytnapi.com/v2/multisig/account/0xc6C9356887b7F7887918Bf577417E5D8De253295/tx" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
Copy
Copied
const result = await caver.kas.wallet.getMultiSigTransactionList(
  "0x3EE8aC5eBDDcF408020D1125437302B2267e5A8C"
);
Copy
Copied
MultisigTransactions transactions = caver.kas.wallet.getMultiSigTransactionList("0xBF19457580DcF1ed9E586F0C74747311a0d9d070");
System.out.println(transactions);

API Response

Here is the response of the pending transaction list search API.

cURLJavaScriptJava
Copy
Copied
{
  "cursor": "",
  "items": [
    {
      "address": "0xc6C9356887b7F7887918Bf577417E5D8De253295",
      "chainId": 1001,
      "createdAt": 1599144020,
      "multiSigKeys": [
        {
          "address": "0xc6C9356887b7F7887918Bf577417E5D8De253295",
          "weight": 3
        },
        {
          "address": "0x0b7caaf70e7A0a5399041c64711E535CE8B3cf7d",
          "weight": 1
        }
      ],
      "status": 2,
      "threshold": 4,
      "transactionId": "0x65111d4fba621a1bfa3bd97c219b3e0454471cf3c07827396f1202946df51ee2",
      "txData": {
        "from": "0xc6c9356887b7f7887918bf577417e5d8de253295",
        "gasLimit": 1000000,
        "gasPrice": "0x5d21dba00",
        "input": "0x6d656d6f",
        "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
        "typeInt": 16,
        "value": "0x1001"
      },
      "type": "TX",
      "updatedAt": 1599144020
    },
    {
      "address": "0xc6C9356887b7F7887918Bf577417E5D8De253295",
      "chainId": 1001,
      "createdAt": 1599144013,
      "multiSigKeys": [
        {
          "address": "0xc6C9356887b7F7887918Bf577417E5D8De253295",
          "weight": 3
        },
        {
          "address": "0x0b7caaf70e7A0a5399041c64711E535CE8B3cf7d",
          "weight": 1
        }
      ],
      "status": 2,
      "threshold": 4,
      "transactionId": "0x36f9c5794fc141d3625e89a1164e6105fa973e8214d23bc6a210d2afe9dba6dd",
      "txData": {
        "from": "0xc6c9356887b7f7887918bf577417e5d8de253295",
        "gasLimit": 1000000,
        "gasPrice": "0x5d21dba00",
        "input": "0x6d656d6f",
        "to": "0x2f87ba64de5526f7880f21481effbf950f70005c",
        "typeInt": 16,
        "value": "0x100"
      },
      "type": "TX",
      "updatedAt": 1599144013
    }
  ]
}
Copy
Copied
MultisigTransactions {
  cursor: '',
  items: [
    PendedTransaction {
      chainId: 1001,
      createdAt: 1602119611,
      status: 2,
      threshold: 3,
      transactionId: '0xff94d85dd096b8f7d46763e226e0998346e9d75ba813cfd73520f700bf0207a0',
      updatedAt: 1602119611,
      address: '0x3EE8aC5eBDDcF408020D1125437302B2267e5A8C',
      multiSigKeys: [
        MultisigAddress {
          address: '0x38614901Dcd4FAF796A0e2FE8aC19E5147A59f3f',
          weight: 1
        },
        MultisigAddress {
          address: '0x9E5FE19695ac38239E4432eC5BE7bBEFcc4d415A',
          weight: 1
        },
        MultisigAddress {
          address: '0xB7B4f049eFC6B650ACCDa59229a46B19210c2cfA',
          weight: 1
        }
      ],
      txData: TxData {
        from: '0x3ee8ac5ebddcf408020d1125437302b2267e5a8c',
        gas: 25000,
        gasPrice: '0x5d21dba00',
        to: '0x76c6b1f34562ed7a843786e1d7f57d0d7948a6f1',
        typeInt: 8,
        value: '0x1'
      },
      type: 'TX'
    }
  ]
}
Copy
Copied
class MultisigTransactions {
    cursor:
    items: [class PendedTransaction {
        address: 0xBF19457580DcF1ed9E586F0C74747311a0d9d070
        chainId: 1001
        createdAt: 1602562698
        multiSigKeys: [class MultisigAddress {
            address: 0xBF19457580DcF1ed9E586F0C74747311a0d9d070
            weight: 2
        }, class MultisigAddress {
            address: 0x9dF8f1c6d7E6A1206083DB8e1e51d7dAe28B0312
            weight: 2
        }, class MultisigAddress {
            address: 0xB011BE8EB2898417D53A91E6979118D157638C5d
            weight: 2
        }]
        status: 2
        threshold: 3
        transactionId: 0x86e3ab3978a73264af4fa968240b278f81196189803d038ef2da3e92f364c5aa
        txData: class TxData {
            from: 0xbf19457580dcf1ed9e586f0c74747311a0d9d070
            gas: 1000000
            gasPrice: 0x5d21dba00
            input: null
            to: 0x95e3fd82ecd2b32cae8618599971f5f47f4bc110
            typeInt: 8
            value: 0x1
        }
        type: TX
        updatedAt: 1602562698
    }]
}
info

"typeInt" variable is a value for identifying the transaction type. For details about the types of transactions, please visit here.

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.

Sign Pending Transaction

Sign the pending transactions by calling Sign Transaction API. The transaction status will be set to "Pending" if the current account is a multisig account that has not obtained enough signatures for sending a transaction (=sum of the weights of keys used for signing did not exceed the threshold).

To call the API, he/she must first create an Account Pool and account, and then select an account to use.

info

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

API Request

Call the pending transaction signature API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

cURLJavaScriptJava
Copy
Copied
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/multisig/account/0x68Da92c0557A62C292598A3156B770df6e07BD83/tx/0x5d7beaf43d63d27bf8ddd11ac32ee3c853abfe869988526f92431a63fe3dcb1d/sign" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
Copy
Copied
const address = "0x127089fF8154B145e8dcad7C112A949C2a452cb8";
const transactionId =
  "0xfe2be4de37ed40c6c049d3c2771a6e7577916c951dd331b297b517b25609b4ad";
const result = await caver.kas.wallet.signMultiSigTransction(
  address,
  transactionId
);
Copy
Copied
String address = "0x9dF8f1c6d7E6A1206083DB8e1e51d7dAe28B0312";
String transactionId = "0x86e3ab3978a73264af4fa968240b278f81196189803d038ef2da3e92f364c5aa";

MultisigTransactionStatus status = caver.kas.wallet.signMultiSigTransaction(address, transactionId);
System.out.println(status);

API Response

Here is the response of the pending transaction signature API.

cURLJavaScriptJava
Copy
Copied
// If some signatures are missing when the sum of the weights must be four (4) (=threshold) or higher: If a signature with a weight of one (1) is obtained
{
  "reminders": [
    "0xf24e881d3cFF241859203DB09a28421267B7F6E6"
  ],
  "signedWeight": 1,
  "status": "Signed",
  "threshold": 4,
  "transactionID": "0xfa275dba88d197a85504ef70e0dd2640acc708817e9eb3933d7850acfb048649",
  "weight": 1
}

// If all signatures are obtained for sending the transaction when the sum of the weights must be four (4) (=threshold) or higher: If a signature with a weight of one (1) and another signature with a weight of three (3) are obtained
{
  "signedWeight": 4,
  "status": "Submitted",
  "threshold": 4,
  "transactionHash": "0x81f2ff422eae9b40d65b7a6f1e3c5ca598f83d1473ccc87e53d51b875fe75c82",
  "transactionID": "0xfa275dba88d197a85504ef70e0dd2640acc708817e9eb3933d7850acfb048649",
  "weight": 3
}
Copy
Copied
MultisigTransactionStatus {
  signedWeight: 1,
  status: 'Signed',
  threshold: 3,
  transactionId: '0xfe2be4de37ed40c6c049d3c2771a6e7577916c951dd331b297b517b25609b4ad',
  weight: 1,
  reminders: [
    '0xc4Dd4D041430c65d95CaaF6fB1506A542d6583d0',
    '0x55afF286674559caB1Fd4427C91C4cC045766140'
  ]
}
Copy
Copied
class MultisigTransactionStatus {
    signedWeight: 4
    status: Submitted
    threshold: 3
    transactionHash: 0xa9286090d32df1aa8aa08235293bc0ddaffc84dc74b712d827a7a93e7eff9e36
    transactionId: 0x86e3ab3978a73264af4fa968240b278f81196189803d038ef2da3e92f364c5aa
    weight: 2
    reminders: [0xB011BE8EB2898417D53A91E6979118D157638C5d]
}
  • reminders : Account addresses of owners of unsigned keys
  • signedWeight : The cumulative sum of weights of signed keys for a specific transaction, which must exceed the "threshold" to send the transaction
  • weight : The weight of signed key

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.

Sign Pending Transaction - Use Separate Signatures

Sign pending transactions. Append a signature to a pending transaction in this section.

A transaction can be signed using the signature value if there is a Kaia account created outside KAS that has a signature value. However, the transaction status will be set to "Pending" if the current account is a multisig account that has not obtained enough signatures for sending a transaction (=sum of weights of keys used for signing did not exceed the threshold).

To call the API, he/she must first create an Account Pool and account, and then select an account to use.

info

For details about KAS SDK (caver-js/caver-java extensions) installation and execution, please visit KAS SDK. For more details on creating an Account Pool, account, and selecting an account, refer to Getting Started.

API Request

Call the pending transaction signature API. You may use the REST API or KAS SDKs (caver-js, caver-java extensions) for this.

cURLJavaScriptJava
Copy
Copied
curl --location --request POST "https://wallet-api.klaytnapi.com/v2/multisig/tx/0x5d7beaf43d63d27bf8ddd11ac32ee3c853abfe869988526f92431a63fe3dcb1d/sign" \
-u {access-key-id}:{secret-access-key} \
--header "x-chain-id: {chain-id}" \
--header "Content-Type: application/json" \
--data-raw "{
  "signatures": [
    {
      "R": "0xaa2ae446f5dd35df839e8ec2005aede91f0b3ea0f1e6889f4294d4760529bfaf",
      "S": "0x7b3efab682bcc86f7050819e12a2b5ea916871d684b9e1c8ca8f49869df41896",
      "V": "0x7f5"
    }
  ]
}"
Copy
Copied
const transactionId = '0x7e7f18b16fb1807654d9cd2b1ad1c0cbb649b81648543a792a6db2f43e1a8ad5'
const signatures = [
  {
    V: '0x7f6'
    R: '0xc2902ebb52f554fd257eda57a3fe7cbf1e046bb43d1472bd396f2c3053f8bf55',
    S: '0x32f7d5b99e91510ecaefc5fe65816e6e43043c408873b2453d02116be1674278',
  }
]
const result = await caver.kas.wallet.appendSignatures(transactionId, signatures)
Copy
Copied
String transactionID = "0x7e7f18b16fb1807654d9cd2b1ad1c0cbb649b81648543a792a6db2f43e1a8ad5";

Signature signature = new Signature();
signature.setV("0x7f6");
signature.setR("0xeacce28162b45142d2eefb77f124e15384597745cbf5996d3bfa5d61186e1769");
signature.setS("0x5254543d277f7b471dd684d349cde586f34e04ed935ed57fd4c66171883e947b");

SignPendingTransactionBySigRequest request = new SignPendingTransactionBySigRequest();
request.setSignatures(Arrays.asList(signature));

MultisigTransactionStatus transactionStatus = caver.kas.wallet.appendSignatures(transactionID, request);
System.out.println(transactionStatus);
  • signatures : A prepared signature value of ECDSA signature information (R, S) and public key restoration information (V).

API Response

Here is the response of the pending transaction signature API.

cURLJavaScriptJava
Copy
Copied
// If some of signatures are obtained when multisig is required: If a signature with a weight of three (3) is obtained only when the threshold is four (4)
{
  "reminders": [
    "0xA9183eD590ebEDf06D415ae684E3f18d06789f8d"
  ],
  "signedWeight": 3,
  "status": "Signed",
  "threshold": 4,
  "transactionId": "0xa0cabe28c75aa6babbf7e85b5033641c46d0f2e7b714e47103716695d454a45a",
  "weight": 3
}

// If all signatures are obtained as required when multisig is required for sending a transaction: If a signature with a weight of one (1) is obtained only when the threshold is four (4)
{
  "signedWeight": 4,
  "status": "Submitted",
  "threshold": 4,
  "transactionHash": "0xf1ced3855f3cd1d5220f2991ec4ba845ec747a0c01028c2d63de3662ddad2083",
  "transactionId": "0xae20ed8ce084d372fb804ea6f6073ba2f485a64bac086199efb83d665d0b31f2",
  "weight": 1
}
Copy
Copied
MultisigTransactionStatus {
  signedWeight: 1,
  status: 'Signed',
  threshold: 3,
  transactionId: '0x7e7f18b16fb1807654d9cd2b1ad1c0cbb649b81648543a792a6db2f43e1a8ad5',
  weight: 1,
  reminders: [
    '0x54f91a712DAd60F78Fbb49E6043DF35dA37842Fd',
    '0x7725Ef7B7372Fd6E9093E8fA57f2c8a4c0622b8c'
  ]
}
Copy
Copied
class MultisigTransactionStatus {
    signedWeight: 4
    status: Submitted
    threshold: 3
    transactionHash: 0x9d969960396e66c4abe2e2495b852f1b99835f310c3f66d2f7b34eea43e29122
    transactionId: 0x7e7f18b16fb1807654d9cd2b1ad1c0cbb649b81648543a792a6db2f43e1a8ad5
    weight: 2
    reminders: [0x9dF8f1c6d7E6A1206083DB8e1e51d7dAe28B0312]
}
  • reminders : Account addresses of owners of unsigned keys
  • signedWeight : Cumulative sum of weights of signed keys for this transaction, which must exceed threshold to send the transaction
  • weight : Weight of signed key

For details about this API, please visit here. For inquires about this document or KAS, please visit KAS Developers Forum.