3. 트랜잭션 서명하기

이전 페이지에서 합성한 멀티시그 키로 트랜잭션을 서명합니다.

트랜잭션 서명 방법은 플랫폼마다 상이하므로 아래 예제를 참고해주세요.



이더리움

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 1
	testnet(sepolia): 11155111
*/
const CHAIN_ID = 1;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f20180843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



바이낸스스마트체인

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { LegacyTransaction } from '@ethereumjs/tx';
import { Common, Hardfork } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 56
	testnet: 97
*/
const CHAIN_ID = 56;

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0xeb8085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID });
const tx =  LegacyTransaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;




폴리곤

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 137
	testnet(amoy): 80002
*/
const CHAIN_ID = 137;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f3818980843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



이더리움POW

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { LegacyTransaction } from '@ethereumjs/tx';
import { Common, Hardfork } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 10001
	testnet(sepolia): 11155111
*/
const CHAIN_ID = 56;

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0xeb8085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID });
const tx =  LegacyTransaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;




위믹스

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 1111
	testnet: 1112
*/
const CHAIN_ID = 1111;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f482045780843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



아비트럼

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 42161
	testnet(sepolia): 421614
*/
const CHAIN_ID = 42161;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f482a4b180843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



아발란체

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 43114
	testnet: 43113
*/
const CHAIN_ID = 43114;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f482a86a80843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 17217
	testnet: 27217
*/
const CHAIN_ID = 17217;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f482434180843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



크로마

// @ethereumjs/tx: 4.3.0
// @ethereumjs/common: 5.3.0
import { FeeMarketEIP1559Transaction } from '@ethereumjs/tx';
import { Common } from '@ethereumjs/common';

/*
	CHAIN_ID
	mainnet: 255
	testnet: 2358
*/
const CHAIN_ID = 255;
const HARDFORK = 'london';

const privateKey = '0x104cf1088fdbd926d9293a5c6fee6124983fd69d42a5e6f8158ead810ecac34b';
const stripedPrivateKey = privateKey.replace(/^0x/i, '');

const serializedUnsignedTransaction = '0x02f381ff80843b9aca0085098bca5a00825208944c81fec94ab7a764667ad35b55190cbeb4cd4a3487470de4df82000080c0808080';
const stripedSerializedUnsignedTransaction = serializedUnsignedTransaction.replace(/^0x/i, '');

const common = Common.custom({ chainId: CHAIN_ID }, { hardfork: HARDFORK });
const tx = FeeMarketEIP1559Transaction.fromSerializedTx(Buffer.from(stripedSerializedUnsignedTransaction, 'hex'), { common });

const signedTx = tx.sign(Buffer.from(stripedPrivateKey, 'hex'));
const serializedSignedTransaction = `0x${Buffer.from(signedTx.serialize()).toString('hex')}`;



솔라나

// @solana/web3.js: 1.53.0
// tweetnacl: 1.0.3
import { Keypair, Transaction } from "@solana/web3.js";
import * as nacl from "tweetnacl";

const privateKey =
  "d6431d92f4193050c367d4e10a1e2434f12a4b49dbf56b0703da772201742bf4";
const serializedUnsignedTransaction =
  "0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010001037962760b369fe2d7bdc02e5971bce71001c17a62e0fbfd3a9fdeb23025f4835e15576945a5c6e65f234b9398dfa0fdf7350ffd20d5cb8cb51d021bec42c876f10000000000000000000000000000000000000000000000000000000000000000c61a380468f123da0528156522932094f0c1763f35dde5d47278045ee74dda5101020200010c02000000a086010000000000";

const rawTransaction = Transaction.from(
  Buffer.from(serializedUnsignedTransaction, "hex")
);

const keypair = Keypair.fromSeed(Buffer.from(privateKey, "hex"));
const signature = nacl.sign.detached(
  rawTransaction.serializeMessage(),
  keypair.secretKey
);
rawTransaction.addSignature(keypair.publicKey, Buffer.from(signature));

const serializedSignedTransaction = rawTransaction.serialize().toString("hex");



파일코인

// @zondax/filecoin-signing-tools: 2.4.1
// @zondax/izari-filecoin: 1.0.2
import { Transaction } from "@zondax/izari-filecoin/transaction";
import { Wallet } from "@zondax/izari-filecoin/wallet";
import { SignatureType, NetworkPrefix } from "@zondax/izari-filecoin/artifacts";

/**
 * 각 네트워크 환경에 따라서 networkPrefix 변수의 값을 변경해주세요.
 * - mainnet -> NetworkPrefix.Mainnet
 * - testnet -> NetworkPrefix.Testnet
 */
const networkPrefix = NetworkPrefix.Testnet;
const privateKey =
  "0x7582b1afdd48305e208a223c4d1203f027e3f03c68338d4dcfa6909a515304b5";
const serializedUnsignedTransaction =
  "8a0055018c1f92e93fe0b8a2d9e90bfa020b0033d396007f5501772a5e7fa64b0891351f515d16a2837e4f38c7cd0247005af3107a40001a001743df440001898844000184ec0040";

(async () => {
  const rawTransaction = await Transaction.fromCBOR(
    networkPrefix,
    serializedUnsignedTransaction
  );

  const account = Wallet.recoverAccount(
    networkPrefix,
    SignatureType.SECP256K1,
    Buffer.from(privateKey.slice(2), "hex")
  );
  const signature = await Wallet.signTransaction(account, rawTransaction);
  const serializedSignedTransaction = signature.getData().toString("hex");
})();



트론

// tronweb: 5.3.2
// protobufjs: 7.1.2
import TronWeb from "tronweb";
import * as protobuf from "protobufjs";
import TronProto from "./tron.proto";

// 각 네트워크 환경에 따라서 주석을 해제해서 써주세요.
// mainnet
// const TronFullNodeRpcEndpoint = "https://api.trongrid.io";
// const TronSolidityNodeRpcEndpoint = "https://api.trongrid.io";
// testnet 
const TronFullNodeRpcEndpoint = "https://api.nileex.io";
const TronSolidityNodeRpcEndpoint = "https://api.nileex.io";

const tronWeb = new TronWeb({
  fullNode: TronFullNodeRpcEndpoint,
  solidityNode: TronSolidityNodeRpcEndpoint,
});
const privateKey =
  "A7E2E1088BF1683DCD1E32103ED22A84B893D2D6E9A550B77F67A124D02D96E2";
const serializedUnsignedTransaction =
  "0ad3010a02877a22088b36d0839c523a0a40e0cce7d182325aae01081f12a9010a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412740a1541d88542bb33429a083422090b43daa9af774267e1121541eca9bc828a3005b9a3b909f2cc5c2a54794de05f2244a9059cbb00000000000000000000000078dbdbf4b7e513fdea3a3e5eab336691e53e311a00000000000000000000000000000000000000000000000000000000000f424070ac89e4d182329001c8c1a603";

const root = protobuf.Root.fromJSON(TronProto);
const transaction = root.lookupType("protocol.Transaction");

function refineSignedTransaction(signedTransaction) {
  const { value } = signedTransaction.raw_data.contract[0].parameter;

  switch (signedTransaction.raw_data.contract[0].type) {
    case "TransferContract":
      signedTransaction.raw_data.contract[0].parameter.value = {
        owner_address: Buffer.from(value.owner_address, "hex"),
        to_address: Buffer.from(value.to_address, "hex"),
        amount: value.amount,
      };
      break;
    case "TransferAssetContract":
      signedTransaction.raw_data.contract[0].parameter.value = {
        asset_name: Buffer.from(value.asset_name, "hex"),
        owner_address: Buffer.from(value.owner_address, "hex"),
        to_address: Buffer.from(value.to_address, "hex"),
        amount: value.amount,
      };
      break;
    case "TriggerSmartContract":
      signedTransaction.raw_data.contract[0].parameter.value = {
        owner_address: Buffer.from(value.owner_address, "hex"),
        contract_address: Buffer.from(value.contract_address, "hex"),
        data: Buffer.from(value.data, "hex"),
        call_value: value.call_value,
        call_token_value: value.call_token_value,
        token_id: value.token_id,
      };
      break;
    default:
      break;
  }

  const { ref_block_bytes, ref_block_hash } = signedTransaction.raw_data;
  signedTransaction.raw_data.ref_block_bytes = Buffer.from(
    ref_block_bytes,
    "hex"
  );
  signedTransaction.raw_data.ref_block_hash = Buffer.from(
    ref_block_hash,
    "hex"
  );
  signedTransaction.signature =
    signedTransaction.signature?.map((signature) =>
      Buffer.from(signature, "hex")
    ) ?? undefined;

  return signedTransaction;
}

function serializeTransaction(signedTransaction) {
  const unserializedTransaction = JSON.parse(JSON.stringify(signedTransaction));
  const refinedTransaction = refineSignedTransaction(unserializedTransaction);

  const { value, type_url } = refinedTransaction.raw_data.contract[0].parameter;
  switch (refinedTransaction.raw_data.contract[0].type) {
    case "TransferContract": {
      const transferContract = root.lookupType("protocol.TransferContract");
      const message = transferContract.fromObject(value);
      unserializedTransaction.raw_data.contract[0].parameter = {
        value: transferContract.encode(message).finish(),
        type_url,
      };
      break;
    }
    case "TransferAssetContract": {
      const transferAssetContract = root.lookupType(
        "protocol.TransferAssetContract"
      );
      const message = transferAssetContract.fromObject(value);
      unserializedTransaction.raw_data.contract[0].parameter = {
        value: transferAssetContract.encode(message).finish(),
        type_url,
      };
      break;
    }
    case "TriggerSmartContract": {
      const triggerSmartContract = root.lookupType(
        "protocol.TriggerSmartContract"
      );
      const message = triggerSmartContract.fromObject(value);
      unserializedTransaction.raw_data.contract[0].parameter = {
        value: triggerSmartContract.encode(message).finish(),
        type_url,
      };
      break;
    }
    default:
      break;
  }
  const message = transaction.fromObject(unserializedTransaction);
  const serializedTransactoin = transaction.encode(message).finish();
  return Buffer.from(serializedTransactoin).toString("hex");
}

