Bulk Insert

This feature is used when two or more addContractLog or createContractLog must be contained in a single transaction during the contract life cycle or when more than one contracts are sent as a bulk transaction.

Contents

1. getUnsignedTxAddContractLog

This function generates addContractLog transactions as messages. Events that happen in a contract life cycle are contained in the addContractLog. Once the gas fee for generating a message is calculated, the transaction is created by the function that executes messages. * For a more detailed guide on calculating the gas fee and executing messages, please refer to functions 3 and 4.

Parameters

Return value

{
  typeUrl: '/firmachain.firmachain.contract.MsgAddContractLog',
  value: {
    creator: 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
    contractHash: 'da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b',
    timeStamp: 1669199517,
    eventName: 'createContract',
    ownerAddress: 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
    jsonString: '"{}"'
  }
}

2. getUnsignedTxCreateContractFile

This function generates "createContractLog" transactions as messages. Events that happen in a contract life cycle are contained in the addContractLog. Once the gas fee for generating a message is calculated, the transaction is created by the function that executes messages. * For a more detailed guide on calculating the gas fee and executing messages, please refer to functions 3 and 4.

Parameters

Return value

{
  typeUrl: '/firmachain.firmachain.contract.MsgCreateContractFile',
  value: {
    creator: 'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
    fileHash: 'da39330a6dfd90a91563603950f742240fa222580beecf36e141fe6410184e8b1669199724',
    timeStamp: 1669199724,
    ownerList: [
      'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u',
      'firma1nssuz67am2uwc2hjgvphg0fmj3k9l6cx65ux9u'
    ],
    metaDataJsonString: '"{}"'
  }
}

3. getGasEstimationSignAndBroadcast

This function estimates the gas fee required when generating transactions of the message list created by functions 1 and 2. When using Bulk Insert, there is a high chance where the gas fee could exceed the default gas fee(0.02fct). Therefore, prior to the execution of the transaction, the gas fee must be estimated properly.

Parameters

Return value

239964

Example Run Image

4. signAndBroadcast

This function lists the messages generated from functions 1 and 2 and then generates the message list as transactions.

Parameters

Return value

{
  code: 0,
  height: 428306,
  rawLog: '[
  {
    "events": [{
      "type":"message",
      "attributes":[{"key":"action","value":"CreateContractFile"}]
    }]
  }, {
    "msg_index":1,
    "events":[{
      "type":"message",
      "attributes": [{"key":"action","value":"CreateContractFile"}]
    }]
  }, {
    "msg_index":2,
    "events":[{
      "type":"message",
      "attributes": [{"key":"action","value":"CreateContractFile"}]
    }]
  }]',
  transactionHash: 'DC03E4872A97325D3AAA58B9B6296476E32AD42D8A448F6C7460F9D260CCBB56',
  gasUsed: 98872,
  gasWanted: 113703
}

Image of the transaction verified in Blockchain Explorer

5. Parameter Description

Last updated