Contracts

List Contracts

curl -i \
-H 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fSwiZXhwIjpudWxsLCJpYXQiOjE1NTk4Nzg1NzQsImp0aSI6IjYzYTJkY2QzLWI5OTgtNDZjNC1hNzFkLTQ5MjU4YTBhYmEyMyIsInN1YiI6ImFwcGxpY2F0aW9uOmNiMjAzN2Y3LTc5ZmMtNDBmNC05NzIwLWFkYTYzNmRhNDE4MyJ9.NQLm__LbMWor-9GMG0LPcH4yQIbu9Uw70kJfRt1KP64' \
https://nchain.provide.services/api/v1/contracts
HTTP/2 200
content-type: application/json; charset=UTF-8
access-control-allow-credentials: true
access-control-allow-headers: Accept, Accept-Encoding, Authorization, Cache-Control, Content-Length, Content-Type, Origin, User-Agent, X-CSRF-Token, X-Requested-With
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Total-Results-Count
x-total-results-count: 2

Response JSON:

[
{
"id":"4440bc2b-8213-4939-b306-0ba838709dc5",
"created_at":"0001-01-01T00:00:00Z",
"application_id":"bca2348c-442f-4c48-99a4-7b3510385e53",
"network_id":"ef976635-545b-46c6-9576-4e3a893a68e9",
"contract_id":null,
"transaction_id":"d9e99716-de9d-4b13-8a08-87d77f8fda4e",
"name":"X12",
"address":"0x4e50F385407c8bd202F6A8664258F31701a5543d",
"params":null,
"accessed_at":null
},
{
"id":"cd2c915b-d65f-4b3f-ad3b-19e1dbff4192",
"created_at":"0001-01-01T00:00:00Z",
"application_id":"bca2348c-442f-4c48-99a4-7b3510385e53",
"network_id":"ef976635-545b-46c6-9576-4e3a893a68e9",
"contract_id":null,
"transaction_id":"6e401894-f091-4481-b978-e2a45eca0fd1",
"name":"Payments",
"address":"0x26DA5E12d0a0519e91e2AB759E6E93Ab05e9e51c",
"params":null,
"accessed_at":null
}
]

List smart contracts visible to the authorized User or Application.

Query Parameters

Parameter

Default

Description

filter_tokens

true

flag to indicate if Token contracts should be filtered from the response

sort

n/a

parameter to indicate how the response should be sorted; currently, recent is the only supported option and returns by accessed_at descending

Deploy Contract

curl -i \
-H 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fSwiZXhwIjpudWxsLCJpYXQiOjE1NTk4Nzg1NzQsImp0aSI6IjYzYTJkY2QzLWI5OTgtNDZjNC1hNzFkLTQ5MjU4YTBhYmEyMyIsInN1YiI6ImFwcGxpY2F0aW9uOmNiMjAzN2Y3LTc5ZmMtNDBmNC05NzIwLWFkYTYzNmRhNDE4MyJ9.NQLm__LbMWor-9GMG0LPcH4yQIbu9Uw70kJfRt1KP64' \
-H 'Content-Type: application/json' \
https://nchain.provide.services/api/v1/contracts \
-d '{
"application_id":"bca2348c-442f-4c48-99a4-7b3510385e53",
"network_id":"ef976635-545b-46c6-9576-4e3a893a68e9",
"params":{
"argv":[
],
"constructor":"X12",
"lang":"solidity",
"name":"X12",
"raw_source":"pragma solidity ^0.5.1;\n\ncontract X12 {\n\n struct transaction {\n string _sndr_interchange_id;\n string _sndr_interchange_qualifier;\n string _recv_interchange_id;\n string _recv_interchange_qualifier;\n string _tx_version;\n string _tx_type;\n string _edi_payload;\n }\n\n transaction[] internal txs;\n\n function ipfs_fields() public pure returns (bytes32[] memory) {\n bytes32[] memory _fields = new bytes32[](1);\n _fields[0] = \"edi_payload\";\n return _fields;\n }\n\n function send(\n string memory sndr_interchange_id,\n string memory sndr_interchange_qualifier,\n string memory recv_interchange_id,\n string memory recv_interchange_qualifier,\n string memory tx_version,\n string memory tx_type,\n string memory edi_payload\n ) public\n {\n transaction memory _tx = X12.transaction(sndr_interchange_id,sndr_interchange_qualifier,recv_interchange_id,recv_interchange_qualifier,tx_version,tx_type,edi_payload);\n txs.push(_tx);\n }\n}\n",
"account_id":"e6ef498b-589e-4514-9924-278b7bd6e3de"
}
}'
HTTP/2 201
date: Sun, 10 Jun 2019 03:50:04 GMT
content-type: application/json; charset=UTF-8
access-control-allow-credentials: true
access-control-allow-headers: Accept, Accept-Encoding, Authorization, Cache-Control, Content-Length, Content-Type, Origin, User-Agent, X-CSRF-Token, X-Requested-With
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Total-Results-Count

