I was building my own contract here: https://www.blockcypher.com/dev/ethereum/#create-contract-endpoint
ENGINE.PHP
<?php
function blockcypher($method,$page,$data = ""){
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.blockcypher.com/v1/".$page);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
if($data != ''){
curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
}
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
$headers = array();
$headers[] = 'Content-Type: application/x-www-form-urlencoded';
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($curl);
if (curl_errno($curl)) {
echo 'Error:' . curl_error($curl);
}
curl_close ($curl);
return $result;
}
?>
PROCESS.PHP
<?php
session_start();
error_reporting(1);
include 'ENGINE.PHP';
$token = '?token=YOURFREETOKEN';
$server = "eth/main";
$data = "{\"solidity\":\"contract mortal { address owner; function mortal() { owner = msg.sender; } function kill() { if (msg.sender == owner) suicide(owner); } } contract greeter is mortal { string greeting; function greeter(string _greeting) public { greeting = _greeting; } function greet() constant returns (string) { return greeting; } }\",\"params\":[\"Hello BlockCypher Test\"]}";
$contract_details = blockcypher("POST","$server/contracts$token",$data);
echo "<br><br>USDT Generate Contract: ";
var_dump($contract_details);
Output from PROCESS.PHP
USDT Generate Contract: string(101) "{"error": "Error compiling Solidity source code: fork/exec /usr/bin/solc: no such file or directory"}"
I'm getting this error and could not know what is the problem because have such less knowledge in this kind of thing.
code example: https://paiza.io/projects/XNbO9tM4UwxL-NPaxY1Wcw?language=php
Error compiling Solidity source code: fork/exec /usr/bin/solc: no such file or directory
This is an error on the side of Blockcypher. You might want to report it to them.
solc
is a "solidity compiler" and what it does - it takes the text source code and config (such as which version of Solidity you are using, whether you want to to run an optimizer, ...) as an input, and returns the bytecode, ABI and metadata as an output.
So when you call the Blockchypher endpoint, their system tries to open the binary /usr/bin/solc
. But the file is misplaced on their system, and the endpoint returns this error.