function deserializeTransaction(serializedUnsignedTransaction: string) {
  const decodedTransaction = transaction
    .decode(Buffer.from(serializedUnsignedTransaction, "hex"))
    .toJSON();

  const contract = {
    type: decodedTransaction.raw_data.contract[0].type,
    parameter: {
      value: {} as any,
      type_url: decodedTransaction.raw_data.contract[0].parameter["@type"],
    },
  };

  switch (contract.type) {
    case "TransferContract":
      contract.parameter.value = {
        owner_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.owner_address,
          "base64"
        ).toString("hex"),
        to_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.to_address,
          "base64"
        ).toString("hex"),
        amount: decodedTransaction.raw_data.contract[0].parameter.amount,
      };
      break;
    case "TransferAssetContract":
      contract.parameter.value = {
        asset_name: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.asset_name,
          "base64"
        ).toString("hex"),
        owner_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.owner_address,
          "base64"
        ).toString("hex"),
        to_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.to_address,
          "base64"
        ).toString("hex"),
        amount: decodedTransaction.raw_data.contract[0].parameter.amount,
      };
      break;
    case "TriggerSmartContract":
      contract.parameter.value = {
        owner_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.owner_address,
          "base64"
        ).toString("hex"),
        contract_address: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.contract_address,
          "base64"
        ).toString("hex"),
        data: Buffer.from(
          decodedTransaction.raw_data.contract[0].parameter.data,
          "base64"
        ).toString("hex"),
        call_value:
          decodedTransaction.raw_data.contract[0].parameter.call_value,
        call_token_value:
          decodedTransaction.raw_data.contract[0].parameter.call_token_value,
        token_id: decodedTransaction.raw_data.contract[0].parameter.token_id,
      };
      break;
    default:
      throw new Error("deserialize를 지원하지 않는 contract type입니다.");
  }

  const raw_data = decodedTransaction.raw_data;
  raw_data.ref_block_bytes = Buffer.from(
    decodedTransaction.raw_data.ref_block_bytes,
    "base64"
  ).toString("hex");
  raw_data.ref_block_hash = Buffer.from(
    decodedTransaction.raw_data.ref_block_hash,
    "base64"
  ).toString("hex");
  raw_data.contract = [contract];

  decodedTransaction.raw_data = raw_data;

  const txPb = tronWeb.utils.transaction.txJsonToPb(decodedTransaction);
  const raw_data_hex = tronWeb.utils.transaction.txPbToRawDataHex(txPb);
  const txID = tronWeb.utils.transaction.txPbToTxID(txPb).slice(2);

  const rawTransaction = {
    visible: false,
    txID,
    raw_data,
    raw_data_hex,
  };

  return rawTransaction;
}

(async () => {
  const rawTransaction = deserializeTransaction(serializedUnsignedTransaction);
  const signedTransaction = await tronWeb.trx.sign(rawTransaction, privateKey);
  const serializedSignedTransaction = serializeTransaction(signedTransaction);
})();


tron.proto.ts