Response JSON:

{
"id":"4440bc2b-8213-4939-b306-0ba838709dc5",
"created_at":"2019-06-10T03:50:03.586264-04:00",
"application_id":"5c453bea-da24-4123-9b43-d35ded159531",
"network_id":"ef976635-545b-46c6-9576-4e3a893a68e9",
"contract_id":null,
"transaction_id":null,
"name":"X12",
"address":"0x",
"params":{
"argv":null,
"constructor":"X12",
"lang":"solidity",
"name":"X12",
"raw_source":"pragma solidity ^0.5.1;\n\ncontract X12 {\n\n struct transaction {\n string _sndr_interchange_id;\n string _sndr_interchange_qualifier;\n string _recv_interchange_id;\n string _recv_interchange_qualifier;\n string _tx_version;\n string _tx_type;\n string _edi_payload;\n }\n\n transaction[] internal txs;\n\n function ipfs_fields() public pure returns (bytes32[] memory) {\n bytes32[] memory _fields = new bytes32[](1);\n _fields[0] = \"edi_payload\";\n return _fields;\n }\n\n function send(\n string memory sndr_interchange_id,\n string memory sndr_interchange_qualifier,\n string memory recv_interchange_id,\n string memory recv_interchange_qualifier,\n string memory tx_version,\n string memory tx_type,\n string memory edi_payload\n ) public\n {\n transaction memory _tx = X12.transaction(sndr_interchange_id,sndr_interchange_qualifier,recv_interchange_id,recv_interchange_qualifier,tx_version,tx_type,edi_payload);\n txs.push(_tx);\n }\n}\n",
"account_id":"d9700171-54da-4a4a-88b0-9ce4b99454dc"
},
"accessed_at":null
}

Deploy a smart contract to a specific Network.

Retrieve Contract Details

curl -i \
-H 'Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fSwiZXhwIjpudWxsLCJpYXQiOjE1NTk4Nzg1NzQsImp0aSI6IjYzYTJkY2QzLWI5OTgtNDZjNC1hNzFkLTQ5MjU4YTBhYmEyMyIsInN1YiI6ImFwcGxpY2F0aW9uOmNiMjAzN2Y3LTc5ZmMtNDBmNC05NzIwLWFkYTYzNmRhNDE4MyJ9.0LsVj7oTF0KjwbcUhg9a-fQRWB7cGzKJxLIANeX2cWE' \
https://nchain.provide.services/api/v1/contracts/4440bc2b-8213-4939-b306-0ba838709dc5
HTTP/2 200
date: Sun, 10 Jun 2019 03:57:22 GMT
content-type: application/json; charset=UTF-8
access-control-allow-credentials: true
access-control-allow-headers: Accept, Accept-Encoding, Authorization, Cache-Control, Content-Length, Content-Type, Origin, User-Agent, X-CSRF-Token, X-Requested-With
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Total-Results-Count

Response JSON:

