Contracts
Last updated
Last updated
GET
https://nchain.provide.services/api/v1/contracts
Returns a list of contracts
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
[
{
"id": "0ae457ce-da63-44ca-8de6-07fcd950c7bc",
"created_at": "2018-02-09T21:19:10.68508Z",
"application_id": "b9509412-66cf-4520-a127-3150c991eaf7",
"organization_id": null,
"network_id": "9f7a08cb-4d8d-469d-a53a-f39fde5ece41",
"contract_id": null,
"transaction_id": "bbfa0213-b471-4a27-a3bd-e2e6cbd40777",
"name": "ProxyStorage",
"address": "0x6aDDe452c74a665548995A47C1f9A2ED0314BB8d",
"type": null,
"accessed_at": null,
"pubsub_prefix": "2d21a6e763a3885652a652d29bbe1c3425e6f0dae4eaae549295731e56e0a8b0"
},
{
"id": "a424289f-4596-48bb-90d6-44b44131aa55",
"created_at": "2018-02-12T08:35:30.501471Z",
"application_id": "b9509412-66cf-4520-a127-3150c991eaf7",
"organization_id": null,
"network_id": "9f7a08cb-4d8d-469d-a53a-f39fde5ece41",
"contract_id": null,
"transaction_id": "45289d92-4ebb-4102-b681-4f07b238e4ef",
"name": "EternalStorage",
"address": "0x1D3244091336f0486531eEBf4A1E2A4baac524AF",
"type": null,
"accessed_at": null,
"pubsub_prefix": "38c15789ef4111d2ee5430427745f66152e26a3e859162f6d1ed30167966ea62"
}
]
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: 3
[
{
"id":"79b0ecb2-bf8a-4a4f-95a8-d6ddde82a846",
"created_at":"2020-11-24T20:11:00.217031Z",
"application_id":"3a19b193-f48c-46cf-9bc2-5a0e5a73d87a",
"network_id":"66d44f30-9092-4182-a3c4-bc02736d6ae5",
"contract_id":null,
"transaction_id":null,
"name":"Ekho",
"address":"0x",
"type":null,
"accessed_at":null,
"pubsub_prefix":"3840bd672c450e582f29e0d7b5571cd5bfc475635c8a6b00bfb325f1c9f1f454"
},
{
"id":"4440bc2b-8213-4939-b306-0ba838709dc5",
"created_at":"2020-10-15T04:05:00.522045Z",
"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",
"type":null,
"accessed_at":null,
"pubsub_prefix":"3716a19aedd1e25d0590b284fe72e09effd4b8d5e06794f57dc8879ddcfd06af"
},
{
"id":"cd2c915b-d65f-4b3f-ad3b-19e1dbff4192",
"created_at":"2019-09-24T13:11:00.916033Z",
"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",
"type":null,
"accessed_at":null,
"pubsub_prefix":"372adca82c382a7df25e2d32f09213b588c30141a5f4d6bb3e6f275dc7d52517"
}
]
List smart contracts visible to the authorized User
or Application
.
POST
https://nchain.provide.services/api/v1/contracts
Deploys a new smart contract to a specified network
{
"id": "b1d9df94-6f9e-4285-9de7-6072a69784b9",
"created_at": "2021-08-16T17:25:45.103744333Z",
"application_id": "de7efe54-642e-4171-91be-0fe0a7cc0977",
"organization_id": null,
"network_id": "07102258-5e49-480e-86af-6d0c3260827d",
"contract_id": null,
"transaction_id": null,
"name": "LGT 8.16.2021:1726",
"address": "0x",
"type": null,
"accessed_at": null,
"pubsub_prefix": "0643876cb2a7c0e27eaf17beb3fec335a271a3c7ba58103dc215f954a88f6072"
}
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",
"name":"Ekho",
"address":"0x",
"params":{
"compiled_artifact":{
"contractName": "Ekho",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "bytes",
"name": "message",
"type": "bytes"
}
],
"name": "Ekho",
"type": "event"
},
{
"inputs": [
{
"internalType": "bytes",
"name": "message",
"type": "bytes"
}
],
"name": "broadcast",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"bytecode": "0x608060405234801561001057600080fd5b506101c0806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630323a8b014610030575b600080fd5b6100e96004803603602081101561004657600080fd5b810190808035906020019064010000000081111561006357600080fd5b82018360208201111561007557600080fd5b8035906020019184600183028401116401000000008311171561009757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506100eb565b005b7fc11b5aba5095eee01588a1b4f1983f055885ce9581af8e25b9fb34220d24eb73816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15056fea26469706673582212209a157717b400c42ec8447983d186638a51c9ee770e53cbfce55399bf1d381f8164736f6c63430006090033",
"source": "contract Ekho {\n event Ekho(bytes message);\n function broadcast(bytes memory message) public {\n emit Ekho(message);\n }\n}\n"
}
}'
HTTP/2 201
date: Tue, 24 Nov 2020 20:11:08 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
{
"id":"a5a6a666-b7eb-4e4f-b3d8-88406dc1a14e",
"created_at":"2020-11-24T20:11:08.265438785Z",
"application_id":"3a19b193-f48c-46cf-9bc2-5a0e5a73d87a",
"network_id":"66d44f30-9092-4182-a3c4-bc02736d6ae5",
"contract_id":null,
"transaction_id":null,
"name":"Ekho",
"address":"0x",
"type":null,
"params":{
"compiled_artifact":{
"contractName":"Ekho",
"abi":[
{
"anonymous":false,
"inputs":[
{
"indexed":false,
"internalType":"bytes",
"name":"message",
"type":"bytes"
}
],
"name":"Ekho",
"type":"event"
},
{
"inputs":[
{
"internalType":"bytes",
"name":"message",
"type":"bytes"
}
],
"name":"broadcast",
"outputs":[
],
"stateMutability":"nonpayable",
"type":"function"
}
],
"bytecode":"0x608060405234801561001057600080fd5b506101c0806100206000396000f3fe608060405234801561001057600080fd5b506004361061002b5760003560e01c80630323a8b014610030575b600080fd5b6100e96004803603602081101561004657600080fd5b810190808035906020019064010000000081111561006357600080fd5b82018360208201111561007557600080fd5b8035906020019184600183028401116401000000008311171561009757600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f8201169050808301925050505050505091929192905050506100eb565b005b7fc11b5aba5095eee01588a1b4f1983f055885ce9581af8e25b9fb34220d24eb73816040518080602001828103825283818151815260200191508051906020019080838360005b8381101561014d578082015181840152602081019050610132565b50505050905090810190601f16801561017a5780820380516001836020036101000a031916815260200191505b509250505060405180910390a15056fea26469706673582212209a157717b400c42ec8447983d186638a51c9ee770e53cbfce55399bf1d381f8164736f6c63430006090033",
"source":"contract Ekho {\n event Ekho(bytes message);\n function broadcast(bytes memory message) public {\n emit Ekho(message);\n }\n}\n"
}
},
"accessed_at":null,
"pubsub_prefix":"3840bd672c450e582f29e0d7b5571cd5bfc475635c8a6b00bfb325f1c9f1f454"
}
Deploy a smart contract to a specific Network
.
GET
https://nchain.provide.services/api/v1/contracts/:id
Retrieves detailed information for the specified contract
{
"id": "faa15475-a5a8-42d2-b2ba-da6650e71eb2",
"created_at": "2021-08-16T17:35:47.963477Z",
"application_id": "de7efe54-642e-4171-91be-0fe0a7cc0977",
"organization_id": null,
"network_id": "07102258-5e49-480e-86af-6d0c3260827d",
"contract_id": 0x,
"transaction_id": null,
"name": "LGT 8.16.2021:1729",
"address": "",
"type": null,
"accessed_at": null,
"pubsub_prefix": "9cbcde07ff13a96c484a42a467d57560e3f3515d9eec39c9973ea7c6f9ed5452"
}
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
{
"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",
"pubsub_prefix":"3716a19aedd1e25d0590b284fe72e09effd4b8d5e06794f57dc8879ddcfd06af"
}
Retrieve Contract
details.
Construct and execute a specific method in a smart contract.
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
.
POST
https://nchain.provide.services/api/v1/contracts/:id/execute
Construct and execute a specific method in a smart contract
{
"confidence": null,
"ref": "e1680c3b-9fad-48df-9265-e3b07a390260"
}
# 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
{
"confidence": null,
"ref": "d6562b9f-fe2d-4405-a1ae-fdb316cf94ee"
}
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": [
"edi_payload"
]
}
Parameter | Default | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Parameter | Description |
---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Parameter | Description |
---|---|
Parameter | Description |
---|---|
filter_tokens
boolean
when true, token contracts will not be included in the response
sort
string
parameter to indicate how the response should be sorted; currently,
recent
is the only supported option and returns by
accessed_at
descending be included in the response
authorization
string
bearer scoped to an
Application
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
authorization
string
bearer scoped to an
Application
address
string
application_id
string
id of application related to contract
name
string
name of contract to be deployed
network_id
string
id of target host network
id
string
id of target contract
authorization
string
bearer scoped to
Application
id
id of the Contract
id
string
id of target contract
authorization
string
bearer scoped to
Application
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
id
id of the Contract