Deploy

Only available on the Scale plan

Introduction

The Smart Contract Deployment endpoint allows you to deploy the bytecode of a smart contract to the blockchain. Once the smart contract is deployed on the blockchain, its functionality can be used through performing smart contract read or smart contract write requests.

This guide follows the process of deploying a smart contract.

Prerequisites

  • Obtain an authorization token
    You must obtain an authorisation token to interact with Overledger's API and call any endpoint. This token will authenticate your requests and grant you access to the necessary endpoints. Please follow the authentication process provided by Overledger to get your authorisation token.
  • The compiled Smart Contract code that you wish to deploy

The smart contract deployment is done through the prepare-sign-execute flow.

Prepare

Preparing a deployment of a smart contract is done through the endpoint "POST /api/preparations/deployments/smart-contracts". The information sent in the body of this request is as such:

curl --request POST \
     --url https://api.sandbox.overledger.io/api/preparations/deployments/smart-contracts \
     --header 'API-Version: 3.0.0' \
     --header 'Authorization: Bearer token' \
     --header 'accept: application/json' \
     --header 'content-type: application/json'
     --data '
{
    "location": {
        "technology": "ethereum",
        "network": "private besu tessera testnet"
    },
    "signingAccountId": "0x1d74e42ad8e6147f144fa688a60ba1dce214bed4",
    "constructorParameters": [
        {
            "type": "string",
            "value": "qq"
        },
        {
            "type": "string",
            "value": "qq"
        },
        {
            "value": 18,
            "type": "uint8"
        },
        {
            "value": 1000000000000000,
            "type": "uint256"
        },
        {
            "value": "0x23Fe348AeE5C1851090D353EcC4b5DeC2cC4415D",
            "type": "address"
        }
    ],
    "bytecode": {{bytecode}}

Where bytecode refers to the compiled smart contract code meant to be deployed and you can provide the smart contract parameters in the constructorParamters if you don't have them already in your bytecode.

As a response, you will get the following:

{
    "requestId": "852178a3-61f7-415b-b534-cb1d37f434d9",
    "location": {
        "technology": "ethereum",
        "network": "private besu tessera testnet"
    },
    "nativeData": {
        "nonce": 2,
        "chainId": 4215,
        "chain": "testnet",
        "hardfork": "london",
        "to": "",
        "gasPrice": "0",
        "gas": "1115117",
        "value": "0",
        "data": "60806040523480156200001157600080fd5b50604051620016133803806200161383398181016040528101906200003791906200024c565b84600390805190602001906200004f929190620000d9565b50836004908051906020019062000068929190620000d9565b5082600560006101000a81548160ff021916908360ff16021790555081600281905550816000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050505050506200052f565b828054620000e790620003f2565b90600052602060002090601f0160209004810192826200010b576000855562000157565b82601f106200012657805160ff191683800117855562000157565b8280016001018555821562000157579182015b828111156200015657825182559160200191906001019062000139565b5b5090506200016691906200016a565b5090565b5b80821115620001855760008160009055506001016200016b565b5090565b6000620001a06200019a846200033b565b62000312565b905082815260208101848484011115620001bf57620001be620004c1565b5b620001cc848285620003bc565b509392505050565b600081519050620001e581620004e1565b92915050565b600082601f830112620002035762000202620004bc565b5b81516200021584826020860162000189565b91505092915050565b6000815190506200022f81620004fb565b92915050565b600081519050620002468162000515565b92915050565b600080600080600060a086880312156200026b576200026a620004cb565b5b600086015167ffffffffffffffff8111156200028c576200028b620004c6565b5b6200029a88828901620001eb565b955050602086015167ffffffffffffffff811115620002be57620002bd620004c6565b5b620002cc88828901620001eb565b9450506040620002df8882890162000235565b9350506060620002f2888289016200021e565b92505060806200030588828901620001d4565b9150509295509295909350565b60006200031e62000331565b90506200032c828262000428565b919050565b6000604051905090565b600067ffffffffffffffff8211156200035957620003586200048d565b5b6200036482620004d0565b9050602081019050919050565b60006200037e8262000385565b9050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015620003dc578082015181840152602081019050620003bf565b83811115620003ec576000848401525b50505050565b600060028204905060018216806200040b57607f821691505b602082108114156200042257620004216200045e565b5b50919050565b6200043382620004d0565b810181811067ffffffffffffffff821117156200045557620004546200048d565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b620004ec8162000371565b8114620004f857600080fd5b50565b6200050681620003a5565b81146200051257600080fd5b50565b6200052081620003af565b81146200052c57600080fd5b50565b6110d4806200053f6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce5671461013457806370a082311461015257806395d89b4114610182578063a9059cbb146101a0578063dd62ed3e146101d057610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100e657806323b872dd14610104575b600080fd5b6100a0610200565b6040516100ad9190610bde565b60405180910390f35b6100d060048036038101906100cb9190610a4b565b610292565b6040516100dd9190610bc3565b60405180910390f35b6100ee6102a9565b6040516100fb9190610cc0565b60405180910390f35b61011e600480360381019061011991906109f8565b6102b3565b60405161012b9190610bc3565b60405180910390f35b61013c61039c565b6040516101499190610cdb565b60405180910390f35b61016c6004803603810190610167919061098b565b6103b3565b6040516101799190610cc0565b60405180910390f35b61018a6103fb565b6040516101979190610bde565b60405180910390f35b6101ba60048036038101906101b59190610a4b565b61048d565b6040516101c79190610bc3565b60405180910390f35b6101ea60048036038101906101e591906109b8565b6104a4565b6040516101f79190610cc0565b60405180910390f35b60606003805461020f90610df0565b80601f016020809104026020016040519081016040528092919081815260200182805461023b90610df0565b80156102885780601f1061025d57610100808354040283529160200191610288565b820191906000526020600020905b81548152906001019060200180831161026b57829003601f168201915b5050505050905090565b600061029f33848461052b565b6001905092915050565b6000600254905090565b600080600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610378576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161036f90610c60565b60405180910390fd5b6103838585856106f6565b610390853385840361052b565b60019150509392505050565b6000600560009054906101000a900460ff16905090565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461040a90610df0565b80601f016020809104026020016040519081016040528092919081815260200182805461043690610df0565b80156104835780601f1061045857610100808354040283529160200191610483565b820191906000526020600020905b81548152906001019060200180831161046657829003601f168201915b5050505050905090565b600061049a3384846106f6565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561059b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161059290610ca0565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561060b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161060290610c20565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925836040516106e99190610cc0565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415610766576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161075d90610c80565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156107d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107cd90610c00565b60405180910390fd5b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205490508181101561085c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085390610c40565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546108ef9190610d12565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516109539190610cc0565b60405180910390a350505050565b60008135905061097081611070565b92915050565b60008135905061098581611087565b92915050565b6000602082840312156109a1576109a0610e80565b5b60006109af84828501610961565b91505092915050565b600080604083850312156109cf576109ce610e80565b5b60006109dd85828601610961565b92505060206109ee85828601610961565b9150509250929050565b600080600060608486031215610a1157610a10610e80565b5b6000610a1f86828701610961565b9350506020610a3086828701610961565b9250506040610a4186828701610976565b9150509250925092565b60008060408385031215610a6257610a61610e80565b5b6000610a7085828601610961565b9250506020610a8185828601610976565b9150509250929050565b610a9481610d7a565b82525050565b6000610aa582610cf6565b610aaf8185610d01565b9350610abf818560208601610dbd565b610ac881610e85565b840191505092915050565b6000610ae0602383610d01565b9150610aeb82610e96565b604082019050919050565b6000610b03602283610d01565b9150610b0e82610ee5565b604082019050919050565b6000610b26602683610d01565b9150610b3182610f34565b604082019050919050565b6000610b49602883610d01565b9150610b5482610f83565b604082019050919050565b6000610b6c602583610d01565b9150610b7782610fd2565b604082019050919050565b6000610b8f602483610d01565b9150610b9a82611021565b604082019050919050565b610bae81610da6565b82525050565b610bbd81610db0565b82525050565b6000602082019050610bd86000830184610a8b565b92915050565b60006020820190508181036000830152610bf88184610a9a565b905092915050565b60006020820190508181036000830152610c1981610ad3565b9050919050565b60006020820190508181036000830152610c3981610af6565b9050919050565b60006020820190508181036000830152610c5981610b19565b9050919050565b60006020820190508181036000830152610c7981610b3c565b9050919050565b60006020820190508181036000830152610c9981610b5f565b9050919050565b60006020820190508181036000830152610cb981610b82565b9050919050565b6000602082019050610cd56000830184610ba5565b92915050565b6000602082019050610cf06000830184610bb4565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610d1d82610da6565b9150610d2883610da6565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610d5d57610d5c610e22565b5b828201905092915050565b6000610d7382610d86565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015610ddb578082015181840152602081019050610dc0565b83811115610dea576000848401525b50505050565b60006002820490506001821680610e0857607f821691505b60208210811415610e1c57610e1b610e51565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600080fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b61107981610d68565b811461108457600080fd5b50565b61109081610da6565b811461109b57600080fd5b5056fea26469706673582212206e5be92f5df8b220489e5417eddbee1110adb683a430474a4e81002ce656dbd064736f6c6343000807003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000023fe348aee5c1851090d353ecc4b5dec2cc4415d0000000000000000000000000000000000000000000000000000000000000002717100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000027171000000000000000000000000000000000000000000000000000000000000"
    },
    "dltFee": {
        "amount": "0",
        "unit": "ETH"
    }
}
  • requestId: This is the ID of the request you have prepared within Overledger. You must retain this, to refer to it when you are executing this request.
  • dltFee: This is the fee that must be paid for the transaction to be published in this DLT
  • nativeData: This is what must be signed.

Sign

The request can only be executed once the owner of the smart contract signs it. Please refer to Transaction Signing guide for detailed instructions on obtaining the digital signature. The "nativeData" field received in the previous step should be signed with the private key of the smart contract owner's address.

Execute

The execution step provides Overledger with the signing key's signature, which approves for this smart contract deploy transaction to be executed. Once this step is complete and everything is in order, the blockchain transaction will be broadcast to the network. The network then processes the smart contract into a new block. Depending on the network, this is not immediate.

The execute request is as follows:

curl --request POST \
     --url https://api.sandbox.overledger.io/api/executions/deployments \
     --header 'API-Version: 3.0.0' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "signedTransaction": "string",
  "requestId": "91b5bfc1-03ad-46fb-b8e5-e4c663eece43"
}
'
  • "RequestId" is the ID of the request you have prepared.
  • "SignedTransaction" is the digital signature done by the smart contract owner's private key.
{
  "location": {
    "technology": "Ethereum",
    "network": "private besu tessera testnet"
  },
  "requestId": "91b5bfc1-03ad-46fb-b8e5-e4c663eece43",
  "transactionId": "0x6da85f8bf2cb531af5069a6eed76bf71b949a17eda2b0a47bd4c0938f0686758",
  "status": {
    "description": "The transaction has been successfully broadcasted to the network. The status will next be updated after a sufficient block number has been reached. At this point we can be confident that the transaction will be successful or will have failed.",
    "value": "PENDING"
  },
  "timestamp": 1711039178
}

You can search for your transaction on etherscan by the transactionId.


What’s Next

Submit a search for the transaction to verify if your transaction has been successfully submitted.