Add-ons

From ArdorDocs
Jump to: navigation, search
Other languages:

Get Supported Contracts

Returns meta-data about the running contracts including the supported invocation types, contract invocation parameters, and contract validations. Refer to Monitoring the contract runner for details.

Request:

  • requestType is getSupportedContracts
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Response:

  • hasRandomSeed (B) is true if the it has a random seed, false otherwise
  • hasSecretPhrase (B) is true if the it has a secret phrase, false otherwise
  • supportedContracts (A) is an array of the contracts supported by the node
  • contractRunnerAccountRS (S) is the Reed-Solomon address of the account that executes the contract runner
  • hasValidatorSecretPhrase (B) is true if the it has a validator secret phrase, false otherwise
  • requestProcessingTime (N) is the API request processing time (in millisec)
  • status (S) is current status of the contract runner
  • contractRunnerAccount (N) is the number of the account that created the phasing poll
  • isValidator (B) is true the contract runner is set up to be a validator, false otherwise


Get Supported Contracts Example

http://localhost:27876/nxt?
  requestType=getSupportedContracts
{
    "hasRandomSeed": false,
    "hasSecretPhrase": false,
    "supportedContracts": [
        {
            "contractClass": "com.jelurida.ardor.contracts.HelloWorld",
            "invocationTypes": [
                {
                    "type": "TRANSACTION"
                }
            ],
            "validityChecks": [
                {
                    "name": "ValidateContractRunnerIsRecipient",
                    "forMethod": "processTransaction"
                },
                {
                    "reject": "[]",
                    "name": "ValidateChain",
                    "forMethod": "processTransaction",
                    "accept": "[2]"
                }
            ],
            "name": "HelloWorld",
            "setupParams": {},
            "supportedInvocationParams": [],
            "contractReference": {
                "contract": {
                    "chain": 2,
                    "transactionFullHash": "ae3c158e38413c303d020a1160cbab65d674e5db28d6f6ed80b9d049cadad8a5"
                },
                "name": "HelloWorld",
                "id": "10456916169191481399",
                "setupParameters": ""
            },
            "uploadTransaction": {
                "senderPublicKey": "16eda5d4705137e233ab3deaac60066512e157631e8c5ca82dedd88fdd5b4165",
                "chain": 2,
                "signature": "8174688cb0432573d50fa64c27402d225bb197d7f7e6f67f6c098c970fa402058c1bf4574204c438c8afd30361a7ee6aa281507c4546c2c182b12c2fe33bad1c",
                "feeNQT": "110000",
                "transactionIndex": 2,
                "type": 6,
                "confirmations": 9234,
                "fullHash": "ae3c158e38413c303d020a1160cbab65d674e5db28d6f6ed80b9d049cadad8a5",
                "version": 1,
                "fxtTransaction": "6034193387305973609",
                "phased": false,
                "ecBlockId": "1869239206860286922",
                "signatureHash": "47af926c27af0d7ab9c7e354ceaf8043803af2d46a9b45983d029dcaa2f1b471",
                "attachment": {
                    "filename": "HelloWorld.class",
                    "data": "cafebabe0000003400640a001500310a003200330700340a000300310800350700360a000600310800370a000600380b0039003a0a0006003b0a0003003c0b0039003d0a003e003f0a003e00400a000300410a003e00420a003e00430a003200440700450700460100063c696e69743e010003282956010004436f646501000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c65010004746869730100294c636f6d2f6a656c75726964612f6172646f722f636f6e7472616374732f48656c6c6f576f726c643b01001270726f636573735472616e73616374696f6e010030284c6e78742f6164646f6e732f5472616e73616374696f6e436f6e746578743b294c6e78742f6164646f6e732f4a4f3b010007636f6e7465787401001f4c6e78742f6164646f6e732f5472616e73616374696f6e436f6e746578743b010012747269676765725472616e73616374696f6e0100284c6e78742f687474702f726573706f6e7365732f5472616e73616374696f6e526573706f6e73653b0100076d65737361676501000f4c6e78742f6164646f6e732f4a4f3b01000f73656e644d65737361676543616c6c0100224c6e78742f687474702f63616c6c6572732f53656e644d65737361676543616c6c3b01001952756e74696d6556697369626c65416e6e6f746174696f6e7301002e4c6e78742f6164646f6e732f56616c6964617465436f6e747261637452756e6e65724973526563697069656e743b01001a4c6e78742f6164646f6e732f56616c6964617465436861696e3b010006616363657074030000000201000a536f7572636546696c6501000f48656c6c6f576f726c642e6a6176610100194c6e78742f6164646f6e732f436f6e7472616374496e666f3b01000776657273696f6e010007312e302e312e300c001600170700470c0048004901000d6e78742f6164646f6e732f4a4f010004746578740100176a6176612f6c616e672f537472696e674275696c64657201000648656c6c6f200c004a004b07004c0c004d004e0c004f004e0c005000510c005200530700540c005500560c005700580c0059004e0c002300580c005a005b0c005c0060010027636f6d2f6a656c75726964612f6172646f722f636f6e7472616374732f48656c6c6f576f726c6401001b6e78742f6164646f6e732f4162737472616374436f6e747261637401001d6e78742f6164646f6e732f5472616e73616374696f6e436f6e7465787401000e6765745472616e73616374696f6e01002a28294c6e78742f687474702f726573706f6e7365732f5472616e73616374696f6e526573706f6e73653b010006617070656e6401002d284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275696c6465723b0100266e78742f687474702f726573706f6e7365732f5472616e73616374696f6e526573706f6e736501000b67657453656e646572527301001428294c6a6176612f6c616e672f537472696e673b010008746f537472696e67010003707574010027284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f4f626a6563743b295601000a676574436861696e49640100032829490100206e78742f687474702f63616c6c6572732f53656e644d65737361676543616c6c0100066372656174650100252849294c6e78742f687474702f63616c6c6572732f53656e644d65737361676543616c6c3b010009726563697069656e74010036284c6a6176612f6c616e672f537472696e673b294c6e78742f687474702f63616c6c6572732f53656e644d65737361676543616c6c3b01000c746f4a534f4e537472696e670100116d65737361676549735072756e61626c65010025285a294c6e78742f687474702f63616c6c6572732f53656e644d65737361676543616c6c3b0100116372656174655472616e73616374696f6e0700620100074275696c64657201000c496e6e6572436c617373657301002b284c6e78742f687474702f41504943616c6c244275696c6465723b294c6e78742f6164646f6e732f4a4f3b0700630100186e78742f687474702f41504943616c6c244275696c6465720100106e78742f687474702f41504943616c6c002100140015000000000002000100160017000100180000002f00010001000000052ab70001b100000002001900000006000100000015001a0000000c000100000005001b001c00000001001d001e00020018000000bf00040005000000512bb600024dbb000359b700044e2d1205bb000659b700071208b600092cb9000a0100b60009b6000bb6000c2cb9000d0100b8000e2cb9000a0100b6000f2db60010b6001104b600123a042b1904b60013b00000000200190000002200080000002400050025000d0026002b00290035002a003e002b0045002c004a002d001a00000034000500000051001b001c000000000051001f002000010005004c002100220002000d0044002300240003004a000700250026000400270000001200020028000000290001002a5b000149002b0003002c00000002002d00270000000b0001002e0001002f730030005f0000000a0001005d0061005e0009",
                    "name": "com.jelurida.ardor.contracts.HelloWorld",
                    "channel": "contracts",
                    "description": "{\"version\":\"1.0.1.0\"}",
                    "type": "application/java-vm",
                    "version.TaggedDataUpload": 1,
                    "isText": false,
                    "hash": "7301ff7c855217cc743b742e4fd8c3f0fcbff66cccb5c8c918c38b2e6bab2644",
                    "tags": ""
                },
                "senderRS": "ARDOR-5TT2-VS3T-EUTS-7WDBA",
                "subtype": 0,
                "amountNQT": "0",
                "sender": "6063389766308718368",
                "ecBlockHeight": 773567,
                "block": "9433124858598202872",
                "blockTimestamp": 30654300,
                "deadline": 15,
                "timestamp": 30654302,
                "height": 774288
            }
        }
    ],
    "contractRunnerAccountRS": "ARDOR-5TT2-VS3T-EUTS-7WDBA",
    "hasValidatorSecretPhrase": false,
    "requestProcessingTime": 66,
    "status": "Ok",
    "contractRunnerAccount": "6063389766308718368",
    "isValidator": false
}


Upload Contract Runner Configuration

Uploads a parameters file contains a json array of contract definitions named "contracts". Refer to upload parameters configuration file for details

Request:

  • requestType is uploadContractRunnerConfiguration
  • config *file is the pathname of the config file to upload
  • requireBlock is the block ID of a block that must be present in the blockchain during execution (optional)
  • requireLastBlock is the block ID of a block that must be last in the blockchain during execution (optional)

Response:

  • configLoaded (B) is true if the it has a random seed, false otherwise
  • requestProcessingTime (N) is the API request processing time (in millisec)

Upload Contract Runner Configuration Example

http://localhost:27876/nxt?
  requestType=uploadContractRunnerConfiguration&
  config="c:\\tmp\\config.json"
{
    "configLoaded": true,
    "requestProcessingTime": 8
}