const TronProto = {
  nested: {
    protocol: {
      options: {
        java_package: "org.tron.protos.contract",
        java_outer_classname: "TronInventoryItems",
        go_package: "github.com/tronprotocol/grpc-gateway/core",
      },
      nested: {
        Endpoint: {
          fields: {
            address: {
              type: "bytes",
              id: 1,
            },
            port: {
              type: "int32",
              id: 2,
            },
            nodeId: {
              type: "bytes",
              id: 3,
            },
            addressIpv6: {
              type: "bytes",
              id: 4,
            },
          },
        },
        PingMessage: {
          fields: {
            from: {
              type: "Endpoint",
              id: 1,
            },
            to: {
              type: "Endpoint",
              id: 2,
            },
            version: {
              type: "int32",
              id: 3,
            },
            timestamp: {
              type: "int64",
              id: 4,
            },
          },
        },
        PongMessage: {
          fields: {
            from: {
              type: "Endpoint",
              id: 1,
            },
            echo: {
              type: "int32",
              id: 2,
            },
            timestamp: {
              type: "int64",
              id: 3,
            },
          },
        },
        FindNeighbours: {
          fields: {
            from: {
              type: "Endpoint",
              id: 1,
            },
            targetId: {
              type: "bytes",
              id: 2,
            },
            timestamp: {
              type: "int64",
              id: 3,
            },
          },
        },
        Neighbours: {
          fields: {
            from: {
              type: "Endpoint",
              id: 1,
            },
            neighbours: {
              rule: "repeated",
              type: "Endpoint",
              id: 2,
            },
            timestamp: {
              type: "int64",
              id: 3,
            },
          },
        },
        BackupMessage: {
          fields: {
            flag: {
              type: "bool",
              id: 1,
            },
            priority: {
              type: "int32",
              id: 2,
            },
          },
        },
        AccountType: {
          values: {
            Normal: 0,
            AssetIssue: 1,
            Contract: 2,
          },
        },
        AccountId: {
          fields: {
            name: {
              type: "bytes",
              id: 1,
            },
            address: {
              type: "bytes",
              id: 2,
            },
          },
        },
        Vote: {
          fields: {
            vote_address: {
              type: "bytes",
              id: 1,
            },
            vote_count: {
              type: "int64",
              id: 2,
            },
          },
        },
        Proposal: {
          fields: {
            proposal_id: {
              type: "int64",
              id: 1,
            },
            proposer_address: {
              type: "bytes",
              id: 2,
            },
            parameters: {
              keyType: "int64",
              type: "int64",
              id: 3,
            },
            expiration_time: {
              type: "int64",
              id: 4,
            },
            create_time: {
              type: "int64",
              id: 5,
            },
            approvals: {
              rule: "repeated",
              type: "bytes",
              id: 6,
            },
            state: {
              type: "State",
              id: 7,
            },
          },
          nested: {
            State: {
              values: {
                PENDING: 0,
                DISAPPROVED: 1,
                APPROVED: 2,
                CANCELED: 3,
              },
            },
          },
        },
        Exchange: {
          fields: {
            exchange_id: {
              type: "int64",
              id: 1,
            },
            creator_address: {
              type: "bytes",
              id: 2,
            },
            create_time: {
              type: "int64",
              id: 3,
            },
            first_token_id: {
              type: "bytes",
              id: 6,
            },
            first_token_balance: {
              type: "int64",
              id: 7,
            },
            second_token_id: {
              type: "bytes",
              id: 8,
            },
            second_token_balance: {
              type: "int64",
              id: 9,
            },
          },
        },
        MarketOrder: {
          fields: {
            order_id: {
              type: "bytes",
              id: 1,
            },
            owner_address: {
              type: "bytes",
              id: 2,
            },
            create_time: {
              type: "int64",
              id: 3,
            },
            sell_token_id: {
              type: "bytes",
              id: 4,
            },
            sell_token_quantity: {
              type: "int64",
              id: 5,
            },
            buy_token_id: {
              type: "bytes",
              id: 6,
            },
            buy_token_quantity: {
              type: "int64",
              id: 7,
            },
            sell_token_quantity_remain: {
              type: "int64",
              id: 9,
            },
            sell_token_quantity_return: {
              type: "int64",
              id: 10,
            },
            state: {
              type: "State",
              id: 11,
            },
            prev: {
              type: "bytes",
              id: 12,
            },
            next: {
              type: "bytes",
              id: 13,
            },
          },
          nested: {
            State: {
              values: {
                ACTIVE: 0,
                INACTIVE: 1,
                CANCELED: 2,
              },
            },
          },
        },
        MarketOrderList: {
          fields: {
            orders: {
              rule: "repeated",
              type: "MarketOrder",
              id: 1,
            },
          },
        },
        MarketOrderPairList: {
          fields: {
            orderPair: {
              rule: "repeated",
              type: "MarketOrderPair",
              id: 1,
            },
          },
        },
        MarketOrderPair: {
          fields: {
            sell_token_id: {
              type: "bytes",
              id: 1,
            },
            buy_token_id: {
              type: "bytes",
              id: 2,
            },
          },
        },
        MarketAccountOrder: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            orders: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
            count: {
              type: "int64",
              id: 3,
            },
            total_count: {
              type: "int64",
              id: 4,
            },
          },
        },
        MarketPrice: {
          fields: {
            sell_token_quantity: {
              type: "int64",
              id: 1,
            },
            buy_token_quantity: {
              type: "int64",
              id: 2,
            },
          },
        },
        MarketPriceList: {
          fields: {
            sell_token_id: {
              type: "bytes",
              id: 1,
            },
            buy_token_id: {
              type: "bytes",
              id: 2,
            },
            prices: {
              rule: "repeated",
              type: "MarketPrice",
              id: 3,
            },
          },
        },
        MarketOrderIdList: {
          fields: {
            head: {
              type: "bytes",
              id: 1,
            },
            tail: {
              type: "bytes",
              id: 2,
            },
          },
        },
        ChainParameters: {
          fields: {
            chainParameter: {
              rule: "repeated",
              type: "ChainParameter",
              id: 1,
            },
          },
          nested: {
            ChainParameter: {
              fields: {
                key: {
                  type: "string",
                  id: 1,
                },
                value: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        Account: {
          fields: {
            account_name: {
              type: "bytes",
              id: 1,
            },
            type: {
              type: "AccountType",
              id: 2,
            },
            address: {
              type: "bytes",
              id: 3,
            },
            balance: {
              type: "int64",
              id: 4,
            },
            votes: {
              rule: "repeated",
              type: "Vote",
              id: 5,
            },
            asset: {
              keyType: "string",
              type: "int64",
              id: 6,
            },
            assetV2: {
              keyType: "string",
              type: "int64",
              id: 56,
            },
            frozen: {
              rule: "repeated",
              type: "Frozen",
              id: 7,
            },
            net_usage: {
              type: "int64",
              id: 8,
            },
            acquired_delegated_frozen_balance_for_bandwidth: {
              type: "int64",
              id: 41,
            },
            delegated_frozen_balance_for_bandwidth: {
              type: "int64",
              id: 42,
            },
            old_tron_power: {
              type: "int64",
              id: 46,
            },
            tron_power: {
              type: "Frozen",
              id: 47,
            },
            asset_optimized: {
              type: "bool",
              id: 60,
            },
            create_time: {
              type: "int64",
              id: 9,
            },
            latest_opration_time: {
              type: "int64",
              id: 10,
            },
            allowance: {
              type: "int64",
              id: 11,
            },
            latest_withdraw_time: {
              type: "int64",
              id: 12,
            },
            code: {
              type: "bytes",
              id: 13,
            },
            is_witness: {
              type: "bool",
              id: 14,
            },
            is_committee: {
              type: "bool",
              id: 15,
            },
            frozen_supply: {
              rule: "repeated",
              type: "Frozen",
              id: 16,
            },
            asset_issued_name: {
              type: "bytes",
              id: 17,
            },
            asset_issued_ID: {
              type: "bytes",
              id: 57,
            },
            latest_asset_operation_time: {
              keyType: "string",
              type: "int64",
              id: 18,
            },
            latest_asset_operation_timeV2: {
              keyType: "string",
              type: "int64",
              id: 58,
            },
            free_net_usage: {
              type: "int64",
              id: 19,
            },
            free_asset_net_usage: {
              keyType: "string",
              type: "int64",
              id: 20,
            },
            free_asset_net_usageV2: {
              keyType: "string",
              type: "int64",
              id: 59,
            },
            latest_consume_time: {
              type: "int64",
              id: 21,
            },
            latest_consume_free_time: {
              type: "int64",
              id: 22,
            },
            account_id: {
              type: "bytes",
              id: 23,
            },
            net_window_size: {
              type: "int64",
              id: 24,
            },
            net_window_optimized: {
              type: "bool",
              id: 25,
            },
            account_resource: {
              type: "AccountResource",
              id: 26,
            },
            codeHash: {
              type: "bytes",
              id: 30,
            },
            owner_permission: {
              type: "Permission",
              id: 31,
            },
            witness_permission: {
              type: "Permission",
              id: 32,
            },
            active_permission: {
              rule: "repeated",
              type: "Permission",
              id: 33,
            },
            frozenV2: {
              rule: "repeated",
              type: "FreezeV2",
              id: 34,
            },
            unfrozenV2: {
              rule: "repeated",
              type: "UnFreezeV2",
              id: 35,
            },
            delegated_frozenV2_balance_for_bandwidth: {
              type: "int64",
              id: 36,
            },
            acquired_delegated_frozenV2_balance_for_bandwidth: {
              type: "int64",
              id: 37,
            },
          },
          nested: {
            Frozen: {
              fields: {
                frozen_balance: {
                  type: "int64",
                  id: 1,
                },
                expire_time: {
                  type: "int64",
                  id: 2,
                },
              },
            },
            AccountResource: {
              fields: {
                energy_usage: {
                  type: "int64",
                  id: 1,
                },
                frozen_balance_for_energy: {
                  type: "Frozen",
                  id: 2,
                },
                latest_consume_time_for_energy: {
                  type: "int64",
                  id: 3,
                },
                acquired_delegated_frozen_balance_for_energy: {
                  type: "int64",
                  id: 4,
                },
                delegated_frozen_balance_for_energy: {
                  type: "int64",
                  id: 5,
                },
                storage_limit: {
                  type: "int64",
                  id: 6,
                },
                storage_usage: {
                  type: "int64",
                  id: 7,
                },
                latest_exchange_storage_time: {
                  type: "int64",
                  id: 8,
                },
                energy_window_size: {
                  type: "int64",
                  id: 9,
                },
                delegated_frozenV2_balance_for_energy: {
                  type: "int64",
                  id: 10,
                },
                acquired_delegated_frozenV2_balance_for_energy: {
                  type: "int64",
                  id: 11,
                },
                energy_window_optimized: {
                  type: "bool",
                  id: 12,
                },
              },
            },
            FreezeV2: {
              fields: {
                type: {
                  type: "ResourceCode",
                  id: 1,
                },
                amount: {
                  type: "int64",
                  id: 2,
                },
              },
            },
            UnFreezeV2: {
              fields: {
                type: {
                  type: "ResourceCode",
                  id: 1,
                },
                unfreeze_amount: {
                  type: "int64",
                  id: 3,
                },
                unfreeze_expire_time: {
                  type: "int64",
                  id: 4,
                },
              },
            },
          },
        },
        Key: {
          fields: {
            address: {
              type: "bytes",
              id: 1,
            },
            weight: {
              type: "int64",
              id: 2,
            },
          },
        },
        DelegatedResource: {
          fields: {
            from: {
              type: "bytes",
              id: 1,
            },
            to: {
              type: "bytes",
              id: 2,
            },
            frozen_balance_for_bandwidth: {
              type: "int64",
              id: 3,
            },
            frozen_balance_for_energy: {
              type: "int64",
              id: 4,
            },
            expire_time_for_bandwidth: {
              type: "int64",
              id: 5,
            },
            expire_time_for_energy: {
              type: "int64",
              id: 6,
            },
          },
        },
        authority: {
          fields: {
            account: {
              type: "AccountId",
              id: 1,
            },
            permission_name: {
              type: "bytes",
              id: 2,
            },
          },
        },
        Permission: {
          fields: {
            type: {
              type: "PermissionType",
              id: 1,
            },
            id: {
              type: "int32",
              id: 2,
            },
            permission_name: {
              type: "string",
              id: 3,
            },
            threshold: {
              type: "int64",
              id: 4,
            },
            parent_id: {
              type: "int32",
              id: 5,
            },
            operations: {
              type: "bytes",
              id: 6,
            },
            keys: {
              rule: "repeated",
              type: "Key",
              id: 7,
            },
          },
          nested: {
            PermissionType: {
              values: {
                Owner: 0,
                Witness: 1,
                Active: 2,
              },
            },
          },
        },
        Witness: {
          fields: {
            address: {
              type: "bytes",
              id: 1,
            },
            voteCount: {
              type: "int64",
              id: 2,
            },
            pubKey: {
              type: "bytes",
              id: 3,
            },
            url: {
              type: "string",
              id: 4,
            },
            totalProduced: {
              type: "int64",
              id: 5,
            },
            totalMissed: {
              type: "int64",
              id: 6,
            },
            latestBlockNum: {
              type: "int64",
              id: 7,
            },
            latestSlotNum: {
              type: "int64",
              id: 8,
            },
            isJobs: {
              type: "bool",
              id: 9,
            },
          },
        },
        Votes: {
          fields: {
            address: {
              type: "bytes",
              id: 1,
            },
            old_votes: {
              rule: "repeated",
              type: "Vote",
              id: 2,
            },
            new_votes: {
              rule: "repeated",
              type: "Vote",
              id: 3,
            },
          },
        },
        TXOutput: {
          fields: {
            value: {
              type: "int64",
              id: 1,
            },
            pubKeyHash: {
              type: "bytes",
              id: 2,
            },
          },
        },
        TXInput: {
          fields: {
            raw_data: {
              type: "raw",
              id: 1,
            },
            signature: {
              type: "bytes",
              id: 4,
            },
          },
          nested: {
            raw: {
              fields: {
                txID: {
                  type: "bytes",
                  id: 1,
                },
                vout: {
                  type: "int64",
                  id: 2,
                },
                pubKey: {
                  type: "bytes",
                  id: 3,
                },
              },
            },
          },
        },
        TXOutputs: {
          fields: {
            outputs: {
              rule: "repeated",
              type: "TXOutput",
              id: 1,
            },
          },
        },
        ResourceReceipt: {
          fields: {
            energy_usage: {
              type: "int64",
              id: 1,
            },
            energy_fee: {
              type: "int64",
              id: 2,
            },
            origin_energy_usage: {
              type: "int64",
              id: 3,
            },
            energy_usage_total: {
              type: "int64",
              id: 4,
            },
            net_usage: {
              type: "int64",
              id: 5,
            },
            net_fee: {
              type: "int64",
              id: 6,
            },
            result: {
              type: "Transaction.Result.contractResult",
              id: 7,
            },
            energy_penalty_total: {
              type: "int64",
              id: 8,
            },
          },
        },
        MarketOrderDetail: {
          fields: {
            makerOrderId: {
              type: "bytes",
              id: 1,
            },
            takerOrderId: {
              type: "bytes",
              id: 2,
            },
            fillSellQuantity: {
              type: "int64",
              id: 3,
            },
            fillBuyQuantity: {
              type: "int64",
              id: 4,
            },
          },
        },
        Transaction: {
          fields: {
            raw_data: {
              type: "raw",
              id: 1,
            },
            signature: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
            ret: {
              rule: "repeated",
              type: "Result",
              id: 5,
            },
          },
          nested: {
            Contract: {
              fields: {
                type: {
                  type: "ContractType",
                  id: 1,
                },
                parameter: {
                  type: "google.protobuf.Any",
                  id: 2,
                },
                provider: {
                  type: "bytes",
                  id: 3,
                },
                ContractName: {
                  type: "bytes",
                  id: 4,
                },
                Permission_id: {
                  type: "int32",
                  id: 5,
                },
              },
              nested: {
                ContractType: {
                  values: {
                    AccountCreateContract: 0,
                    TransferContract: 1,
                    TransferAssetContract: 2,
                    VoteAssetContract: 3,
                    VoteWitnessContract: 4,
                    WitnessCreateContract: 5,
                    AssetIssueContract: 6,
                    WitnessUpdateContract: 8,
                    ParticipateAssetIssueContract: 9,
                    AccountUpdateContract: 10,
                    FreezeBalanceContract: 11,
                    UnfreezeBalanceContract: 12,
                    WithdrawBalanceContract: 13,
                    UnfreezeAssetContract: 14,
                    UpdateAssetContract: 15,
                    ProposalCreateContract: 16,
                    ProposalApproveContract: 17,
                    ProposalDeleteContract: 18,
                    SetAccountIdContract: 19,
                    CustomContract: 20,
                    CreateSmartContract: 30,
                    TriggerSmartContract: 31,
                    GetContract: 32,
                    UpdateSettingContract: 33,
                    ExchangeCreateContract: 41,
                    ExchangeInjectContract: 42,
                    ExchangeWithdrawContract: 43,
                    ExchangeTransactionContract: 44,
                    UpdateEnergyLimitContract: 45,
                    AccountPermissionUpdateContract: 46,
                    ClearABIContract: 48,
                    UpdateBrokerageContract: 49,
                    ShieldedTransferContract: 51,
                    MarketSellAssetContract: 52,
                    MarketCancelOrderContract: 53,
                    FreezeBalanceV2Contract: 54,
                    UnfreezeBalanceV2Contract: 55,
                    WithdrawExpireUnfreezeContract: 56,
                    DelegateResourceContract: 57,
                    UnDelegateResourceContract: 58,
                    CancelAllUnfreezeV2Contract: 59,
                  },
                },
              },
            },
            Result: {
              fields: {
                fee: {
                  type: "int64",
                  id: 1,
                },
                ret: {
                  type: "code",
                  id: 2,
                },
                contractRet: {
                  type: "contractResult",
                  id: 3,
                },
                assetIssueID: {
                  type: "string",
                  id: 14,
                },
                withdraw_amount: {
                  type: "int64",
                  id: 15,
                },
                unfreeze_amount: {
                  type: "int64",
                  id: 16,
                },
                exchange_received_amount: {
                  type: "int64",
                  id: 18,
                },
                exchange_inject_another_amount: {
                  type: "int64",
                  id: 19,
                },
                exchange_withdraw_another_amount: {
                  type: "int64",
                  id: 20,
                },
                exchange_id: {
                  type: "int64",
                  id: 21,
                },
                shielded_transaction_fee: {
                  type: "int64",
                  id: 22,
                },
                orderId: {
                  type: "bytes",
                  id: 25,
                },
                orderDetails: {
                  rule: "repeated",
                  type: "MarketOrderDetail",
                  id: 26,
                },
                withdraw_expire_amount: {
                  type: "int64",
                  id: 27,
                },
                cancel_unfreezeV2_amount: {
                  keyType: "string",
                  type: "int64",
                  id: 28,
                },
              },
              nested: {
                code: {
                  values: {
                    SUCESS: 0,
                    FAILED: 1,
                  },
                },
                contractResult: {
                  values: {
                    DEFAULT: 0,
                    SUCCESS: 1,
                    REVERT: 2,
                    BAD_JUMP_DESTINATION: 3,
                    OUT_OF_MEMORY: 4,
                    PRECOMPILED_CONTRACT: 5,
                    STACK_TOO_SMALL: 6,
                    STACK_TOO_LARGE: 7,
                    ILLEGAL_OPERATION: 8,
                    STACK_OVERFLOW: 9,
                    OUT_OF_ENERGY: 10,
                    OUT_OF_TIME: 11,
                    JVM_STACK_OVER_FLOW: 12,
                    UNKNOWN: 13,
                    TRANSFER_FAILED: 14,
                    INVALID_CODE: 15,
                  },
                },
              },
            },
            raw: {
              fields: {
                ref_block_bytes: {
                  type: "bytes",
                  id: 1,
                },
                ref_block_num: {
                  type: "int64",
                  id: 3,
                },
                ref_block_hash: {
                  type: "bytes",
                  id: 4,
                },
                expiration: {
                  type: "int64",
                  id: 8,
                },
                auths: {
                  rule: "repeated",
                  type: "authority",
                  id: 9,
                },
                data: {
                  type: "bytes",
                  id: 10,
                },
                contract: {
                  rule: "repeated",
                  type: "Contract",
                  id: 11,
                },
                scripts: {
                  type: "bytes",
                  id: 12,
                },
                timestamp: {
                  type: "int64",
                  id: 14,
                },
                fee_limit: {
                  type: "int64",
                  id: 18,
                },
              },
            },
          },
        },
        TransactionInfo: {
          fields: {
            id: {
              type: "bytes",
              id: 1,
            },
            fee: {
              type: "int64",
              id: 2,
            },
            blockNumber: {
              type: "int64",
              id: 3,
            },
            blockTimeStamp: {
              type: "int64",
              id: 4,
            },
            contractResult: {
              rule: "repeated",
              type: "bytes",
              id: 5,
            },
            contract_address: {
              type: "bytes",
              id: 6,
            },
            receipt: {
              type: "ResourceReceipt",
              id: 7,
            },
            log: {
              rule: "repeated",
              type: "Log",
              id: 8,
            },
            result: {
              type: "code",
              id: 9,
            },
            resMessage: {
              type: "bytes",
              id: 10,
            },
            assetIssueID: {
              type: "string",
              id: 14,
            },
            withdraw_amount: {
              type: "int64",
              id: 15,
            },
            unfreeze_amount: {
              type: "int64",
              id: 16,
            },
            internal_transactions: {
              rule: "repeated",
              type: "InternalTransaction",
              id: 17,
            },
            exchange_received_amount: {
              type: "int64",
              id: 18,
            },
            exchange_inject_another_amount: {
              type: "int64",
              id: 19,
            },
            exchange_withdraw_another_amount: {
              type: "int64",
              id: 20,
            },
            exchange_id: {
              type: "int64",
              id: 21,
            },
            shielded_transaction_fee: {
              type: "int64",
              id: 22,
            },
            orderId: {
              type: "bytes",
              id: 25,
            },
            orderDetails: {
              rule: "repeated",
              type: "MarketOrderDetail",
              id: 26,
            },
            packingFee: {
              type: "int64",
              id: 27,
            },
            withdraw_expire_amount: {
              type: "int64",
              id: 28,
            },
            cancel_unfreezeV2_amount: {
              keyType: "string",
              type: "int64",
              id: 29,
            },
          },
          nested: {
            code: {
              values: {
                SUCESS: 0,
                FAILED: 1,
              },
            },
            Log: {
              fields: {
                address: {
                  type: "bytes",
                  id: 1,
                },
                topics: {
                  rule: "repeated",
                  type: "bytes",
                  id: 2,
                },
                data: {
                  type: "bytes",
                  id: 3,
                },
              },
            },
          },
        },
        TransactionRet: {
          fields: {
            blockNumber: {
              type: "int64",
              id: 1,
            },
            blockTimeStamp: {
              type: "int64",
              id: 2,
            },
            transactioninfo: {
              rule: "repeated",
              type: "TransactionInfo",
              id: 3,
            },
          },
        },
        Transactions: {
          fields: {
            transactions: {
              rule: "repeated",
              type: "Transaction",
              id: 1,
            },
          },
        },
        BlockHeader: {
          fields: {
            raw_data: {
              type: "raw",
              id: 1,
            },
            witness_signature: {
              type: "bytes",
              id: 2,
            },
          },
          nested: {
            raw: {
              fields: {
                timestamp: {
                  type: "int64",
                  id: 1,
                },
                txTrieRoot: {
                  type: "bytes",
                  id: 2,
                },
                parentHash: {
                  type: "bytes",
                  id: 3,
                },
                number: {
                  type: "int64",
                  id: 7,
                },
                witness_id: {
                  type: "int64",
                  id: 8,
                },
                witness_address: {
                  type: "bytes",
                  id: 9,
                },
                version: {
                  type: "int32",
                  id: 10,
                },
                accountStateRoot: {
                  type: "bytes",
                  id: 11,
                },
              },
            },
          },
        },
        Block: {
          fields: {
            transactions: {
              rule: "repeated",
              type: "Transaction",
              id: 1,
            },
            block_header: {
              type: "BlockHeader",
              id: 2,
            },
          },
        },
        ChainInventory: {
          fields: {
            ids: {
              rule: "repeated",
              type: "BlockId",
              id: 1,
            },
            remain_num: {
              type: "int64",
              id: 2,
            },
          },
          nested: {
            BlockId: {
              fields: {
                hash: {
                  type: "bytes",
                  id: 1,
                },
                number: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        BlockInventory: {
          fields: {
            ids: {
              rule: "repeated",
              type: "BlockId",
              id: 1,
            },
            type: {
              type: "Type",
              id: 2,
            },
          },
          nested: {
            Type: {
              values: {
                SYNC: 0,
                ADVTISE: 1,
                FETCH: 2,
              },
            },
            BlockId: {
              fields: {
                hash: {
                  type: "bytes",
                  id: 1,
                },
                number: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        Inventory: {
          fields: {
            type: {
              type: "InventoryType",
              id: 1,
            },
            ids: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
          },
          nested: {
            InventoryType: {
              values: {
                TRX: 0,
                BLOCK: 1,
              },
            },
          },
        },
        Items: {
          fields: {
            type: {
              type: "ItemType",
              id: 1,
            },
            blocks: {
              rule: "repeated",
              type: "Block",
              id: 2,
            },
            block_headers: {
              rule: "repeated",
              type: "BlockHeader",
              id: 3,
            },
            transactions: {
              rule: "repeated",
              type: "Transaction",
              id: 4,
            },
          },
          nested: {
            ItemType: {
              values: {
                ERR: 0,
                TRX: 1,
                BLOCK: 2,
                BLOCKHEADER: 3,
              },
            },
          },
        },
        DynamicProperties: {
          fields: {
            last_solidity_block_num: {
              type: "int64",
              id: 1,
            },
          },
        },
        ReasonCode: {
          values: {
            REQUESTED: 0,
            BAD_PROTOCOL: 2,
            TOO_MANY_PEERS: 4,
            DUPLICATE_PEER: 5,
            INCOMPATIBLE_PROTOCOL: 6,
            RANDOM_ELIMINATION: 7,
            PEER_QUITING: 8,
            UNEXPECTED_IDENTITY: 9,
            LOCAL_IDENTITY: 10,
            PING_TIMEOUT: 11,
            USER_REASON: 16,
            RESET: 17,
            SYNC_FAIL: 18,
            FETCH_FAIL: 19,
            BAD_TX: 20,
            BAD_BLOCK: 21,
            FORKED: 22,
            UNLINKABLE: 23,
            INCOMPATIBLE_VERSION: 24,
            INCOMPATIBLE_CHAIN: 25,
            TIME_OUT: 32,
            CONNECT_FAIL: 33,
            TOO_MANY_PEERS_WITH_SAME_IP: 34,
            LIGHT_NODE_SYNC_FAIL: 35,
            BELOW_THAN_ME: 36,
            NOT_WITNESS: 37,
            NO_SUCH_MESSAGE: 38,
            UNKNOWN: 255,
          },
        },
        DisconnectMessage: {
          fields: {
            reason: {
              type: "ReasonCode",
              id: 1,
            },
          },
        },
        HelloMessage: {
          fields: {
            from: {
              type: "Endpoint",
              id: 1,
            },
            version: {
              type: "int32",
              id: 2,
            },
            timestamp: {
              type: "int64",
              id: 3,
            },
            genesisBlockId: {
              type: "BlockId",
              id: 4,
            },
            solidBlockId: {
              type: "BlockId",
              id: 5,
            },
            headBlockId: {
              type: "BlockId",
              id: 6,
            },
            address: {
              type: "bytes",
              id: 7,
            },
            signature: {
              type: "bytes",
              id: 8,
            },
            nodeType: {
              type: "int32",
              id: 9,
            },
            lowestBlockNum: {
              type: "int64",
              id: 10,
            },
          },
          nested: {
            BlockId: {
              fields: {
                hash: {
                  type: "bytes",
                  id: 1,
                },
                number: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        InternalTransaction: {
          fields: {
            hash: {
              type: "bytes",
              id: 1,
            },
            caller_address: {
              type: "bytes",
              id: 2,
            },
            transferTo_address: {
              type: "bytes",
              id: 3,
            },
            callValueInfo: {
              rule: "repeated",
              type: "CallValueInfo",
              id: 4,
            },
            note: {
              type: "bytes",
              id: 5,
            },
            rejected: {
              type: "bool",
              id: 6,
            },
            extra: {
              type: "string",
              id: 7,
            },
          },
          nested: {
            CallValueInfo: {
              fields: {
                callValue: {
                  type: "int64",
                  id: 1,
                },
                tokenId: {
                  type: "string",
                  id: 2,
                },
              },
            },
          },
        },
        DelegatedResourceAccountIndex: {
          fields: {
            account: {
              type: "bytes",
              id: 1,
            },
            fromAccounts: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
            toAccounts: {
              rule: "repeated",
              type: "bytes",
              id: 3,
            },
            timestamp: {
              type: "int64",
              id: 4,
            },
          },
        },
        NodeInfo: {
          fields: {
            beginSyncNum: {
              type: "int64",
              id: 1,
            },
            block: {
              type: "string",
              id: 2,
            },
            solidityBlock: {
              type: "string",
              id: 3,
            },
            currentConnectCount: {
              type: "int32",
              id: 4,
            },
            activeConnectCount: {
              type: "int32",
              id: 5,
            },
            passiveConnectCount: {
              type: "int32",
              id: 6,
            },
            totalFlow: {
              type: "int64",
              id: 7,
            },
            peerInfoList: {
              rule: "repeated",
              type: "PeerInfo",
              id: 8,
            },
            configNodeInfo: {
              type: "ConfigNodeInfo",
              id: 9,
            },
            machineInfo: {
              type: "MachineInfo",
              id: 10,
            },
            cheatWitnessInfoMap: {
              keyType: "string",
              type: "string",
              id: 11,
            },
          },
          nested: {
            PeerInfo: {
              fields: {
                lastSyncBlock: {
                  type: "string",
                  id: 1,
                },
                remainNum: {
                  type: "int64",
                  id: 2,
                },
                lastBlockUpdateTime: {
                  type: "int64",
                  id: 3,
                },
                syncFlag: {
                  type: "bool",
                  id: 4,
                },
                headBlockTimeWeBothHave: {
                  type: "int64",
                  id: 5,
                },
                needSyncFromPeer: {
                  type: "bool",
                  id: 6,
                },
                needSyncFromUs: {
                  type: "bool",
                  id: 7,
                },
                host: {
                  type: "string",
                  id: 8,
                },
                port: {
                  type: "int32",
                  id: 9,
                },
                nodeId: {
                  type: "string",
                  id: 10,
                },
                connectTime: {
                  type: "int64",
                  id: 11,
                },
                avgLatency: {
                  type: "double",
                  id: 12,
                },
                syncToFetchSize: {
                  type: "int32",
                  id: 13,
                },
                syncToFetchSizePeekNum: {
                  type: "int64",
                  id: 14,
                },
                syncBlockRequestedSize: {
                  type: "int32",
                  id: 15,
                },
                unFetchSynNum: {
                  type: "int64",
                  id: 16,
                },
                blockInPorcSize: {
                  type: "int32",
                  id: 17,
                },
                headBlockWeBothHave: {
                  type: "string",
                  id: 18,
                },
                isActive: {
                  type: "bool",
                  id: 19,
                },
                score: {
                  type: "int32",
                  id: 20,
                },
                nodeCount: {
                  type: "int32",
                  id: 21,
                },
                inFlow: {
                  type: "int64",
                  id: 22,
                },
                disconnectTimes: {
                  type: "int32",
                  id: 23,
                },
                localDisconnectReason: {
                  type: "string",
                  id: 24,
                },
                remoteDisconnectReason: {
                  type: "string",
                  id: 25,
                },
              },
            },
            ConfigNodeInfo: {
              fields: {
                codeVersion: {
                  type: "string",
                  id: 1,
                },
                p2pVersion: {
                  type: "string",
                  id: 2,
                },
                listenPort: {
                  type: "int32",
                  id: 3,
                },
                discoverEnable: {
                  type: "bool",
                  id: 4,
                },
                activeNodeSize: {
                  type: "int32",
                  id: 5,
                },
                passiveNodeSize: {
                  type: "int32",
                  id: 6,
                },
                sendNodeSize: {
                  type: "int32",
                  id: 7,
                },
                maxConnectCount: {
                  type: "int32",
                  id: 8,
                },
                sameIpMaxConnectCount: {
                  type: "int32",
                  id: 9,
                },
                backupListenPort: {
                  type: "int32",
                  id: 10,
                },
                backupMemberSize: {
                  type: "int32",
                  id: 11,
                },
                backupPriority: {
                  type: "int32",
                  id: 12,
                },
                dbVersion: {
                  type: "int32",
                  id: 13,
                },
                minParticipationRate: {
                  type: "int32",
                  id: 14,
                },
                supportConstant: {
                  type: "bool",
                  id: 15,
                },
                minTimeRatio: {
                  type: "double",
                  id: 16,
                },
                maxTimeRatio: {
                  type: "double",
                  id: 17,
                },
                allowCreationOfContracts: {
                  type: "int64",
                  id: 18,
                },
                allowAdaptiveEnergy: {
                  type: "int64",
                  id: 19,
                },
              },
            },
            MachineInfo: {
              fields: {
                threadCount: {
                  type: "int32",
                  id: 1,
                },
                deadLockThreadCount: {
                  type: "int32",
                  id: 2,
                },
                cpuCount: {
                  type: "int32",
                  id: 3,
                },
                totalMemory: {
                  type: "int64",
                  id: 4,
                },
                freeMemory: {
                  type: "int64",
                  id: 5,
                },
                cpuRate: {
                  type: "double",
                  id: 6,
                },
                javaVersion: {
                  type: "string",
                  id: 7,
                },
                osName: {
                  type: "string",
                  id: 8,
                },
                jvmTotalMemory: {
                  type: "int64",
                  id: 9,
                },
                jvmFreeMemory: {
                  type: "int64",
                  id: 10,
                },
                processCpuRate: {
                  type: "double",
                  id: 11,
                },
                memoryDescInfoList: {
                  rule: "repeated",
                  type: "MemoryDescInfo",
                  id: 12,
                },
                deadLockThreadInfoList: {
                  rule: "repeated",
                  type: "DeadLockThreadInfo",
                  id: 13,
                },
              },
              nested: {
                MemoryDescInfo: {
                  fields: {
                    name: {
                      type: "string",
                      id: 1,
                    },
                    initSize: {
                      type: "int64",
                      id: 2,
                    },
                    useSize: {
                      type: "int64",
                      id: 3,
                    },
                    maxSize: {
                      type: "int64",
                      id: 4,
                    },
                    useRate: {
                      type: "double",
                      id: 5,
                    },
                  },
                },
                DeadLockThreadInfo: {
                  fields: {
                    name: {
                      type: "string",
                      id: 1,
                    },
                    lockName: {
                      type: "string",
                      id: 2,
                    },
                    lockOwner: {
                      type: "string",
                      id: 3,
                    },
                    state: {
                      type: "string",
                      id: 4,
                    },
                    blockTime: {
                      type: "int64",
                      id: 5,
                    },
                    waitTime: {
                      type: "int64",
                      id: 6,
                    },
                    stackTrace: {
                      type: "string",
                      id: 7,
                    },
                  },
                },
              },
            },
          },
        },
        MetricsInfo: {
          fields: {
            interval: {
              type: "int64",
              id: 1,
            },
            node: {
              type: "NodeInfo",
              id: 2,
            },
            blockchain: {
              type: "BlockChainInfo",
              id: 3,
            },
            net: {
              type: "NetInfo",
              id: 4,
            },
          },
          nested: {
            NodeInfo: {
              fields: {
                ip: {
                  type: "string",
                  id: 1,
                },
                nodeType: {
                  type: "int32",
                  id: 2,
                },
                version: {
                  type: "string",
                  id: 3,
                },
                backupStatus: {
                  type: "int32",
                  id: 4,
                },
              },
            },
            BlockChainInfo: {
              fields: {
                headBlockNum: {
                  type: "int64",
                  id: 1,
                },
                headBlockTimestamp: {
                  type: "int64",
                  id: 2,
                },
                headBlockHash: {
                  type: "string",
                  id: 3,
                },
                forkCount: {
                  type: "int32",
                  id: 4,
                },
                failForkCount: {
                  type: "int32",
                  id: 5,
                },
                blockProcessTime: {
                  type: "RateInfo",
                  id: 6,
                },
                tps: {
                  type: "RateInfo",
                  id: 7,
                },
                transactionCacheSize: {
                  type: "int32",
                  id: 8,
                },
                missedTransaction: {
                  type: "RateInfo",
                  id: 9,
                },
                witnesses: {
                  rule: "repeated",
                  type: "Witness",
                  id: 10,
                },
                failProcessBlockNum: {
                  type: "int64",
                  id: 11,
                },
                failProcessBlockReason: {
                  type: "string",
                  id: 12,
                },
                dupWitness: {
                  rule: "repeated",
                  type: "DupWitness",
                  id: 13,
                },
              },
              nested: {
                Witness: {
                  fields: {
                    address: {
                      type: "string",
                      id: 1,
                    },
                    version: {
                      type: "int32",
                      id: 2,
                    },
                  },
                },
                DupWitness: {
                  fields: {
                    address: {
                      type: "string",
                      id: 1,
                    },
                    blockNum: {
                      type: "int64",
                      id: 2,
                    },
                    count: {
                      type: "int32",
                      id: 3,
                    },
                  },
                },
              },
            },
            RateInfo: {
              fields: {
                count: {
                  type: "int64",
                  id: 1,
                },
                meanRate: {
                  type: "double",
                  id: 2,
                },
                oneMinuteRate: {
                  type: "double",
                  id: 3,
                },
                fiveMinuteRate: {
                  type: "double",
                  id: 4,
                },
                fifteenMinuteRate: {
                  type: "double",
                  id: 5,
                },
              },
            },
            NetInfo: {
              fields: {
                errorProtoCount: {
                  type: "int32",
                  id: 1,
                },
                api: {
                  type: "ApiInfo",
                  id: 2,
                },
                connectionCount: {
                  type: "int32",
                  id: 3,
                },
                validConnectionCount: {
                  type: "int32",
                  id: 4,
                },
                tcpInTraffic: {
                  type: "RateInfo",
                  id: 5,
                },
                tcpOutTraffic: {
                  type: "RateInfo",
                  id: 6,
                },
                disconnectionCount: {
                  type: "int32",
                  id: 7,
                },
                disconnectionDetail: {
                  rule: "repeated",
                  type: "DisconnectionDetailInfo",
                  id: 8,
                },
                udpInTraffic: {
                  type: "RateInfo",
                  id: 9,
                },
                udpOutTraffic: {
                  type: "RateInfo",
                  id: 10,
                },
                latency: {
                  type: "LatencyInfo",
                  id: 11,
                },
              },
              nested: {
                ApiInfo: {
                  fields: {
                    qps: {
                      type: "RateInfo",
                      id: 1,
                    },
                    failQps: {
                      type: "RateInfo",
                      id: 2,
                    },
                    outTraffic: {
                      type: "RateInfo",
                      id: 3,
                    },
                    detail: {
                      rule: "repeated",
                      type: "ApiDetailInfo",
                      id: 4,
                    },
                  },
                  nested: {
                    ApiDetailInfo: {
                      fields: {
                        name: {
                          type: "string",
                          id: 1,
                        },
                        qps: {
                          type: "RateInfo",
                          id: 2,
                        },
                        failQps: {
                          type: "RateInfo",
                          id: 3,
                        },
                        outTraffic: {
                          type: "RateInfo",
                          id: 4,
                        },
                      },
                    },
                  },
                },
                DisconnectionDetailInfo: {
                  fields: {
                    reason: {
                      type: "string",
                      id: 1,
                    },
                    count: {
                      type: "int32",
                      id: 2,
                    },
                  },
                },
                LatencyInfo: {
                  fields: {
                    top99: {
                      type: "int32",
                      id: 1,
                    },
                    top95: {
                      type: "int32",
                      id: 2,
                    },
                    top75: {
                      type: "int32",
                      id: 3,
                    },
                    totalCount: {
                      type: "int32",
                      id: 4,
                    },
                    delay1S: {
                      type: "int32",
                      id: 5,
                    },
                    delay2S: {
                      type: "int32",
                      id: 6,
                    },
                    delay3S: {
                      type: "int32",
                      id: 7,
                    },
                    detail: {
                      rule: "repeated",
                      type: "LatencyDetailInfo",
                      id: 8,
                    },
                  },
                  nested: {
                    LatencyDetailInfo: {
                      fields: {
                        witness: {
                          type: "string",
                          id: 1,
                        },
                        top99: {
                          type: "int32",
                          id: 2,
                        },
                        top95: {
                          type: "int32",
                          id: 3,
                        },
                        top75: {
                          type: "int32",
                          id: 4,
                        },
                        count: {
                          type: "int32",
                          id: 5,
                        },
                        delay1S: {
                          type: "int32",
                          id: 6,
                        },
                        delay2S: {
                          type: "int32",
                          id: 7,
                        },
                        delay3S: {
                          type: "int32",
                          id: 8,
                        },
                      },
                    },
                  },
                },
              },
            },
          },
        },
        PBFTMessage: {
          fields: {
            raw_data: {
              type: "Raw",
              id: 1,
            },
            signature: {
              type: "bytes",
              id: 2,
            },
          },
          nested: {
            MsgType: {
              values: {
                VIEW_CHANGE: 0,
                REQUEST: 1,
                PREPREPARE: 2,
                PREPARE: 3,
                COMMIT: 4,
              },
            },
            DataType: {
              values: {
                BLOCK: 0,
                SRL: 1,
              },
            },
            Raw: {
              fields: {
                msg_type: {
                  type: "MsgType",
                  id: 1,
                },
                data_type: {
                  type: "DataType",
                  id: 2,
                },
                view_n: {
                  type: "int64",
                  id: 3,
                },
                epoch: {
                  type: "int64",
                  id: 4,
                },
                data: {
                  type: "bytes",
                  id: 5,
                },
              },
            },
          },
        },
        PBFTCommitResult: {
          fields: {
            data: {
              type: "bytes",
              id: 1,
            },
            signature: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
          },
        },
        SRL: {
          fields: {
            srAddress: {
              rule: "repeated",
              type: "bytes",
              id: 1,
            },
          },
        },
        ResourceCode: {
          values: {
            BANDWIDTH: 0,
            ENERGY: 1,
            TRON_POWER: 2,
          },
        },
        InventoryItems: {
          fields: {
            type: {
              type: "int32",
              id: 1,
            },
            items: {
              rule: "repeated",
              type: "bytes",
              id: 2,
            },
          },
        },
        AssetIssueContract: {
          fields: {
            id: {
              type: "string",
              id: 41,
            },
            owner_address: {
              type: "bytes",
              id: 1,
            },
            name: {
              type: "bytes",
              id: 2,
            },
            abbr: {
              type: "bytes",
              id: 3,
            },
            total_supply: {
              type: "int64",
              id: 4,
            },
            frozen_supply: {
              rule: "repeated",
              type: "FrozenSupply",
              id: 5,
            },
            trx_num: {
              type: "int32",
              id: 6,
            },
            precision: {
              type: "int32",
              id: 7,
            },
            num: {
              type: "int32",
              id: 8,
            },
            start_time: {
              type: "int64",
              id: 9,
            },
            end_time: {
              type: "int64",
              id: 10,
            },
            order: {
              type: "int64",
              id: 11,
            },
            vote_score: {
              type: "int32",
              id: 16,
            },
            description: {
              type: "bytes",
              id: 20,
            },
            url: {
              type: "bytes",
              id: 21,
            },
            free_asset_net_limit: {
              type: "int64",
              id: 22,
            },
            public_free_asset_net_limit: {
              type: "int64",
              id: 23,
            },
            public_free_asset_net_usage: {
              type: "int64",
              id: 24,
            },
            public_latest_free_net_time: {
              type: "int64",
              id: 25,
            },
          },
          nested: {
            FrozenSupply: {
              fields: {
                frozen_amount: {
                  type: "int64",
                  id: 1,
                },
                frozen_days: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        TransferAssetContract: {
          fields: {
            asset_name: {
              type: "bytes",
              id: 1,
            },
            owner_address: {
              type: "bytes",
              id: 2,
            },
            to_address: {
              type: "bytes",
              id: 3,
            },
            amount: {
              type: "int64",
              id: 4,
            },
          },
        },
        UnfreezeAssetContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
          },
        },
        UpdateAssetContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            description: {
              type: "bytes",
              id: 2,
            },
            url: {
              type: "bytes",
              id: 3,
            },
            new_limit: {
              type: "int64",
              id: 4,
            },
            new_public_limit: {
              type: "int64",
              id: 5,
            },
          },
        },
        ParticipateAssetIssueContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            to_address: {
              type: "bytes",
              id: 2,
            },
            asset_name: {
              type: "bytes",
              id: 3,
            },
            amount: {
              type: "int64",
              id: 4,
            },
          },
        },
        FreezeBalanceContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            frozen_balance: {
              type: "int64",
              id: 2,
            },
            frozen_duration: {
              type: "int64",
              id: 3,
            },
            resource: {
              type: "ResourceCode",
              id: 10,
            },
            receiver_address: {
              type: "bytes",
              id: 15,
            },
          },
        },
        UnfreezeBalanceContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            resource: {
              type: "ResourceCode",
              id: 10,
            },
            receiver_address: {
              type: "bytes",
              id: 15,
            },
          },
        },
        WithdrawBalanceContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
          },
        },
        TransferContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            to_address: {
              type: "bytes",
              id: 2,
            },
            amount: {
              type: "int64",
              id: 3,
            },
          },
        },
        TransactionBalanceTrace: {
          fields: {
            transaction_identifier: {
              type: "bytes",
              id: 1,
            },
            operation: {
              rule: "repeated",
              type: "Operation",
              id: 2,
            },
            type: {
              type: "string",
              id: 3,
            },
            status: {
              type: "string",
              id: 4,
            },
          },
          nested: {
            Operation: {
              fields: {
                operation_identifier: {
                  type: "int64",
                  id: 1,
                },
                address: {
                  type: "bytes",
                  id: 2,
                },
                amount: {
                  type: "int64",
                  id: 3,
                },
              },
            },
          },
        },
        BlockBalanceTrace: {
          fields: {
            block_identifier: {
              type: "BlockIdentifier",
              id: 1,
            },
            timestamp: {
              type: "int64",
              id: 2,
            },
            transaction_balance_trace: {
              rule: "repeated",
              type: "TransactionBalanceTrace",
              id: 3,
            },
          },
          nested: {
            BlockIdentifier: {
              fields: {
                hash: {
                  type: "bytes",
                  id: 1,
                },
                number: {
                  type: "int64",
                  id: 2,
                },
              },
            },
          },
        },
        AccountTrace: {
          fields: {
            balance: {
              type: "int64",
              id: 1,
            },
            placeholder: {
              type: "int64",
              id: 99,
            },
          },
        },
        AccountIdentifier: {
          fields: {
            address: {
              type: "bytes",
              id: 1,
            },
          },
        },
        AccountBalanceRequest: {
          fields: {
            account_identifier: {
              type: "AccountIdentifier",
              id: 1,
            },
            block_identifier: {
              type: "BlockBalanceTrace.BlockIdentifier",
              id: 2,
            },
          },
        },
        AccountBalanceResponse: {
          fields: {
            balance: {
              type: "int64",
              id: 1,
            },
            block_identifier: {
              type: "BlockBalanceTrace.BlockIdentifier",
              id: 2,
            },
          },
        },
        FreezeBalanceV2Contract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            frozen_balance: {
              type: "int64",
              id: 2,
            },
            resource: {
              type: "ResourceCode",
              id: 3,
            },
          },
        },
        UnfreezeBalanceV2Contract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            unfreeze_balance: {
              type: "int64",
              id: 2,
            },
            resource: {
              type: "ResourceCode",
              id: 3,
            },
          },
        },
        WithdrawExpireUnfreezeContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
          },
        },
        DelegateResourceContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            resource: {
              type: "ResourceCode",
              id: 2,
            },
            balance: {
              type: "int64",
              id: 3,
            },
            receiver_address: {
              type: "bytes",
              id: 4,
            },
            lock: {
              type: "bool",
              id: 5,
            },
            lock_period: {
              type: "int64",
              id: 6,
            },
          },
        },
        UnDelegateResourceContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            resource: {
              type: "ResourceCode",
              id: 2,
            },
            balance: {
              type: "int64",
              id: 3,
            },
            receiver_address: {
              type: "bytes",
              id: 4,
            },
          },
        },
        CancelAllUnfreezeV2Contract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
          },
        },
        SmartContract: {
          fields: {
            origin_address: {
              type: "bytes",
              id: 1,
            },
            contract_address: {
              type: "bytes",
              id: 2,
            },
            abi: {
              type: "ABI",
              id: 3,
            },
            bytecode: {
              type: "bytes",
              id: 4,
            },
            call_value: {
              type: "int64",
              id: 5,
            },
            consume_user_resource_percent: {
              type: "int64",
              id: 6,
            },
            name: {
              type: "string",
              id: 7,
            },
            origin_energy_limit: {
              type: "int64",
              id: 8,
            },
            code_hash: {
              type: "bytes",
              id: 9,
            },
            trx_hash: {
              type: "bytes",
              id: 10,
            },
            version: {
              type: "int32",
              id: 11,
            },
          },
          nested: {
            ABI: {
              fields: {
                entrys: {
                  rule: "repeated",
                  type: "Entry",
                  id: 1,
                },
              },
              nested: {
                Entry: {
                  fields: {
                    anonymous: {
                      type: "bool",
                      id: 1,
                    },
                    constant: {
                      type: "bool",
                      id: 2,
                    },
                    name: {
                      type: "string",
                      id: 3,
                    },
                    inputs: {
                      rule: "repeated",
                      type: "Param",
                      id: 4,
                    },
                    outputs: {
                      rule: "repeated",
                      type: "Param",
                      id: 5,
                    },
                    type: {
                      type: "EntryType",
                      id: 6,
                    },
                    payable: {
                      type: "bool",
                      id: 7,
                    },
                    stateMutability: {
                      type: "StateMutabilityType",
                      id: 8,
                    },
                  },
                  nested: {
                    EntryType: {
                      values: {
                        UnknownEntryType: 0,
                        Constructor: 1,
                        Function: 2,
                        Event: 3,
                        Fallback: 4,
                        Receive: 5,
                        Error: 6,
                      },
                    },
                    Param: {
                      fields: {
                        indexed: {
                          type: "bool",
                          id: 1,
                        },
                        name: {
                          type: "string",
                          id: 2,
                        },
                        type: {
                          type: "string",
                          id: 3,
                        },
                      },
                    },
                    StateMutabilityType: {
                      values: {
                        UnknownMutabilityType: 0,
                        Pure: 1,
                        View: 2,
                        Nonpayable: 3,
                        Payable: 4,
                      },
                    },
                  },
                },
              },
            },
          },
        },
        ContractState: {
          fields: {
            energy_usage: {
              type: "int64",
              id: 1,
            },
            energy_factor: {
              type: "int64",
              id: 2,
            },
            update_cycle: {
              type: "int64",
              id: 3,
            },
          },
        },
        CreateSmartContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            new_contract: {
              type: "SmartContract",
              id: 2,
            },
            call_token_value: {
              type: "int64",
              id: 3,
            },
            token_id: {
              type: "int64",
              id: 4,
            },
          },
        },
        TriggerSmartContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            contract_address: {
              type: "bytes",
              id: 2,
            },
            call_value: {
              type: "int64",
              id: 3,
            },
            data: {
              type: "bytes",
              id: 4,
            },
            call_token_value: {
              type: "int64",
              id: 5,
            },
            token_id: {
              type: "int64",
              id: 6,
            },
          },
        },
        ClearABIContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            contract_address: {
              type: "bytes",
              id: 2,
            },
          },
        },
        UpdateSettingContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            contract_address: {
              type: "bytes",
              id: 2,
            },
            consume_user_resource_percent: {
              type: "int64",
              id: 3,
            },
          },
        },
        UpdateEnergyLimitContract: {
          fields: {
            owner_address: {
              type: "bytes",
              id: 1,
            },
            contract_address: {
              type: "bytes",
              id: 2,
            },
            origin_energy_limit: {
              type: "int64",
              id: 3,
            },
          },
        },
        SmartContractDataWrapper: {
          fields: {
            smart_contract: {
              type: "SmartContract",
              id: 1,
            },
            runtimecode: {
              type: "bytes",
              id: 2,
            },
            contract_state: {
              type: "ContractState",
              id: 3,
            },
          },
        },
      },
    },
    google: {
      nested: {
        protobuf: {
          nested: {
            Any: {
              fields: {
                type_url: {
                  type: "string",
                  id: 1,
                },
                value: {
                  type: "bytes",
                  id: 2,
                },
              },
            },
          },
        },
      },
    },
  },
};