{
"id":"4440bc2b-8213-4939-b306-0ba838709dc5",
"created_at":"2019-06-09T23:50:15.260297-04:00",
"application_id":"bca2348c-442f-4c48-99a4-7b3510385e53",
"network_id":"ef976635-545b-46c6-9576-4e3a893a68e9",
"contract_id":null,
"transaction_id":"d9e99716-de9d-4b13-8a08-87d77f8fda4e",
"name":"X12",
"address":"0x4e50F385407c8bd202F6A8664258F31701a5543d",
"params":{
"abi":[
{
"constant":true,
"inputs":[
],
"name":"ipfs_fields",
"outputs":[
{
"name":"",
"type":"bytes32[]"
}
],
"payable":false,
"stateMutability":"pure",
"type":"function"
},
{
"constant":false,
"inputs":[
{
"name":"sndr_interchange_id",
"type":"string"
},
{
"name":"sndr_interchange_qualifier",
"type":"string"
},
{
"name":"recv_interchange_id",
"type":"string"
},
{
"name":"recv_interchange_qualifier",
"type":"string"
},
{
"name":"tx_version",
"type":"string"
},
{
"name":"tx_type",
"type":"string"
},
{
"name":"edi_payload",
"type":"string"
}
],
"name":"send",
"outputs":[
],
"payable":false,
"stateMutability":"nonpayable",
"type":"function"
}
],
"bytecode":"0x608060405234801561001057600080fd5b50610729806100206000396000f3fe608060405234801561001057600080fd5b5060043610610052577c01000000000000000000000000000000000000000000000000000000006000350463112268d3811461005757806372ac022b146100af575b600080fd5b61005f610481565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561009b578181015183820152602001610083565b505050509050019250505060405180910390f35b61047f600480360360e08110156100c557600080fd5b8101906020810181356401000000008111156100e057600080fd5b8201836020820111156100f257600080fd5b8035906020019184600183028401116401000000008311171561011457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561016757600080fd5b82018360208201111561017957600080fd5b8035906020019184600183028401116401000000008311171561019b57600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156101ee57600080fd5b82018360208201111561020057600080fd5b8035906020019184600183028401116401000000008311171561022257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561027557600080fd5b82018360208201111561028757600080fd5b803590602001918460018302840111640100000000831117156102a957600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092959493602081019350359150506401000000008111156102fc57600080fd5b82018360208201111561030e57600080fd5b8035906020019184600183028401116401000000008311171561033057600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561038357600080fd5b82018360208201111561039557600080fd5b803590602001918460018302840111640100000000831117156103b757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561040a57600080fd5b82018360208201111561041c57600080fd5b8035906020019184600183028401116401000000008311171561043e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506104e6945050505050565b005b604080516001808252818301909252606091829190602080830190803883390190505090507f6564695f7061796c6f61640000000000000000000000000000000000000000008160008151811015156104d657fe5b6020908102909101015290505b90565b6104ee610627565b506040805160e0810182528881526020808201899052918101879052606081018690526080810185905260a0810184905260c0810183905260008054600181018083559180528251805193949293859360079093027f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5630192610574928492910190610665565b50602082810151805161058d9260018501920190610665565b50604082015180516105a9916002840191602090910190610665565b50606082015180516105c5916003840191602090910190610665565b50608082015180516105e1916004840191602090910190610665565b5060a082015180516105fd916005840191602090910190610665565b5060c08201518051610619916006840191602090910190610665565b505050505050505050505050565b60e060405190810160405280606081526020016060815260200160608152602001606081526020016060815260200160608152602001606081525090565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106106a657805160ff19168380011785556106d3565b828001600101855582156106d3579182015b828111156106d35782518255916020019190600101906106b8565b506106df9291506106e3565b5090565b6104e391905b808211156106df57600081556001016106e956fea165627a7a72305820ca83d068203f70310115097a000608b2eae13cf2c954691747999cf4743572af0029d5",
"deps":{
},
"fingerprint":"ca83d068203f70310115097a000608b2eae13cf2c954691747999cf4743572af",
"name":"X12",
"opcodes":"PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH2 0x729 DUP1 PUSH2 0x20 PUSH1 0x0 CODECOPY PUSH1 0x0 RETURN INVALID PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x52 JUMPI PUSH29 0x100000000000000000000000000000000000000000000000000000000 PUSH1 0x0 CALLDATALOAD DIV PUSH4 0x112268D3 DUP2 EQ PUSH2 0x57 JUMPI DUP1 PUSH4 0x72AC022B EQ PUSH2 0xAF JUMPI JUMPDEST PUSH1 0x0 DUP1 REVERT JUMPDEST PUSH2 0x5F PUSH2 0x481 JUMP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x20 DUP1 DUP3 MSTORE DUP4 MLOAD DUP2 DUP4 ADD MSTORE DUP4 MLOAD SWAP2 SWAP3 DUP4 SWAP3 SWAP1 DUP4 ADD SWAP2 DUP6 DUP2 ADD SWAP2 MUL DUP1 DUP4 DUP4 PUSH1 0x0 JUMPDEST DUP4 DUP2 LT ISZERO PUSH2 0x9B JUMPI DUP2 DUP2 ADD MLOAD DUP4 DUP3 ADD MSTORE PUSH1 0x20 ADD PUSH2 0x83 JUMP JUMPDEST POP POP POP POP SWAP1 POP ADD SWAP3 POP POP POP PUSH1 0x40 MLOAD DUP1 SWAP2 SUB SWAP1 RETURN JUMPDEST PUSH2 0x47F PUSH1 0x4 DUP1 CALLDATASIZE SUB PUSH1 0xE0 DUP2 LT ISZERO PUSH2 0xC5 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP2 ADD SWAP1 PUSH1 0x20 DUP2 ADD DUP2 CALLDATALOAD PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0xE0 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0xF2 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x114 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x167 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x179 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x19B JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x1EE JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x200 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x222 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x275 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x287 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x2A9 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x2FC JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x30E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x330 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x383 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x395 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x3B7 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 SWAP5 SWAP4 PUSH1 0x20 DUP2 ADD SWAP4 POP CALLDATALOAD SWAP2 POP POP PUSH5 0x100000000 DUP2 GT ISZERO PUSH2 0x40A JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP3 ADD DUP4 PUSH1 0x20 DUP3 ADD GT ISZERO PUSH2 0x41C JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST DUP1 CALLDATALOAD SWAP1 PUSH1 0x20 ADD SWAP2 DUP5 PUSH1 0x1 DUP4 MUL DUP5 ADD GT PUSH5 0x100000000 DUP4 GT OR ISZERO PUSH2 0x43E JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST SWAP2 SWAP1 DUP1 DUP1 PUSH1 0x1F ADD PUSH1 0x20 DUP1 SWAP2 DIV MUL PUSH1 0x20 ADD PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 SWAP4 SWAP3 SWAP2 SWAP1 DUP2 DUP2 MSTORE PUSH1 0x20 ADD DUP4 DUP4 DUP1 DUP3 DUP5 CALLDATACOPY PUSH1 0x0 SWAP3 ADD SWAP2 SWAP1 SWAP2 MSTORE POP SWAP3 SWAP6 POP PUSH2 0x4E6 SWAP5 POP POP POP POP POP JUMP JUMPDEST STOP JUMPDEST PUSH1 0x40 DUP1 MLOAD PUSH1 0x1 DUP1 DUP3 MSTORE DUP2 DUP4 ADD SWAP1 SWAP3 MSTORE PUSH1 0x60 SWAP2 DUP3 SWAP2 SWAP1 PUSH1 0x20 DUP1 DUP4 ADD SWAP1 DUP1 CODESIZE DUP4 CODECOPY ADD SWAP1 POP POP SWAP1 POP PUSH32 0x6564695F7061796C6F6164000000000000000000000000000000000000000000 DUP2 PUSH1 0x0 DUP2 MLOAD DUP2 LT ISZERO ISZERO PUSH2 0x4D6 JUMPI INVALID JUMPDEST PUSH1 0x20 SWAP1 DUP2 MUL SWAP1 SWAP2 ADD ADD MSTORE SWAP1 POP JUMPDEST SWAP1 JUMP JUMPDEST PUSH2 0x4EE PUSH2 0x627 JUMP JUMPDEST POP PUSH1 0x40 DUP1 MLOAD PUSH1 0xE0 DUP2 ADD DUP3 MSTORE DUP9 DUP2 MSTORE PUSH1 0x20 DUP1 DUP3 ADD DUP10 SWAP1 MSTORE SWAP2 DUP2 ADD DUP8 SWAP1 MSTORE PUSH1 0x60 DUP2 ADD DUP7 SWAP1 MSTORE PUSH1 0x80 DUP2 ADD DUP6 SWAP1 MSTORE PUSH1 0xA0 DUP2 ADD DUP5 SWAP1 MSTORE PUSH1 0xC0 DUP2 ADD DUP4 SWAP1 MSTORE PUSH1 0x0 DUP1 SLOAD PUSH1 0x1 DUP2 ADD DUP1 DUP4 SSTORE SWAP2 DUP1 MSTORE DUP3 MLOAD DUP1 MLOAD SWAP4 SWAP5 SWAP3 SWAP4 DUP6 SWAP4 PUSH1 0x7 SWAP1 SWAP4 MUL PUSH32 0x290DECD9548B62A8D60345A988386FC84BA6BC95484008F6362F93160EF3E563 ADD SWAP3 PUSH2 0x574 SWAP3 DUP5 SWAP3 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0x20 DUP3 DUP2 ADD MLOAD DUP1 MLOAD PUSH2 0x58D SWAP3 PUSH1 0x1 DUP6 ADD SWAP3 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0x40 DUP3 ADD MLOAD DUP1 MLOAD PUSH2 0x5A9 SWAP2 PUSH1 0x2 DUP5 ADD SWAP2 PUSH1 0x20 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0x60 DUP3 ADD MLOAD DUP1 MLOAD PUSH2 0x5C5 SWAP2 PUSH1 0x3 DUP5 ADD SWAP2 PUSH1 0x20 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0x80 DUP3 ADD MLOAD DUP1 MLOAD PUSH2 0x5E1 SWAP2 PUSH1 0x4 DUP5 ADD SWAP2 PUSH1 0x20 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0xA0 DUP3 ADD MLOAD DUP1 MLOAD PUSH2 0x5FD SWAP2 PUSH1 0x5 DUP5 ADD SWAP2 PUSH1 0x20 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP PUSH1 0xC0 DUP3 ADD MLOAD DUP1 MLOAD PUSH2 0x619 SWAP2 PUSH1 0x6 DUP5 ADD SWAP2 PUSH1 0x20 SWAP1 SWAP2 ADD SWAP1 PUSH2 0x665 JUMP JUMPDEST POP POP POP POP POP POP POP POP POP POP POP POP JUMP JUMPDEST PUSH1 0xE0 PUSH1 0x40 MLOAD SWAP1 DUP2 ADD PUSH1 0x40 MSTORE DUP1 PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE PUSH1 0x20 ADD PUSH1 0x60 DUP2 MSTORE POP SWAP1 JUMP JUMPDEST DUP3 DUP1 SLOAD PUSH1 0x1 DUP2 PUSH1 0x1 AND ISZERO PUSH2 0x100 MUL SUB AND PUSH1 0x2 SWAP1 DIV SWAP1 PUSH1 0x0 MSTORE PUSH1 0x20 PUSH1 0x0 KECCAK256 SWAP1 PUSH1 0x1F ADD PUSH1 0x20 SWAP1 DIV DUP2 ADD SWAP3 DUP3 PUSH1 0x1F LT PUSH2 0x6A6 JUMPI DUP1 MLOAD PUSH1 0xFF NOT AND DUP4 DUP1 ADD OR DUP6 SSTORE PUSH2 0x6D3 JUMP JUMPDEST DUP3 DUP1 ADD PUSH1 0x1 ADD DUP6 SSTORE DUP3 ISZERO PUSH2 0x6D3 JUMPI SWAP2 DUP3 ADD JUMPDEST DUP3 DUP2 GT ISZERO PUSH2 0x6D3 JUMPI DUP3 MLOAD DUP3 SSTORE SWAP2 PUSH1 0x20 ADD SWAP2 SWAP1 PUSH1 0x1 ADD SWAP1 PUSH2 0x6B8 JUMP JUMPDEST POP PUSH2 0x6DF SWAP3 SWAP2 POP PUSH2 0x6E3 JUMP JUMPDEST POP SWAP1 JUMP JUMPDEST PUSH2 0x4E3 SWAP2 SWAP1 JUMPDEST DUP1 DUP3 GT ISZERO PUSH2 0x6DF JUMPI PUSH1 0x0 DUP2 SSTORE PUSH1 0x1 ADD PUSH2 0x6E9 JUMP INVALID LOG1 PUSH6 0x627A7A723058 KECCAK256 0xca DUP4 0xd0 PUSH9 0x203F70310115097A00 MOD ADDMOD 0xb2 0xea 0xe1 EXTCODECOPY CALLCODE 0xc9 SLOAD PUSH10 0x1747999CF4743572AF00 0x29 ",
"source":"pragma solidity ^0.5.1\n\ncontract X12 {\n\n struct transaction {\n string _sndr_interchange_id;\n string _sndr_interchange_qualifier;\n string _recv_interchange_id;\n string _recv_interchange_qualifier;\n string _tx_version;\n string _tx_type;\n string _edi_payload;\n }\n\n transaction[] internal txs;\n\n function ipfs_fields() public pure returns (bytes32[] memory) {\n bytes32[] memory _fields = new bytes32[](1);\n _fields[0] = \"edi_payload\";\n return _fields;\n }\n\n function send(\n string memory sndr_interchange_id,\n string memory sndr_interchange_qualifier,\n string memory recv_interchange_id,\n string memory recv_interchange_qualifier,\n string memory tx_version,\n string memory tx_type,\n string memory edi_payload\n ) public\n {\n transaction memory _tx = X12.transaction(sndr_interchange_id,sndr_interchange_qualifier,recv_interchange_id,recv_interchange_qualifier,tx_version,tx_type,edi_payload);\n txs.push(_tx);\n }\n}"
},
"accessed_at":"2019-06-09T23:54:55.610717-04:00"
}

