{"id":15927451,"url":"https://github.com/austintgriffith/solcapi","last_synced_at":"2025-09-22T19:10:15.664Z","repository":{"id":78714234,"uuid":"134113019","full_name":"austintgriffith/solcapi","owner":"austintgriffith","description":"API for Solidity Compiler","archived":false,"fork":false,"pushed_at":"2018-05-21T19:29:01.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T02:32:26.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/austintgriffith.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-20T02:18:50.000Z","updated_at":"2022-03-26T11:30:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"679cd5c8-e2f8-4e37-8910-777a8c777446","html_url":"https://github.com/austintgriffith/solcapi","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":0.3529411764705882,"last_synced_commit":"f61165b007be79e451e50c4a0c897efb34cd5d4f"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fsolcapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fsolcapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fsolcapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austintgriffith%2Fsolcapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austintgriffith","download_url":"https://codeload.github.com/austintgriffith/solcapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247011894,"owners_count":20868993,"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":[],"created_at":"2024-10-06T23:01:47.288Z","updated_at":"2025-09-22T19:10:10.616Z","avatar_url":"https://github.com/austintgriffith.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [solcapi](https://github.com/austintgriffith/solcapi)\n\nSolidity Compiler API #BUIDLt for Solidity Golf\n\n\nPOST solidity code to https://api.solc.io\n```\n{\n  \"Test.sol\": \"YOUR SOLIDITY CODE HERE\"\n}\n```\n\nOptional headers:\n```\n\"verbose\": 1\n(returns more information from the compiler)\n\n\"optimize\": 0\n(passed as the optimize integer)\n```\n------\n\n\n## usage\n\n### python\n\n```\nimport http.client\n\nconn = http.client.HTTPConnection(\"api,solc,io\")\n\npayload = \"{\\n\\t\\\"Test.sol\\\": \\\"pragma solidity ^0.4.15;contract Test {function Test() public {}}\\\"\\n}\"\n\nheaders = {\n    'Content-Type': \"application/json\",\n    'Cache-Control': \"no-cache\"\n}\n\nconn.request(\"POST\", \"undefined\", payload, headers)\n\nres = conn.getresponse()\ndata = res.read()\n\nprint(data.decode(\"utf-8\"))\n```\nor\n```\nimport requests\n\nurl = \"https://api.solc.io\"\n\npayload = \"{\\n\\t\\\"Test.sol\\\": \\\"pragma solidity ^0.4.15;contract Test {function Test() public {}}\\\"\\n}\"\nheaders = {\n    'Content-Type': \"application/json\",\n    'Cache-Control': \"no-cache\"\n    }\n\nresponse = requests.request(\"POST\", url, data=payload, headers=headers)\n\nprint(response.text)\n```\n\n### javascript\n\n```\nvar request = require(\"request\");\n\nvar options = { method: 'POST',\n  url: 'https://api.solc.io',\n  headers:\n   { 'Cache-Control': 'no-cache',\n     'Content-Type': 'application/json'\n\n   },\n  body: { 'Test.sol': 'pragma solidity ^0.4.15;contract Test {function Test() public {}}' },\n  json: true };\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n  console.log(body);\n});\n```\nor\n```\nvar settings = {\n  \"async\": true,\n  \"crossDomain\": true,\n  \"url\": \"https://api.solc.io\",\n  \"method\": \"POST\",\n  \"headers\": {\n    \"Content-Type\": \"application/json\",\n    \"Cache-Control\": \"no-cache\"\n  },\n  \"processData\": false,\n  \"data\": \"{\\n\\t\\\"Test.sol\\\": \\\"pragma solidity ^0.4.15;contract Test {function Test() public {}}\\\"\\n}\"\n}\n\n$.ajax(settings).done(function (response) {\n  console.log(response);\n});\n```\n\n### php\n```\n\u003c?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL =\u003e \"https://api.solc.io\",\n  CURLOPT_RETURNTRANSFER =\u003e true,\n  CURLOPT_ENCODING =\u003e \"\",\n  CURLOPT_MAXREDIRS =\u003e 10,\n  CURLOPT_TIMEOUT =\u003e 30,\n  CURLOPT_HTTP_VERSION =\u003e CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST =\u003e \"POST\",\n  CURLOPT_POSTFIELDS =\u003e \"{\\n\\t\\\"Test.sol\\\": \\\"pragma solidity ^0.4.15;contract Test {function Test() public {}}\\\"\\n}\",\n  CURLOPT_HTTPHEADER =\u003e array(\n    \"Cache-Control: no-cache\",\n    \"Content-Type: application/json\"\n  ),\n));\n\n$response = curl_exec($curl);\n$err = curl_error($curl);\n\ncurl_close($curl);\n\nif ($err) {\n  echo \"cURL Error #:\" . $err;\n} else {\n  echo $response;\n}\n```\n\n\n### curl\n```\ncurl -X POST \\\n  https://api.solc.io \\\n  -H 'Cache-Control: no-cache' \\\n  -H 'Content-Type: application/json' \\\n  -d '{\n\t\"Test.sol\": \"pragma solidity ^0.4.15;contract Test {function Test() public {}}\"\n}'\n```\n\n### raw\n```\nPOST  HTTP/1.1\nHost: api.solc.io\nContent-Type: application/json\nCache-Control: no-cache\n{\n\t\"Test.sol\": \"pragma solidity ^0.4.15;contract Test {function Test() public {}}\"\n}\n```\n\n______\n\n\n## running locally\n\n### docker\n```\ncd docker\n./build.sh\n./run.sh\n```\n(brings up a container listening for POST requests on port 8000)\n\n### raw node (no docker)\n```\ncd src\nnpm i\nnpm start\n```\n(listens for POST requests on port 8080)\n\n\n\n(this repo is similar to https://github.com/smartcontractkit/solc-api from Steve Ellis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustintgriffith%2Fsolcapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustintgriffith%2Fsolcapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustintgriffith%2Fsolcapi/lists"}