export default TronProto;



비트코인

// bitcoinjs-lib: ^6.1.6
import { Psbt, networks } from 'bitcoinjs-lib';
// ecpair: ^2.1.0
import { ECPairFactory, ECPairAPI } from 'ecpair';
// tiny-secp256k1: ^2.2.3
import * as tinysecp from 'tiny-secp256k1';
const ECPair: ECPairAPI = ECPairFactory(tinysecp);

/*
   mainnet: const network = network.bitcoin
   testnet: const network = network.testnet
*/
const network = networks.bitcoin;

const privateKey = 'cQ3WeXSYcVoD4TiuccNfC3CrraRJcYHBVdL2zPs2LjXVxXBqb3t6'
const serializedUnsignedTransaction = '70736274ff01009a020000000234794135579c28f2b658eef516beec96d4825d68d52295264bc6098bb3c05a2e0000000000ffffffff7ab9959981f575ef5f8c8589d0c9c22e064c0052ff45b7629e7154c9169b3d0d0100000000ffffffff0200e9a4350000000016001496f49a9801a4d8345d4dfa0e95b16abafd02205af8b3df110000000016001454fd2b57067bd2db550e613aafb316c070973cb9000000000001011f0027b9290000000016001454fd2b57067bd2db550e613aafb316c070973cb90001011f0065cd1d0000000016001454fd2b57067bd2db550e613aafb316c070973cb9000000';
const psbt = Psbt.fromHex(serializedUnsignedTransaction);
const keypair = ECPair.fromWIF(privateKey, network);
for (let i = 0; i < psbt.inputCount; i++) {
  psbt.signInput(i, keypair);
}