Retrieves details for a Contract.

URL Parameters

Parameter

Description

id

id of the Contract

Execute Contract

Construct and execute a specific method in a smart contract.

Execution Resulting in Transaction Broadcast

The API returns 202 Accepted if the contract execution will broadcast a Transaction to the network and returns a ref, which is an identifier you may use to ask for the execution status of the Transaction.

# Execution Resulting in Transaction Broadcast
curl -i \
-H 'authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fSwiZXhwIjpudWxsLCJpYXQiOjE1NTk4Nzg1NzQsImp0aSI6IjYzYTJkY2QzLWI5OTgtNDZjNC1hNzFkLTQ5MjU4YTBhYmEyMyIsInN1YiI6ImFwcGxpY2F0aW9uOmNiMjAzN2Y3LTc5ZmMtNDBmNC05NzIwLWFkYTYzNmRhNDE4MyJ9.0LsVj7oTF0KjwbcUhg9a-fQRWB7cGzKJxLIANeX2cWE' \
-H 'content-type: application/json' \
https://nchain.provide.services/api/v1/contracts/3b9fe62e-5da7-43dc-838f-3cfa1421ed0f/execute \
-d '{
"method": "send",
"params": [
"123-456-789",
"some.random.topic",
"987-654-321",
"default.topic",
"2.0",
"BOL",
"{}"
],
"value": 0,
"account_id": "e6ef498b-589e-4514-9924-278b7bd6e3de"
}'
HTTP/2 202
date: Sun, 10 Jun 2019 04:15:41 GMT
content-type: application/json; charset=UTF-8
access-control-allow-credentials: true
access-control-allow-headers: Accept, Accept-Encoding, Authorization, Cache-Control, Content-Length, Content-Type, Origin, User-Agent, X-CSRF-Token, X-Requested-With
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Total-Results-Count

