---
title: /sendTransactionToEvmContractWithRawHex
slug: sendtransactiontoevmcontractwithrawhex
createdAt: 2024-01-09T12:30:00.561Z
---

{
  "id": "jd7Qi0O0Iav8BVdmTPerC",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "http://1.1.1.1/sendTransactionToEvmContractWithRawHex",
    "servers": [
      {
        "url": "http://1.1.1.1/sendTransactionToEvmContractWithRawHex"
      }
    ],
    "name": "",
    "description": "<h1>Smart Contracts</h1>\n<p>This is an explanation on how to access smart contracts on the EVM and Tezos networks secured by GK8's MPC\nThis is very similar to sending a normal transaction except of:</p>\n<ol>\n<li>\n<p>Instead of sending using the sendTransaction, use the following APIs:</p>\n<ul>\n<li>\n<p>For EVM contracts, use sendTransactionToEvmContractWithContractInfo or sendTransactionToEvmContractWithRawHex APIs.\nsendTransactionToEvmContractWithContractInfo is meant where you know the parameters you want to send to the function and the ABI.\nsendTransactionToEvmContractWithRawHex is meant where this data is already compiled to binary and ready to be sent .\nNotice that sending funds to the fallback function is done with sendTransaction.</p>\n</li>\n<li>\n<p>For Tezos contracts, use sendTransactionToTezosContractWithContractInfo API.</p>\n</li>\n</ul>\n</li>\n<li>\n<p>Transfer with amount 0 is allowed now as long as it sending to a smart contract.</p>\n</li>\n<li>\n<p>When sending transaction to an EVM contract, low gas limit is forbidden, 21500 is tested, higher fee is recommended</p>\n</li>\n<li>\n<p>It is highly recommended to send transactions with flag validateTransaction so that the system can run\neth_call(EVM) / dry-run(Tezos) and prevent wasting gas.</p>\n</li>\n</ol>\n<p>It is important to understand that all the things in GK8 system also applies on smart contracts. Limitation, Policies approvals and more.</p>\n<p>Please read the documentation on sendTransactionToEvmContractWithContractInfo, sendTransactionToEvmContractWithRawHex and\nsendTransactionToTezosContractWithContractInfo for more details.</p>\n<ul>\n<li>\n<p>This function refers only to EVMs</p>\n</li>\n<li>\n<p>return - Dict ready to be sent to the MPC by the function sendTransaction</p>\n</li>\n</ul>\n<p>********** NOTE: success or failure in this api call does not necessarily means success or failure in the transaction itself.</p>\n<p>********** for example, the transaction may work by the response to the client can be lost in communication (if the internet is down for the client).</p>\n<p>********** another example is that the transaction was approved here but failed in the signing process\nTo know the status of the transaction you can access the function getTransactionByToken.</p>\n<p>To get the token to send those functions you should call getCurrentToken one action BEFORE sendTransaction:\nmyTokenToStoreInTheDb = user.getCurrentToken()\nsendTransactionToEvmContractWithRawHex(...)\n.....\nuser.getTransactionByToken(myTokenToStoreInTheDb,\"ETH\")</p>\n<p>example:</p>\n<ul>\n<li>ETH: sendTransactionToEvmContractWithRawHex(1,\"0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe\",\"6000\",\"50000000000\",70000, \"0x48656c6c6f2c20776f726c64210000000000000000000000000000000000000000\",True,False,\"example\",\"0xe75fb554e433e03763a1560646ee22dcb74e5274b34c5ad644e7c0f619a7e1d0\",\"ETH\",\"1000000000\")\n\"\"\"</li>\n</ul>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [
        {
          "kind": "required",
          "name": "account_id",
          "type": "integer",
          "example": 1,
          "description": "the account to send from",
          "default": 1
        },
        {
          "kind": "required",
          "name": "contract_address",
          "type": "string",
          "example": "0xE4Fd4d9190075de22826DdeC437594d27fb549Ab",
          "description": "the address of the contract to send to",
          "default": "0xE4Fd4d9190075de22826DdeC437594d27fb549Ab"
        },
        {
          "kind": "required",
          "name": "amount",
          "type": "string",
          "example": "6000",
          "description": "<p>the amount to send with this transaction, in Wei</p>",
          "default": "6000"
        },
        {
          "kind": "required",
          "name": "gas_price",
          "type": "integer",
          "example": 1,
          "description": "<p>the gas_price we want to transfer with, in Wei</p>",
          "default": 1
        },
        {
          "kind": "required",
          "name": "gas_limit",
          "type": "integer",
          "example": 21500,
          "description": "<p>gas limit we want to transfer, in gas units - must be at least 21500</p>",
          "default": 21500
        },
        {
          "kind": "required",
          "name": "raw_data_in_hex",
          "type": "string",
          "example": "0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000",
          "description": "<p>data parsed and encoded already by the standard, must start with 0x</p>",
          "default": "0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000"
        },
        {
          "kind": "optional",
          "name": "max_priority_fee",
          "type": "string",
          "description": "<p>the max priority fee we want to tip the miner. Should be sent in EVM / ERC20 transactions that are EIP1559 type, otherwise should be None. (for more info, read <a href=\"https://metamask.io/1559/\" target=\"_blank\">https://metamask.io/1559/</a>)</p>"
        },
        {
          "kind": "optional",
          "name": "validate_transaction",
          "type": "boolean",
          "example": "False",
          "description": "<p>if this is true, the MPC wallet will access the node  to check if this transaction is\nlikely to fail by running dry-run, and will block the transaction if it is</p>",
          "default": "False"
        },
        {
          "kind": "optional",
          "name": "description",
          "type": "string",
          "example": "example",
          "description": "free text for the transaction",
          "default": "example"
        },
        {
          "kind": "optional",
          "name": "specificFromAddress",
          "type": "string",
          "example": "0x862842A56B5D5F30B7d519cCe683983F57499cE6",
          "description": "Deposit address to send from",
          "default": "0x862842A56B5D5F30B7d519cCe683983F57499cE6"
        },
        {
          "kind": "optional",
          "name": "evm_coin_symbol",
          "type": "string",
          "example": "ETH",
          "description": "<p>the coin symbol of the EVM network on which the smart contract is deployed, for example: ETH, CELO, etc...</p>",
          "default": "ETH"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "Request data for an Ethereum transaction.",
          "customType": "sendTransactionToEvmContractWithRawHexRequest",
          "schema": [
            {
              "name": "AccountId",
              "kind": "optional",
              "type": "integer",
              "description": "The ID of the user's account.",
              "example": 1,
              "default": 1
            },
            {
              "name": "CoinType",
              "kind": "optional",
              "type": "string",
              "description": "The type of cryptocurrency (e.g., ETH).",
              "example": "ETH",
              "default": "ETH"
            },
            {
              "name": "DataForContract",
              "kind": "optional",
              "type": "object",
              "description": "Data related to the smart contract transaction.",
              "example": "",
              "schema": [
                {
                  "name": "FunctionName",
                  "kind": "optional",
                  "type": "string",
                  "description": "The name of the contract function (e.g., \"transfer\").",
                  "example": "transfer",
                  "default": "transfer"
                },
                {
                  "name": "ParametersFieldsTypesAndValues",
                  "kind": "optional",
                  "type": "array",
                  "description": "An array of parameter types and values.",
                  "example": "",
                  "itemType": "object",
                  "customType": "object[]",
                  "schema": [
                    {
                      "name": "ParameterType",
                      "kind": "optional",
                      "type": "string",
                      "description": "The parameter type (e.g., \"address\").",
                      "example": "address",
                      "default": "address"
                    },
                    {
                      "name": "ParameterValue",
                      "kind": "optional",
                      "type": "string",
                      "description": "The parameter value.",
                      "example": "0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9",
                      "default": "0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9"
                    }
                  ]
                },
                {
                  "name": "validateTransaction",
                  "kind": "optional",
                  "type": "boolean",
                  "description": "A flag to validate the transaction (true or false).",
                  "example": "true",
                  "default": "true"
                }
              ]
            },
            {
              "name": "Fee",
              "kind": "optional",
              "type": "object",
              "description": "Transaction fee details.",
              "example": "",
              "schema": [
                {
                  "name": "GasLimit",
                  "kind": "optional",
                  "type": "integer",
                  "description": "The gas limit for the transaction.",
                  "example": 21500,
                  "default": 21500
                },
                {
                  "name": "GasPrice",
                  "kind": "optional",
                  "type": "string",
                  "description": "The gas price in wei.",
                  "example": "100000000000",
                  "default": "100000000000"
                }
              ]
            },
            {
              "name": "IsMetaMaskTransaction",
              "kind": "optional",
              "type": "boolean",
              "description": "A flag indicating if it's a MetaMask transaction (true or false).",
              "example": "False",
              "default": "False"
            },
            {
              "name": "SpecificFromAddress",
              "kind": "optional",
              "type": "string",
              "description": "The source address for the transaction.",
              "example": "0x862842A56B5D5F30B7d519cCe683983F57499cE6",
              "default": "0x862842A56B5D5F30B7d519cCe683983F57499cE6"
            },
            {
              "name": "Transactions",
              "kind": "optional",
              "type": "array",
              "description": "List of transaction details.",
              "example": "",
              "itemType": "object",
              "customType": "object[]",
              "schema": [
                {
                  "name": "AmountToTransfer",
                  "kind": "optional",
                  "type": "string",
                  "description": "The amount to transfer in wei.",
                  "example": "6000",
                  "default": "6000"
                },
                {
                  "name": "DestinationAddress",
                  "kind": "optional",
                  "type": "string",
                  "description": "The destination Ethereum address.",
                  "example": "0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7",
                  "default": "0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7"
                }
              ]
            },
            {
              "name": "UserDescription",
              "kind": "optional",
              "type": "string",
              "description": "A user-provided description for the transaction.",
              "example": "transferExample",
              "default": "transferExample"
            },
            {
              "name": "Meta",
              "kind": "optional",
              "type": "object",
              "modelRef": "#/components/schemas/MetaTokensendTransactionToEvmContractWithRawHex",
              "customType": "MetaTokensendTransactionToEvmContractWithRawHex",
              "schema": [
                {
                  "name": "FunctionName",
                  "kind": "optional",
                  "type": "string",
                  "description": "The Function to be called",
                  "example": "sendTransactionToEvmContractWithRawHex",
                  "default": "sendTransactionToEvmContractWithRawHex"
                },
                {
                  "name": "RandomData",
                  "kind": "optional",
                  "type": "string",
                  "description": "Random Data",
                  "example": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229",
                  "default": "288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229"
                },
                {
                  "name": "Destination",
                  "kind": "optional",
                  "type": "string",
                  "description": "Id of the server",
                  "example": "",
                  "default": "b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea"
                },
                {
                  "name": "Time",
                  "kind": "optional",
                  "type": "string",
                  "description": "UTC Time of execution",
                  "example": "2021-02-07T18:37:46.948Z",
                  "default": "2021-02-07T18:37:46.948Z"
                },
                {
                  "name": "Source",
                  "kind": "optional",
                  "type": "string",
                  "description": "User public key",
                  "example": "",
                  "default": "048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99"
                },
                {
                  "name": "AccessToken",
                  "kind": "optional",
                  "type": "string",
                  "description": "Token used for authentication purposes",
                  "example": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087",
                  "default": "51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087"
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/sendTransactionToEvmContractWithRawHexRequest",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "success",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "customType": "sendTransactionToEvmContractWithRawHexResponse",
            "schema": [
              {
                "name": "FunctionData",
                "kind": "optional",
                "type": "object",
                "example": "",
                "schema": [
                  {
                    "name": "ApprovalRequestStatus",
                    "kind": "optional",
                    "type": "integer",
                    "description": "returning integer type by enum options - \n\nPENDING = 0         #pending approval\nBEING_CANCELLED = 1 #canceled request\nEXPIRED = 2         #expired request\nAPPROVED = 3        #enough approvers before expired\nBEING_HANDLED = 4   #currently in handler\nHANDLED = 5        #finished handling\nCHECK_HANDLED = 6  #need to check status - if system shutdown while being handled\n",
                    "example": 4,
                    "default": 4
                  }
                ]
              },
              {
                "name": "CoinType",
                "kind": "optional",
                "type": "string",
                "description": "The coin in string to be used in this operation",
                "example": "CELO",
                "default": "CELO"
              },
              {
                "name": "Transactions",
                "kind": "optional",
                "type": "array",
                "description": "Array with every different txid for this transaction",
                "example": "",
                "itemType": "object",
                "customType": "object[]",
                "schema": [
                  {
                    "name": "AmountToTransfer",
                    "kind": "optional",
                    "type": "string",
                    "description": "Amount to be transferred in the crypto's smallest units (satoshi, wei, drops,...)",
                    "example": "6000",
                    "default": "6000"
                  },
                  {
                    "name": "DestinationAddress",
                    "kind": "optional",
                    "type": "string",
                    "description": "The address the amount is sent to",
                    "example": "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1",
                    "default": "0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1"
                  }
                ]
              },
              {
                "name": "Meta",
                "kind": "optional",
                "type": "object",
                "modelRef": "#/components/schemas/MetaResponse",
                "customType": "MetaResponse",
                "schema": [
                  {
                    "name": "AccessToken",
                    "kind": "optional",
                    "type": "string",
                    "description": "The new access token generated after this operation",
                    "example": "a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6",
                    "default": "a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6"
                  },
                  {
                    "name": "Destination",
                    "kind": "optional",
                    "type": "string",
                    "description": "Id of the server",
                    "example": "042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622",
                    "default": "042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622"
                  },
                  {
                    "name": "Source",
                    "kind": "optional",
                    "type": "string",
                    "description": "User public key",
                    "example": "df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355",
                    "default": "df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355"
                  },
                  {
                    "name": "Time",
                    "kind": "optional",
                    "type": "string",
                    "description": "UTC Time of execution",
                    "example": "2021-02-14 09:58:52.320",
                    "default": "2021-02-14 09:58:52.320"
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/sendTransactionToEvmContractWithRawHexResponse",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "example-0-curl",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url 'http://1.1.1.1/sendTransactionToEvmContractWithRawHex?account_id=1&contract_address=0xE4Fd4d9190075de22826DdeC437594d27fb549Ab&amount=6000&gas_price=1&gas_limit=21500&raw_data_in_hex=0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000&validate_transaction=False&description=example&specificFromAddress=0x862842A56B5D5F30B7d519cCe683983F57499cE6&evm_coin_symbol=ETH' \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"AccountId\": 1,\n     \"CoinType\": \"ETH\",\n     \"DataForContract\": {\n     \"FunctionName\": \"transfer\",\n     \"ParametersFieldsTypesAndValues\": [\n     {\n     \"ParameterType\": \"address\",\n     \"ParameterValue\": \"0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9\"\n     }\n     ],\n     \"validateTransaction\": \"true\"\n     },\n     \"Fee\": {\n     \"GasLimit\": 21500,\n     \"GasPrice\": \"100000000000\"\n     },\n     \"IsMetaMaskTransaction\": \"False\",\n     \"SpecificFromAddress\": \"0x862842A56B5D5F30B7d519cCe683983F57499cE6\",\n     \"Transactions\": [\n     {\n     \"AmountToTransfer\": \"6000\",\n     \"DestinationAddress\": \"0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7\"\n     }\n     ],\n     \"UserDescription\": \"transferExample\",\n     \"Meta\": {\n     \"FunctionName\": \"sendTransactionToEvmContractWithRawHex\",\n     \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n     \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n     \"Time\": \"2021-02-07T18:37:46.948Z\",\n     \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n     \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n     }\n     }'"
        },
        {
          "id": "example-1-javascript",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"AccountId\": 1,\n   \"CoinType\": \"ETH\",\n   \"DataForContract\": {\n      \"FunctionName\": \"transfer\",\n      \"ParametersFieldsTypesAndValues\": [\n         {\n            \"ParameterType\": \"address\",\n            \"ParameterValue\": \"0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9\"\n         }\n      ],\n      \"validateTransaction\": \"true\"\n   },\n   \"Fee\": {\n      \"GasLimit\": 21500,\n      \"GasPrice\": \"100000000000\"\n   },\n   \"IsMetaMaskTransaction\": \"False\",\n   \"SpecificFromAddress\": \"0x862842A56B5D5F30B7d519cCe683983F57499cE6\",\n   \"Transactions\": [\n      {\n         \"AmountToTransfer\": \"6000\",\n         \"DestinationAddress\": \"0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7\"\n      }\n   ],\n   \"UserDescription\": \"transferExample\",\n   \"Meta\": {\n      \"FunctionName\": \"sendTransactionToEvmContractWithRawHex\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"http://1.1.1.1/sendTransactionToEvmContractWithRawHex?account_id=1&contract_address=0xE4Fd4d9190075de22826DdeC437594d27fb549Ab&amount=6000&gas_price=1&gas_limit=21500&raw_data_in_hex=0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000&validate_transaction=False&description=example&specificFromAddress=0x862842A56B5D5F30B7d519cCe683983F57499cE6&evm_coin_symbol=ETH\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "example-2-ruby",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"http://1.1.1.1/sendTransactionToEvmContractWithRawHex?account_id=1&contract_address=0xE4Fd4d9190075de22826DdeC437594d27fb549Ab&amount=6000&gas_price=1&gas_limit=21500&raw_data_in_hex=0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000&validate_transaction=False&description=example&specificFromAddress=0x862842A56B5D5F30B7d519cCe683983F57499cE6&evm_coin_symbol=ETH\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"AccountId\": 1,\n   \"CoinType\": \"ETH\",\n   \"DataForContract\": {\n      \"FunctionName\": \"transfer\",\n      \"ParametersFieldsTypesAndValues\": [\n         {\n            \"ParameterType\": \"address\",\n            \"ParameterValue\": \"0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9\"\n         }\n      ],\n      \"validateTransaction\": \"true\"\n   },\n   \"Fee\": {\n      \"GasLimit\": 21500,\n      \"GasPrice\": \"100000000000\"\n   },\n   \"IsMetaMaskTransaction\": \"False\",\n   \"SpecificFromAddress\": \"0x862842A56B5D5F30B7d519cCe683983F57499cE6\",\n   \"Transactions\": [\n      {\n         \"AmountToTransfer\": \"6000\",\n         \"DestinationAddress\": \"0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7\"\n      }\n   ],\n   \"UserDescription\": \"transferExample\",\n   \"Meta\": {\n      \"FunctionName\": \"sendTransactionToEvmContractWithRawHex\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n})\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "example-3-python",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"http://1.1.1.1/sendTransactionToEvmContractWithRawHex?account_id=1&contract_address=0xE4Fd4d9190075de22826DdeC437594d27fb549Ab&amount=6000&gas_price=1&gas_limit=21500&raw_data_in_hex=0xa9059cbb000000000000000000000000963d0aef2a6ba868b38cb032f2a81db145c467fb0000000000000000000000000000000000000000000000056bc75e2d63100000&validate_transaction=False&description=example&specificFromAddress=0x862842A56B5D5F30B7d519cCe683983F57499cE6&evm_coin_symbol=ETH\"\n\npayload = json.dumps({\n   \"AccountId\": 1,\n   \"CoinType\": \"ETH\",\n   \"DataForContract\": {\n      \"FunctionName\": \"transfer\",\n      \"ParametersFieldsTypesAndValues\": [\n         {\n            \"ParameterType\": \"address\",\n            \"ParameterValue\": \"0xEDF9C138F990b4ed9b7cb83F6ad8fF76017572B9\"\n         }\n      ],\n      \"validateTransaction\": \"true\"\n   },\n   \"Fee\": {\n      \"GasLimit\": 21500,\n      \"GasPrice\": \"100000000000\"\n   },\n   \"IsMetaMaskTransaction\": \"False\",\n   \"SpecificFromAddress\": \"0x862842A56B5D5F30B7d519cCe683983F57499cE6\",\n   \"Transactions\": [\n      {\n         \"AmountToTransfer\": \"6000\",\n         \"DestinationAddress\": \"0x04e5C3F98ac6711baDd357A76E8FEAe226Dd60c7\"\n      }\n   ],\n   \"UserDescription\": \"transferExample\",\n   \"Meta\": {\n      \"FunctionName\": \"sendTransactionToEvmContractWithRawHex\",\n      \"RandomData\": \"288cd49d4b8bf00e7d6114b78d5668d5581d6b953fafef779133caa844cd4229\",\n      \"Destination\": \"b9cb8afe52f1d52521cf2b62dfe12146156ad5328f83c62c20c7da81b263356a61340de745c858998544c041798b01c2f4fac31bebe52a19280a32cd57d6d374ea\",\n      \"Time\": \"2021-02-07T18:37:46.948Z\",\n      \"Source\": \"048b99461a70a49abe63fd585cb224177a22a92d2e9e4ddfbc0027887bee9d1843388f42a3eb2e740565e115ad8b7981abf59e3b03b771f4b063b53c517d7a9d99\",\n      \"AccessToken\": \"51311c84d2c8fd2fafbe56ceb1fb30a99d3417abfc55769577338ab286798087\"\n   }\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "example-0-curl"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "// success\n{\n  \"FunctionData\": {\n    \"ApprovalRequestStatus\": 4\n  },\n  \"CoinType\": \"CELO\",\n  \"Transactions\": [\n    {\n      \"AmountToTransfer\": \"6000\",\n      \"DestinationAddress\": \"0x874069Fa1Eb16D44d622F2e0Ca25eeA172369bC1\"\n    }\n  ],\n  \"Meta\": {\n    \"AccessToken\": \"a3e816b5bc04302d99da94705ec2309a4a63fe10d6aed3c5f6fc9e7ff27c6be6\",\n    \"Destination\": \"042c671aeb148d9b2bb4918399c4c925f3764248c5ab2d5194ab0f32664132834692699a75e7fafb5af35f183b7d8a68bdc3b3e6ebfaff8ab555b9a3caf8090622\",\n    \"Source\": \"df4b76a23067a9d782d09a7372ed526ec713cf6d771fac4dbdb9610f7af36d570a157eed76986b8e85afde12888d10d10bef461399e490f3d7e4db44cde1b6e355\",\n    \"Time\": \"2021-02-14 09:58:52.320\"\n  }\n}"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "children": [
    {
      "id": "3AHGI76oRnDFQF-1MU2ds",
      "type": "h1",
      "children": [
        {
          "text": "Smart Contracts",
          "id": "l9EgD6VOSkAoHljQZUD5R"
        }
      ],
      "data": {
        "autoGeneratedAnchorSlug": "smart-contracts",
        "legacyHash": "3AHGI"
      }
    },
    {
      "id": "OyFpYJNALJ4we8GHfM3kO",
      "type": "paragraph",
      "children": [
        {
          "text": "This is an explanation on how to access smart contracts on the EVM and Tezos networks secured by GK8's MPC\nThis is very similar to sending a normal transaction except of:",
          "id": "p4lYvzov3aC5Ph0NRtZ-6"
        }
      ]
    },
    {
      "id": "4fmalXBWpKcXFFm1NoTqY",
      "type": "numbered-list",
      "children": [
        {
          "id": "mpdpe_Jc7tanwomB__U-K",
          "type": "list-item",
          "children": [
            {
              "id": "DMvFv4tso_vn5xr--NzgA",
              "type": "list-item-child",
              "children": [
                {
                  "text": "Instead of sending using the sendTransaction, use the following APIs:",
                  "id": "9lS6pDlAGr29Li0I9dFiV"
                }
              ]
            },
            {
              "id": "6NhNRyXvM0AGq-X5oywCF",
              "type": "bulleted-list",
              "children": [
                {
                  "id": "TSO1DfaFLMHEw96-BTziP",
                  "type": "list-item",
                  "children": [
                    {
                      "id": "y7HkAXWcKp_Gp3oWbqd2Q",
                      "type": "list-item-child",
                      "children": [
                        {
                          "text": "For EVM contracts, use sendTransactionToEvmContractWithContractInfo or sendTransactionToEvmContractWithRawHex APIs.\nsendTransactionToEvmContractWithContractInfo is meant where you know the parameters you want to send to the function and the ABI.\nsendTransactionToEvmContractWithRawHex is meant where this data is already compiled to binary and ready to be sent .\nNotice that sending funds to the fallback function is done with sendTransaction.",
                          "id": "Iz3gc2_JO6Nc3iCx8fsw7"
                        }
                      ]
                    }
                  ]
                },
                {
                  "id": "BvcCMxaQKMwoR_UeestvY",
                  "type": "list-item",
                  "children": [
                    {
                      "id": "yBMdblXMGtWrzTapdLt4N",
                      "type": "list-item-child",
                      "children": [
                        {
                          "text": "For Tezos contracts, use sendTransactionToTezosContractWithContractInfo API.",
                          "id": "nt2c7iSILIt2rWfzlqLNI"
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "id": "obqwSdbpUZp6UjQZdpEN9",
          "type": "list-item",
          "children": [
            {
              "id": "D49ax1lwzrsiyrsIspBCG",
              "type": "list-item-child",
              "children": [
                {
                  "text": "Transfer with amount 0 is allowed now as long as it sending to a smart contract.",
                  "id": "puMXjn7GFYPyTHHcz_aYY"
                }
              ]
            }
          ]
        },
        {
          "id": "e3X623GEDcLdGwBIFuxik",
          "type": "list-item",
          "children": [
            {
              "id": "QI5P30qmDFZ0H-WY0-AYV",
              "type": "list-item-child",
              "children": [
                {
                  "text": "When sending transaction to an EVM contract, low gas limit is forbidden, 21500 is tested, higher fee is recommended",
                  "id": "ds0BIqTzTSR5HrXriOUdy"
                }
              ]
            }
          ]
        },
        {
          "id": "j_3rG1sBRuM5pyfrjKcvC",
          "type": "list-item",
          "children": [
            {
              "id": "4yN50c9335xD7BqoldIc9",
              "type": "list-item-child",
              "children": [
                {
                  "text": "It is highly recommended to send transactions with flag validateTransaction so that the system can run\neth_call(EVM) / dry-run(Tezos) and prevent wasting gas.",
                  "id": "hyV47Gx-Y-0T5QXefFjNn"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "VApcXiD-Mg6j8TWpCFYWP",
      "type": "paragraph",
      "children": [
        {
          "text": "It is important to understand that all the things in GK8 system also applies on smart contracts. Limitation, Policies approvals and more.",
          "id": "GYYDxoCcy5JYWOsRvVP7W"
        }
      ]
    },
    {
      "id": "yTWWoWMSLLMs0a2IkT4yf",
      "type": "paragraph",
      "children": [
        {
          "text": "Please read the documentation on sendTransactionToEvmContractWithContractInfo, sendTransactionToEvmContractWithRawHex and\nsendTransactionToTezosContractWithContractInfo for more details.",
          "id": "qwerq9-obV-Cgm2R3Nxu9"
        }
      ]
    },
    {
      "id": "tLlCR5L9E96rXFsqziQ8k",
      "type": "bulleted-list",
      "children": [
        {
          "id": "lUW7Yyhm5E_Cfmv7d4Hcl",
          "type": "list-item",
          "children": [
            {
              "id": "jDOH9uDQmOg08kuBHOVvE",
              "type": "list-item-child",
              "children": [
                {
                  "text": "This function refers only to EVMs",
                  "id": "NSQYJBsHohryAlw7u4r_c"
                }
              ]
            }
          ]
        },
        {
          "id": "Kn-tAcapGyjtRlRR_0Mzk",
          "type": "list-item",
          "children": [
            {
              "id": "c1vdR66fMARgsOrHlNV_Y",
              "type": "list-item-child",
              "children": [
                {
                  "text": "return - Dict ready to be sent to the MPC by the function sendTransaction",
                  "id": "pzV-4BbthQbXqx0XzLQ7A"
                },
                {
                  "text": "",
                  "id": "PnhHXzG1vjkhDZzvF2a4B"
                },
                {
                  "text": "",
                  "id": "EVCCm-FozhBSnUeh3NfS9"
                }
              ]
            }
          ]
        }
      ]
    },
    {
      "id": "LgwhfKwbS3O_6owT60q0R",
      "type": "paragraph",
      "children": [
        {
          "text": "",
          "id": "hZNI9ubLoqhw-OFaCHw9R"
        },
        {
          "text": "",
          "bold": true,
          "id": "qfXZzUPq-pkRmsg9w0uK4"
        },
        {
          "text": "",
          "id": "EpsXR4WPpaSXQ9ztLj2D2"
        },
        {
          "text": "",
          "bold": true,
          "id": "czzmMrRT10_t9wahMDEKP"
        },
        {
          "text": "** NOTE: success or failure in this api call does not necessarily means success or failure in the transaction itself.",
          "id": "Npcy2L5qwgP8aBSCPmGM0"
        },
        {
          "text": "",
          "id": "2boRZPMhjvSWY0xFC26QF"
        }
      ]
    },
    {
      "id": "d6e62CxYX-eNn84KiiunO",
      "type": "paragraph",
      "children": [
        {
          "text": "",
          "id": "1CXqN7nHWHTSL1uDbj5dj"
        },
        {
          "text": "",
          "bold": true,
          "id": "LP3iP2Wy5JRmqaYyOuJXD"
        },
        {
          "text": "",
          "id": "R2yYz1O8QJcOJQJeLYNmW"
        },
        {
          "text": "",
          "bold": true,
          "id": "ja5B5ajoC2v330bUcLoCq"
        },
        {
          "text": "** for example, the transaction may work by the response to the client can be lost in communication (if the internet is down for the client).",
          "id": "KmDgIHGYCmD1GqUW_TwWX"
        },
        {
          "text": "",
          "id": "OvXgq7g_XE_aAxKsM02oj"
        }
      ]
    },
    {
      "id": "hTHwIFUunXDn_Tmq_GUOy",
      "type": "paragraph",
      "children": [
        {
          "text": "",
          "id": "ykdizjSqmgq24E_5wGzhK"
        },
        {
          "text": "",
          "bold": true,
          "id": "VWQaf9TVOTzeSnDymfdqo"
        },
        {
          "text": "",
          "id": "1q9Db3iPNwiPry5aH3X8t"
        },
        {
          "text": "",
          "bold": true,
          "id": "x7kf6UXyhs0fIndJm6hsb"
        },
        {
          "text": "** another example is that the transaction was approved here but failed in the signing process\nTo know the status of the transaction you can access the function getTransactionByToken.",
          "id": "OXzqC89KjA-OgkgCe8c2x"
        },
        {
          "text": "",
          "id": "ueoYP_dxSHXKQwbVYBLma"
        }
      ]
    },
    {
      "id": "ieNiyTwAcDyEqTruw7iab",
      "type": "paragraph",
      "children": [
        {
          "text": "To get the token to send those functions you should call getCurrentToken one action BEFORE sendTransaction:",
          "id": "_jH4ZbUw2eNMBd89fvnFr"
        },
        {
          "text": "",
          "id": "xEkEHyeRonrD4ZLxFlUaM"
        },
        {
          "text": "\nmyTokenToStoreInTheDb = user.getCurrentToken()\nsendTransactionToEvmContractWithRawHex(...)",
          "id": "2QE1yyUta8qAF0Io5YO2u"
        },
        {
          "text": "",
          "id": "sQumdeMOg3owe4GHzWbNU"
        },
        {
          "text": "\n.....",
          "id": "h2VobLqvvsSCsd1X_ZgBr"
        },
        {
          "text": "",
          "id": "IGxjUqobLiNXfOR4rx9us"
        },
        {
          "text": "\nuser.getTransactionByToken(myTokenToStoreInTheDb,\"ETH\")",
          "id": "8LsdSgblM_rlkEx-RT3C5"
        }
      ]
    },
    {
      "id": "SuN4aX2XJBC303Jw5EdXC",
      "type": "paragraph",
      "children": [
        {
          "text": "example:",
          "id": "z5m8Rf-AGpar8xlSN6BZN"
        }
      ]
    },
    {
      "id": "bACZtO8L3DuztQdcYBsi1",
      "type": "bulleted-list",
      "children": [
        {
          "id": "VvI49YXeVuAtCqBztUGDA",
          "type": "list-item",
          "children": [
            {
              "id": "L7HGEN5skBSjyZq8RhOkX",
              "type": "list-item-child",
              "children": [
                {
                  "text": "ETH: sendTransactionToEvmContractWithRawHex(1,\"0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe\",\"6000\",\"50000000000\",70000, \"0x48656c6c6f2c20776f726c64210000000000000000000000000000000000000000\",True,False,\"example\",\"0xe75fb554e433e03763a1560646ee22dcb74e5274b34c5ad644e7c0f619a7e1d0\",\"ETH\",\"1000000000\")\n\"\"\"",
                  "id": "DM6pH9UdelxY4Ti6VL1Cv"
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}