const validator = (pubkey: Buffer, msghash: Buffer, signature: Buffer): boolean => ECPair.fromPublicKey(pubkey).verify(msghash, signature);

for (let i = 0; i < psbt.inputCount; i++) {
  psbt.validateSignaturesOfInput(i, validator);
}
psbt.finalizeAllInputs();
const tx = psbt.extractTransaction();

const serializedSignedTransaction = tx.toHex();



카이아

// caver-js: ^1.11.0,
import Caver from 'caver-js';

const caver = new Caver();

const privateKey = '0x982ab8f630dced10f13e1d1eacd372ba71a04b2e4bfe376fbe5a4c38ca0e22be';
const serializedUnsignedTransaction = '0x31f8df0a850c570bd200830493e09433d539400478e51a64a3d38790698b933ccab8458094e509c03b2c985a503faac250ecc3fba6e85c4062b844a9059cbb000000000000000000000000e288daf23ed241f5e21d35adb73edd700e2a379900000000000000000000000000000000000000000000000029a2241af62c0000c4c30180809484f6e095304a796c5a317a130607d69798ba36dff847f8458207f5a02f05a543c2cd92620f720a373dd25394c31dd21322065c49dcd69a0e797bdd7aa01efaec056c6868085cf0a7955d688c50530a2f9dc4e5076ad895ff2c0f49c4c4';