Response JSON:

{
"confidence": null,
"ref": "d6562b9f-fe2d-4405-a1ae-fdb316cf94ee"
}

Execution Resulting in Read Operation

The API returns 200 OK and a response JSON element if the contract execution was an attempt to read data from the network.

# Execution Resulting in Read Operation
curl -i \
-H 'authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7fSwiZXhwIjpudWxsLCJpYXQiOjE1NTk4Nzg1NzQsImp0aSI6IjYzYTJkY2QzLWI5OTgtNDZjNC1hNzFkLTQ5MjU4YTBhYmEyMyIsInN1YiI6ImFwcGxpY2F0aW9uOmNiMjAzN2Y3LTc5ZmMtNDBmNC05NzIwLWFkYTYzNmRhNDE4MyJ9.0LsVj7oTF0KjwbcUhg9a-fQRWB7cGzKJxLIANeX2cWE' \
-H 'content-type: application/json' \
https://nchain.provide.services/api/v1/contracts/3b9fe62e-5da7-43dc-838f-3cfa1421ed0f/execute \
-d '{"account_id": "63b15ede-318b-45be-a7ba-bf965bbd0c2e", "method": "ipfs_fields", "params": [], "value": 0}'
HTTP/2 200
date: Sun, 10 Jun 2019 04:15:04 GMT
content-type: application/json; charset=UTF-8
access-control-allow-credentials: true
access-control-allow-headers: Accept, Accept-Encoding, Authorization, Cache-Control, Content-Length, Content-Type, Origin, User-Agent, X-CSRF-Token, X-Requested-With
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
access-control-allow-origin: *
access-control-expose-headers: X-Total-Results-Count

Response JSON:

{
"response": [
"edi_payload"
]
}

Request Parameters

Parameter

Description

account_id

id of the Account signing identity to use for the request

method

method name to invoke in the contract

params

array of arguments to be encoded and provided to the method invocation

value

the payment to be included with the transaction, in the network's native currency

URL Parameters

Parameter

Description

id

id of the Contract