{"id":15823752,"url":"https://github.com/stefh/smartcontractfunction","last_synced_at":"2026-04-30T00:03:54.888Z","repository":{"id":149586590,"uuid":"187773607","full_name":"StefH/SmartContractFunction","owner":"StefH","description":"An Azure Function to call Ethereum Smart Contracts","archived":false,"fork":false,"pushed_at":"2019-08-21T19:44:26.000Z","size":100,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-14T21:07:47.219Z","etag":null,"topics":["azure-functions","functions","smartcontracts","solidity"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StefH.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2019-05-21T06:18:15.000Z","updated_at":"2020-11-24T13:03:11.000Z","dependencies_parsed_at":"2023-09-24T07:17:32.380Z","dependency_job_id":null,"html_url":"https://github.com/StefH/SmartContractFunction","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"25b8abb3613cd9ade998d3b05b9edbd7389d5bd6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSmartContractFunction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSmartContractFunction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSmartContractFunction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StefH%2FSmartContractFunction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StefH","download_url":"https://codeload.github.com/StefH/SmartContractFunction/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246604613,"owners_count":20804101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-functions","functions","smartcontracts","solidity"],"created_at":"2024-10-05T08:22:38.141Z","updated_at":"2026-04-30T00:03:54.855Z","avatar_url":"https://github.com/StefH.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SmartContractFunction\nAn Azure Function to call Ethereum Smart Contracts\n\n## Info\n| | |\n| --- | --- |\n| ***Quality*** | \u0026nbsp; |\n| \u0026nbsp;\u0026nbsp;**Build Azure** | [![Build Status Azure](https://stef.visualstudio.com/SmartContractFunction/_apis/build/status/SmartContractFunction)](https://stef.visualstudio.com/SmartContractFunction/_build/latest?definitionId=23) |\n\nThis solution uses Azure Table Storage to store the details from the Deployed Smart Contracts.\n\n## Functionality\n\n### DeploySmartContract\n\nUse this to *deploy* a new Smart Contract to the Ethereum Blockchain.\n\n#### Example\nDo a **POST** request with this body to endpoint \u003chttp://localhost:7071/api/DeploySmartContract\u003e\n\n``` js\n{\n    \"Endpoint\": \"https://ropsten.infura.io/v3/***\",\n    \"ContractABI\": \"[{\\\"constant\\\":true,\\\"inputs\\\":[],\\\"name\\\":\\\"getVersion\\\",\\\"outputs\\\":[{\\\"name\\\":\\\"version\\\",\\\"type\\\":\\\"int256\\\"},{\\\"name\\\":\\\"description\\\",\\\"type\\\":\\\"string\\\"}],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"view\\\",\\\"type\\\":\\\"function\\\"},{\\\"constant\\\":false,\\\"inputs\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"name\\\":\\\"setNumber\\\",\\\"outputs\\\":[],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"nonpayable\\\",\\\"type\\\":\\\"function\\\"},{\\\"constant\\\":false,\\\"inputs\\\":[{\\\"name\\\":\\\"value\\\",\\\"type\\\":\\\"string\\\"}],\\\"name\\\":\\\"setString\\\",\\\"outputs\\\":[],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"nonpayable\\\",\\\"type\\\":\\\"function\\\"},{\\\"constant\\\":true,\\\"inputs\\\":[],\\\"name\\\":\\\"getString\\\",\\\"outputs\\\":[{\\\"name\\\":\\\"\\\",\\\"type\\\":\\\"string\\\"}],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"view\\\",\\\"type\\\":\\\"function\\\"},{\\\"constant\\\":true,\\\"inputs\\\":[{\\\"name\\\":\\\"number1\\\",\\\"type\\\":\\\"uint256\\\"},{\\\"name\\\":\\\"number2\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"name\\\":\\\"addNumbers\\\",\\\"outputs\\\":[{\\\"name\\\":\\\"\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"pure\\\",\\\"type\\\":\\\"function\\\"},{\\\"constant\\\":true,\\\"inputs\\\":[],\\\"name\\\":\\\"getNumber\\\",\\\"outputs\\\":[{\\\"name\\\":\\\"\\\",\\\"type\\\":\\\"uint256\\\"}],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"view\\\",\\\"type\\\":\\\"function\\\"},{\\\"inputs\\\":[{\\\"name\\\":\\\"version\\\",\\\"type\\\":\\\"int256\\\"},{\\\"name\\\":\\\"description\\\",\\\"type\\\":\\\"string\\\"}],\\\"payable\\\":false,\\\"stateMutability\\\":\\\"nonpayable\\\",\\\"type\\\":\\\"constructor\\\"}]\",\n    \"ContractByteCode\": \"0x608060405234801561001057600080fd5b506040516106123803806106128339810180604052604081101561003357600080fd5b81516020830180519193928301929164010000000081111561005457600080fd5b8201602081018481111561006757600080fd5b815164010000000081118282018710171561008157600080fd5b5050600085905580519093506100a092506001915060208401906100a8565b505050610143565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100e957805160ff1916838001178555610116565b82800160010185558215610116579182015b828111156101165782518255916020019190600101906100fb565b50610122929150610126565b5090565b61014091905b80821115610122576000815560010161012c565b90565b6104c0806101526000396000f3fe608060405234801561001057600080fd5b506004361061007e577c010000000000000000000000000000000000000000000000000000000060003504630d8e6e2c81146100835780633fb5c1cb1461010a5780637fcaf6661461012957806389ea642f146101cf578063ef9fc50b1461024c578063f2c9ecd814610281575b600080fd5b61008b610289565b6040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156100ce5781810151838201526020016100b6565b50505050905090810190601f1680156100fb5780820380516001836020036101000a031916815260200191505b50935050505060405180910390f35b6101276004803603602081101561012057600080fd5b5035610328565b005b6101276004803603602081101561013f57600080fd5b81019060208101813564010000000081111561015a57600080fd5b82018360208201111561016c57600080fd5b8035906020019184600183028401116401000000008311171561018e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610344945050505050565b6101d761035b565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102115781810151838201526020016101f9565b50505050905090810190601f16801561023e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61026f6004803603604081101561026257600080fd5b50803590602001356103f2565b60408051918252519081900360200190f35b61026f6103f6565b6000805460018054604080516020600284861615610100026000190190941693909304601f81018490048402820184019092528181526060949392909183918301828280156103195780601f106102ee57610100808354040283529160200191610319565b820191906000526020600020905b8154815290600101906020018083116102fc57829003601f168201915b50505050509050915091509091565b600a81101561033b576001600255610341565b60028190555b50565b80516103579060039060208401906103fc565b5050565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103e75780601f106103bc576101008083540402835291602001916103e7565b820191906000526020600020905b8154815290600101906020018083116103ca57829003601f168201915b505050505090505b90565b0190565b60025490565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061043d57805160ff191683800117855561046a565b8280016001018555821561046a579182015b8281111561046a57825182559160200191906001019061044f565b5061047692915061047a565b5090565b6103ef91905b80821115610476576000815560010161048056fea165627a7a72305820af39c0145ea4683cb6674df3f7bcb6dd04a63678d3e8c08c81c8e7d41e86180f0029\",\n    \"CallerPrivateKey\": \"***\",\n    \"ContractParameters\": [123, \"abc\"],\n    \"FromAddress\": \"0x***\"\n}\n```\nAfter this call, the Smart Contract details (Address, ABI, ByteCode, ...) are stored in Azure Table Storage, in the table `SmartContracts` (specified in *local.settings.json* or in the *Environment Settings*)\n\n### QuerySmartContractFunction (including the ABI)\n\nUse this to call a *normal* function.\n\n#### Example\nDo a **POST** request with this body to endpoint \u003chttp://localhost:7071/api/QuerySmartContractFunction\u003e\n\nTo call a function without parameters:\n``` js\n{\n    \"Endpoint\": \"https://ropsten.infura.io/v3/***\",\n    \"ContractAddress\": \"0x***\",\n    \"CallerPrivateKey\": \"***\",\n    \"FunctionName\": \"getString\",\n    \"FromAddress\": \"0x***\"\n}\n```\n\nTo call a function with parameters:\n``` js\n{\n    \"Endpoint\": \"https://ropsten.infura.io/v3/***\",\n    \"ContractAddress\": \"0x***\",\n    \"CallerPrivateKey\": \"***\",\n    \"FromAddress\": \"0x**\",\n    \"FunctionName\": \"addNumbers\",\n    \"FunctionParameters\": [1, 4]\n}\n```\nNote that the `ContractABI` can be specified, but this is not required because this can be retrieved from Azure Table Storage. \n\n### ExecuteSmartContractFunction\n\nUse this to execute a *transactional* function.\n\n#### Example\nDo a **POST** request with this body to endpoint \u003chttp://localhost:7071/api/ExecuteSmartContractFunction\u003e\n\nTo call a function with parameters:\n``` js\n{\n    \"Endpoint\": \"https://ropsten.infura.io/v3/***\",\n    \"ContractAddress\": \"0x***\",\n    \"CallerPrivateKey\": \"***\",\n    \"FunctionName\": \"setString\",\n    \"FromAddress\": \"0x**\",\n    \"FunctionParameters\": [\"stef-1234\"]\n}\n```\nNote that the `ContractABI` can be specified, but this is not required because this can be retrieved from Azure Table Storage.\n\n\n## Azure Table Storage\nJust create a table named `SmartContracts` in your account. When deploying a new Smart Contract, this will be stored and looks like this:\n![AzureTableStorage SmartContract Details](./resources/AzureTableStorage_SmartContract_Details.png \"AzureTableStorage SmartContract Details\")\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fsmartcontractfunction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstefh%2Fsmartcontractfunction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstefh%2Fsmartcontractfunction/lists"}