const tx = caver.transaction.decode(serializedUnsignedTransaction);
/*
	mainnet: tx.chainId = '8217';
	testnet: tx.chainId = '1001';
*/
tx.chainId = '1001';

(async () => {
  await tx.sign(privateKey);
  const serializedSignedTransaction = tx.getRawTransaction();
}) ();



이오스

// enf-eosjs: ^23.0.0
import { PrivateKey } from 'enf-eosjs/dist/eosjs-key-conversions';

/*
	mainnet: 'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906'
	testnet: '73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d'
*/
const chainId = '73e4385a2708e6d7048834fbc1079f2fabb17b3c125b146af438971e90716c4d';

const privateKey = '5KF6KD2FqqEKjfTUTVPrmL2Uc9UMAAEwXD7sJHzvuZdi4mRrnGz';
const serializedUnsignedTransaction = '2263716635827d87ed3d000000000100a6823403ea3055000000572d3ccdcd0120e035324f13bb6a00000000a8ed32322620e035324f13bb6a10e035324f13bb6a102700000000000004454f530000000005313135353600';

const target = Buffer.concat([Buffer.from(chainId, 'hex'), Buffer.from(serializedUnsignedTransaction, 'hex'), Buffer.alloc(32)]);
const privateKeyObject = PrivateKey.fromString(privateKey);
const serializedSignedTransaction = privateKeyObject.sign(target, true, 'utf8').toString();



