You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be very helpful to developers to have a command to quickly and easily deploy a custom contract to the blockchain used by a local FireFly stack. This command would take a pre-compiled contract in the form of a combined JSON file - typically compiled from solc. Here's an example command someone might use to compile their contract (though the exact command will vary depending on the case):
I imagine the FireFLy CLI command to deploy the contract would look something like this:
ff deploy <stack_name> <compiled_contract.json>
We should also have an optional flag to tell the CLI which member should deploy the contract.
Here's an example command of how someone might compile their contract
Probably the easiest way to actually get the contract on-chain today is to use Ethconnect's ability to deploy smart contracts. Here is an example of a POST to the Ethconnect for org_0:
The compiled field needs to be Base64 encoded. The default output of solc is hex encoded bytecode. This means that we need to first decode the bytecode string (from the compiled JSON file) into raw bytes, then re-encode it as Base64 before sending it to Ethconnect.
The abi field needs to be the entire array from the compiled JSON file
The from field needs to be the Ethereum address of a signer with an unlocked account. This should be easy to look up in the stack's JSON file as they are all written there.
A couple of thoughts on implementation:
The actual code for the implementation should be in the blockchain provider, with a new function on the blockchain provider interface
The address of the contract should be displayed on the command line after a successful deployment
If an error occurs, the error should be passed back from Ethconnect and displayed on the command line
The Fabric blockchain provider can just have these functions stubbed out, and print a message saying it's not supported yet. It would be great to support chaincode deployment later, but we need a separate Issue for that.
The text was updated successfully, but these errors were encountered:
It would be very helpful to developers to have a command to quickly and easily deploy a custom contract to the blockchain used by a local FireFly stack. This command would take a pre-compiled contract in the form of a combined JSON file - typically compiled from
solc
. Here's an example command someone might use to compile their contract (though the exact command will vary depending on the case):solc --combined-json abi,bin simple_storage.sol > simple_storage.json
I imagine the FireFLy CLI command to deploy the contract would look something like this:
ff deploy <stack_name> <compiled_contract.json>
We should also have an optional flag to tell the CLI which member should deploy the contract.
Here's an example command of how someone might compile their contract
Probably the easiest way to actually get the contract on-chain today is to use Ethconnect's ability to deploy smart contracts. Here is an example of a
POST
to the Ethconnect fororg_0
:POST http://localhost:5102
There are several things to note here:
compiled
field needs to be Base64 encoded. The default output ofsolc
is hex encoded bytecode. This means that we need to first decode the bytecode string (from the compiled JSON file) into raw bytes, then re-encode it as Base64 before sending it to Ethconnect.abi
field needs to be the entire array from the compiled JSON filefrom
field needs to be the Ethereum address of a signer with an unlocked account. This should be easy to look up in the stack's JSON file as they are all written there.A couple of thoughts on implementation:
GET
request to Ethconnect's/replies
endpoint (http://localhost:5102/replies)The text was updated successfully, but these errors were encountered: