zend_oo icon indicating copy to clipboard operation
zend_oo copied to clipboard

create_sidechain and sc_create RPC commands are redundant

Open cronicc opened this issue 3 years ago • 0 comments

Both commands accomplish the same thing using different APIs.

Investigate where both commands are used and if choosing one and removing the other is possible. If API features in one command are missing from the other, investigate if a unified command that incorporates all necessary API features makes more sense.

A decision on the API should be made before the first official release of zend_oo, after the first release changing the API would be problematic.

create_sidechain {"withdrawalEpochLength":... , "fromaddress":..., "toaddress":... ,"amount":... ,"minconf":..., "fee":..., "wCertVk":..., "customData":..., "constant":...}

Create a Side chain.

Arguments:
{
 "withdrawalEpochLength": epoch  (numeric, optional, default=100) length of the withdrawal epochs. The minimum valid value in test is: 5
 "fromaddress":taddr             (string, optional) The taddr to send the funds from. If omitted funds are taken from all available UTXO
 "changeaddress":taddr           (string, optional) The taddr to send the change to, if any. If not set, "fromaddress" is used. If the latter is not set too, a new generated address will be used
 "toaddress":scaddr              (string, required) The receiver PublicKey25519Proposition in the SC
 "amount":amount                 (numeric, required) Value expressed in ZEN
 "minconf":conf                  (numeric, optional, default=1) Only use funds confirmed at least this many times.
 "fee":fee                       (numeric, optional, default=0.00001) The fee amount to attach to this transaction.
 "wCertVk":data                  (string, required) It is an arbitrary byte string of even length expressed in
                                       hexadecimal format. Required to verify a WCert SC proof. Its size must be 4096 bytes max
 "customData":data               (string, optional) It is an arbitrary byte string of even length expressed in
                                       hexadecimal format. A max limit of 1024 bytes will be checked
 "constant":data                 (string, optional) It is an arbitrary byte string of even length expressed in
                                       hexadecimal format. Used as public input for WCert proof verification. Its size must be 32 bytes
 "wCeasedVk":data                (string, optional) It is an arbitrary byte string of even length expressed in
                                       hexadecimal format. Used to verify a Ceased sidechain withdrawal proofs for given SC. Its size must be 32 bytes
 "vFieldElementCertificateFieldConfig"         (array, optional) An array whose entries are sizes (in bits). Any certificate should have as many custom FieldElements with the corresponding size.
 "vBitVectorCertificateFieldConfig"            (array, optional) An array whose entries are bitVectorSizeBits and maxCompressedSizeBytes pairs. Any certificate should have as many custom BitVectorCertificateField with the corresponding sizes
 "forwardTransferScFee"                        (numeric, optional, default=0) The amount of fee in ZEN due to sidechain actors when creating a FT
 "mainchainBackwardTransferScFee"              (numeric, optional, default=0) The amount of fee in ZEN due to sidechain actors when creating a MBTR
 "mainchainBackwardTransferRequestDataLength"  (numeric, optional, default=0) The expected size (max=16) of the request data vector (made of field elements) in a MBTR
}

Result:
{
  "txid": transaction id    (string) The resulting transaction id.
  "scid": sidechainid       (string) The id of the sidechain created by this tx.
}

Examples:
> zen-cli create_sidechain '{"toaddress": "8aaddc9671dc5c8d33a3494df262883411935f4f54002fe283745fb394be508a" ,"amount": 5.0, "wCertVk": abcd..ef}'
sc_create withdrawalEpochLength [{"address":... ,"amount":...,"wCertVk":...,"customData":...,"constant":...,...},...]

Create a Side chain.

Arguments:
 1. withdrawalEpochLength:    (numeric, required) Length of the withdrawal epochs. The minimum valid value for test is: 5
 2. "address"                 (string, required) The receiver PublicKey25519Proposition in the SC
 3. amount:                   (numeric, required) The numeric amount in ZEN is the value
 4. "wCertVk"                 (string, required) It is an arbitrary byte string of even length expressed in
                                     hexadecimal format. Required to verify a WCert SC proof. Its size must be 4096 bytes
 5. "customData"              (string, optional) It is an arbitrary byte string of even length expressed in
                                     hexadecimal format. A max limit of 1024 bytes will be checked. If not specified, an empty string "" must be passed.
 6. "constant"                (string, optional) It is an arbitrary byte string of even length expressed in
                                     hexadecimal format. Used as public input for WCert proof verification. Its size must be 32 bytes
 7. "wCeasedVk"               (string, optional) It is an arbitrary byte string of even length expressed in
                                 hexadecimal format. Used to verify a Ceased sidechain withdrawal proofs for given SC. Its size must be 4096 bytes
 8. "vFieldElementCertificateFieldConfig" (array, optional) An array whose entries are sizes (in bits). Any certificate should have as many custom FieldElementCertificateField with the corresponding size.
 9. "vBitVectorCertificateFieldConfig" (array, optional) An array whose entries are bitVectorSizeBits and maxCompressedSizeBytes pairs. Any certificate should have as many custom BitVectorCertificateField with the corresponding sizes
10. "forwardTransferScFee" (numeric, optional, default=0) The amount of fee in ZEN due to sidechain actors when creating a FT
11. "mainchainBackwardTransferScFee" (numeric, optional, default=0) The amount of fee in ZEN due to sidechain actors when creating a MBTR
12. "mainchainBackwardTransferRequestDataLength" (numeric, optional, default=0) The expected size (max=16) of the request data vector (made of field elements) in a MBTR

Result:
"transactionid"    (string) The transaction id. Only 1 transaction is created regardless of
                                    the number of addresses.

Examples:
> zen-cli sc_create  123456 "8aaddc9671dc5c8d33a3494df262883411935f4f54002fe283745fb394be508a" 5.0 "abcd..ef" "abcd..ef" "abcd..ef"

cronicc avatar Jul 26 '21 12:07 cronicc