리플

// xrpl: ^3.1.0
import * as xrpl from 'xrpl';
// secp256k1: ^5.0.0
import * as secp256k1 from 'secp256k1';

const privateKey = '0011344882D54F3D142C39DE4272AB8EC50F960B385B2F922989C5AA06AC963061';
const serializedUnsignedTransaction = '120000220000000024001832952E00002D24201B0018B6A16140000000001E84806840000000000003E88114A6D7E15CBD306BDA682264ACD85CBAAD418F3DBD8314498CE9583D8389670363081C11922A6F0DB7EDCA';

const publicKey = Buffer.from(secp256k1.publicKeyCreate(Buffer.from(privateKey.slice(2), 'hex'))).toString('hex');
const wallet = new xrpl.Wallet(publicKey, privateKey);

const tx: xrpl.Payment = xrpl.decode(serializedUnsignedTransaction) as any;

const signedTx = wallet.sign(tx)
const serializedSignedTransaction = signedTx.tx_blob;



에이다

// @emurgo/cardano-serialization-lib-nodejs: ^11.5.0
import * as CardanoLib from '@emurgo/cardano-serialization-lib-nodejs';

const privateKey = 'ed25519_sk1ru95flz4f0uc2eqp4atmdes7z6vhghdm3qgw3zc9k3fxlcqr5cdsuscen3'
const serializedUnsignedTransaction = 'a4008282582032a3e3cc9d8bef8ddce14ac196b3db59da230bea3301c9d3b2591dfbfecd729f00825820825a4853bdcf49204ca92b2d51d37953c18f6f9a82f52bdaaa85717b784acd1f000182825839006e32b278d376e6b7d8a02b2a0b0b262fec4c6e67b726d8e8871079f26c96f9bf433d6a20db06b716d5bd3a54795ed5e6444fe90b179e46e01a015ef3c082581d60a553e470ba2950462c53aaca5f09c8638b25b000d47f8c69f5b514ae1a0068252b021a0002aa95031a03bc2290';

