IOTA

IOTA supports the following signature kinds:

  • Transaction, unsigned transaction.

Transaction

Signs an unsigned transaction.

Field
Description
Type - Optiional

blockchainKind

Iota

String

kind

Transaction

String

transaction

The unsigned hex encoded transaction as shown below.

String

{
  "blockchainKind": "Iota",
  "kind": "Transaction",
  "transaction": "0x00000200080100000000000000002044732583a657f2d13bce82acc611e5ea6424508036f27e3a3277f24f55f9bfc60202000101000001010300000000010100b8737aab95b5d62407a921c23d26f28cd94da2df511276693a5cba782ae640ee01122efbd2244535c134ab802ad247b3ece73641e7ea8169b199bb6fa644af3ef32ffa94070000000020608d3f1e7023d0947f8274db06898744fadb3598769f8463070536ce489ca336b8737aab95b5d62407a921c23d26f28cd94da2df511276693a5cba782ae640eee803000000000000e06f3c000000000000"
}

IOTA does not have a serialized format for a signed transaction. The response only includes the signature. You must package it correctly before calling iota_executeTransactionBlock.

Typescript Example with IOTA SDK

First install the IOTA SDK. You can find the full documentation here: https://docs.iota.org/developer/ts-sdk/typescript/

Here a code sample to generate a signature via the Dfns TypeScript SDK:

import { IotaClient } from '@iota/iota-sdk/client'
import { Transaction } from '@iota/iota-sdk/transactions'

const walletId = 'wa-4to1j-8tho9-xxxxxxxxxxxxxxxx'
const wallet = await dfnsClient.wallets.getWallet({ walletId })

const client = new IotaClient({ url: process.env.IOTA_RPC_URL! })

const transaction = new Transaction()
const [coin] = transaction.splitCoins(transaction.gas, [1])
transaction.transferObjects([coin], '0xb8737aab95b5d62407a921c23d26f28cd94da2df511276693a5cba782ae640ee')
transaction.setSender(wallet.address!)
const bytes = await transaction.build({ client })

const res = await dfnsClient.wallets.generateSignature({
  walletId,
  body: {
    kind: 'Transaction',
    transaction: `0x${Buffer.from(bytes).toString('hex')}`,
  },
})

Last updated