const txBody = CardanoLib.TransactionBody.from_hex(serializedUnsignedTransaction);
const txHash = CardanoLib.hash_transaction(txBody);

const witnesses = CardanoLib.TransactionWitnessSet.new();
const vkeyWitnesses = CardanoLib.Vkeywitnesses.new();
const cardanoPrivateKey = CardanoLib.PrivateKey.from_bech32(privateKey);
const vkeyWitness = CardanoLib.make_vkey_witness(txHash, cardanoPrivateKey);
vkeyWitnesses.add(vkeyWitness);
witnesses.set_vkeys(vkeyWitnesses);

const txObject = CardanoLib.Transaction.new(txBody, witnesses, undefined);
const serializedSignedTransaction = txObject.to_hex();



비트코인 캐시

// @hexlant/bchjs: 1.0.0
import { TransactionBuilder, Transaction } from '@hexlant/bchjs';
// ^9.1.2
import BigNumber from 'bignumber.js';
// bitcoinjs-lib: ^6.1.6
import { networks } from 'bitcoinjs-lib';
// ecpair: ^2.1.0
import { ECPairFactory, ECPairAPI } from 'ecpair';
// tiny-secp256k1: ^2.2.3
import * as tinysecp from 'tiny-secp256k1';
const ECPair: ECPairAPI = ECPairFactory(tinysecp);

(async()=> {
  /**
	  출금 신청 정보 조회 API 호출한 결과.
	  sign시 value에 대한 정보가 필요해 출금시 정해진 utxo 리스트를 조회하여 확인합니다.
   * */
  const data = DATA;

	/*
		mainnet: const network = network.bitcoin
	  testnet: const network = network.testnet
	*/
  const network = networks.bitcoin;
  
  const privateKey = 'cQUhpekVgjS8gp3kBu4CREGYUUKK7fBtQJfjZedqUFSSyJ8z5eD9'
  const unsignedSerializedTransaction = '02000000023d239c57db9e189586f70583303b4288fa26be84893aeac47bc2391ad5bbae0d0000000000ffffffff0547c48359a82d092e1a433ffed3b2fb10655ec0d7370930bd71cbff39d480a70100000000ffffffff020008af2f000000001976a9144c53fdb6ebe02b7c092a050dd90cd3965ecfaa2c88ac60cae70b000000001976a9148fba15673a1a0308fe5e0920652089d2b4b4a3f488ac00000000';

  const tx = Transaction.fromHex(unsignedSerializedTransaction);
  const txBuilder = TransactionBuilder.fromTransaction(tx, network);
  const keypair = ECPair.fromWIF(privateKey, network);
  txBuilder.setBitcoinCash(true);

  for (let i = 0; i < tx.ins.length; i++) {
    const txid = Buffer.from(tx.ins[i].hash).reverse().toString('hex');
    const index = tx.ins[i].index;
    const targetUtxo = data.utxos.find(utxo => utxo.txid === txid && utxo.outputIndex === index);
    const satoshiValue = new BigNumber(targetUtxo.amount).multipliedBy(10**8).toNumber();
    txBuilder.sign(i, keypair, null, Transaction.SIGHASH_BITCOINCASHBIP143 | Transaction.SIGHASH_ALL, satoshiValue);
  }

  const serializedSignedTransaction = txBuilder.build().toHex();
}) ();




코스모스

// @cosmjs/amino: ^0.32.4
// @cosmjs/encoding: ^0.32.1
// @cosmjs/proto-signing: ^0.32.1
// @cosmjs/stargate: ^0.32.1
// bignumber.js: ^9.0.1
// cosmjs-types: ^0.9.0

import { encodeSecp256k1Pubkey } from "@cosmjs/amino";
import { fromBase64, fromHex, toHex } from "@cosmjs/encoding";
import {
  DirectSecp256k1Wallet,
  encodePubkey,
  makeAuthInfoBytes,
  makeSignDoc,
} from "@cosmjs/proto-signing";
import { StargateClient } from "@cosmjs/stargate";
import BigNumber from "bignumber.js";
import { AuthInfo, TxRaw } from "cosmjs-types/cosmos/tx/v1beta1/tx";

// mainnet
// const CosmosRpcEndpoint = "https://rpc.cosmos.directory/cosmoshub";
// testnet
const CosmosRpcEndpoint = "https://rpc.sentry-01.theta-testnet.polypore.xyz";

const privateKey =
  "0x0cffde5d45c6e1226c5bd8316d64f33d2aaf1fd588a89147c6494a6c09950590";
const serializedUnsignedTransaction =
  "0aa0010a8a010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e64126a0a2d636f736d6f733138333366326335766c306c377678346e386c326b66656d6870386c6e647a3535637173307366122d636f736d6f733166646a326839363872726b6d736563706161753435356a636377377a6d736a743971743979741a0a0a057561746f6d12013112116865786c616e742d6d656d6f2d7465737412200a0a0a0012040a020801180212120a0c0a057561746f6d120335303010a08d06";

(async () => {
  const client = await StargateClient.connect(CosmosRpcEndpoint);

  const wallet = await DirectSecp256k1Wallet.fromKey(
    fromHex(privateKey.slice(2))
  );
  const deserializedTxRaw = TxRaw.decode(
    fromHex(serializedUnsignedTransaction)
  );

  const accountData = (await wallet.getAccounts())[0];
  const pubkey = encodePubkey(encodeSecp256k1Pubkey(accountData.pubkey));
  const decodedAuthInfo = AuthInfo.decode(deserializedTxRaw.authInfoBytes);

  const authInfoBytes = makeAuthInfoBytes(
    [{ pubkey: pubkey, sequence: decodedAuthInfo.signerInfos[0].sequence }],
    decodedAuthInfo.fee.amount,
    new BigNumber(decodedAuthInfo.fee.gasLimit.toString()).toNumber(),
    decodedAuthInfo.fee.granter,
    decodedAuthInfo.fee.payer
  );

  const accountInfo = await client.getAccount(accountData.address);
  const chainId = await client.getChainId();
  const signDoc = makeSignDoc(
    deserializedTxRaw.bodyBytes,
    authInfoBytes,
    chainId,
    accountInfo.accountNumber
  );

  const { signature, signed } = await wallet.signDirect(
    accountData.address,
    signDoc
  );

  const signedTxRaw = TxRaw.fromPartial({
    bodyBytes: signed.bodyBytes,
    authInfoBytes: signed.authInfoBytes,
    signatures: [fromBase64(signature.signature)],
  });

  const signedTxBytes = TxRaw.encode(signedTxRaw).finish();
  const serializedSignedTransaction = toHex(signedTxBytes);
})();




엑스플라

// @xpla/xpla.js: ^1.3.1

import {
  LCDClient,
  ModeInfo,
  RawKey,
  SignDoc,
  SignMode,
  SignatureV2,
  SignerInfo,
  Tx,
} from "@xpla/xpla.js";

// mainnet
// const XplaRpcEndpoint = "https://dimension-lcd.xpla.dev/";
// const XplaChainId = "dimension_37-1";
// testnet
const XplaRpcEndpoint = "https://cube-lcd.xpla.dev";
const XplaChainId = "cube_47-5";

const lcd = new LCDClient({
  URL: XplaRpcEndpoint,
  chainID: XplaChainId,
});

const privateKey =
  "0xe26282caf9bd0c64eff2664854e7e3093815037a3ef750ee36d39b7891bb49f2";
const serializedUnsignedTransaction =
  "CoQCCu4BCiQvY29zbXdhc20ud2FzbS52MS5Nc2dFeGVjdXRlQ29udHJhY3QSxQEKK3hwbGExcnVqNXlqOWxxeGtoM3RtZjRlbjc3ZXZ4ZmxyZ2c0cDgzaGR6MHASP3hwbGExdnl4ZTdsZzBqN3lkN2Roa3k1cno3eHA5aHJtNHh3YWZsbWRnNWZtOHF2NzJxOTNud3kwc2E5dnMzNBpVeyJ0cmFuc2ZlciI6eyJhbW91bnQiOiIxIiwicmVjaXBpZW50IjoieHBsYTFqNjkwaDBrNzcwNWs4cG5namdybDl0ZHkyMnBhdmNkbGR4MHgyMiJ9fRIRaGV4bGFudC1tZW1vLXRlc3QSWQo0CioKKC9ldGhlcm1pbnQuY3J5cHRvLnYxLmV0aHNlY3AyNTZrMS5QdWJLZXkSBAoCCAEYAhIhChsKBWF4cGxhEhIyNTUwMDAwMDAwMDAwMDAwMDAQ4KcS";

(async () => {
  const bufferPrivateKey = Buffer.from(privateKey.slice(2), "hex");
  const rawKey = new RawKey(bufferPrivateKey);
  const wallet = lcd.wallet(rawKey);

  const txRaw = lcd.tx.decode(serializedUnsignedTransaction);

  const accountNumber = await wallet.accountNumber();

  const copyTx = new Tx(txRaw.body, txRaw.auth_info, []);
  const signDoc = new SignDoc(
    XplaChainId,
    accountNumber,
    copyTx.auth_info.signer_infos[0].sequence,
    copyTx.auth_info,
    copyTx.body
  );
  const signature = await wallet.key.createSignature(signDoc);
  const sigData = signature.data.single as SignatureV2.Descriptor.Single;

  copyTx.signatures.push(...txRaw.signatures, sigData.signature);
  copyTx.auth_info.signer_infos = [
    new SignerInfo(
      signature.public_key,
      signature.sequence,
      new ModeInfo(new ModeInfo.Single(SignMode.SIGN_MODE_DIRECT))
    ),
  ];

  const serializedSignedTransaction = lcd.tx.encode(copyTx);
})();