Ethereum Smart Contracts API
Mainnet Smart Contract:
0xf26d57E70F4cfF3d19a37871B19fdaa867A37e0C
Ropsten Testnet Smart Contract:
0xf26d57E70F4cfF3d19a37871B19fdaa867A37e0C
Create Secret
createSecret(bytes32 hash,uint32 size,address secretOwner)
Creates a secret hash record in the smart contract, accepts a payment for storage depends on the secret's data size, optionally you can delegate the ownership of the secret to another address (by default the owner is msg.sender).
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
- size uint32 - A size of the secret data string in bytes
- secretOwner address (Optional) - An optional owner of the secret record
Value
- Creation fee as described in the "Payment Page"
Remove Secret
removeSecret(bytes32 hash)
Deletes a secret hash record from the smart contract ledger.
Restricted to the secret's owner.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
Delegate Secret's Ownership
delegateSecret(bytes32 hash, address newSecretOwner)
Changes the owner of the secret.
Restricted to the secret's owner.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
- newSecretOwner address - An address of the new secret's owner
Add Permissions
addPermissions(bytes32 hash, address consumer)
Add a permission to the specified ethereum address (a consumer) to retrieve (download) the secret from the REST API Get Secret Method.
Restricted to the secret's owner.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
- consumer address - Consumer's address, that will have a permission to download the secret
-
Value
- Retrieval fee as described in the "Payment Page"
Make Public
makePublic(bytes32 hash)
Makes the secret publicly available, useful when a smart contract want to retrive secrets data after some conditions already applied. Smart contract can use Provable API to retrieve the secret directly from the REST API Get Secret Method. Restricted to the secret's owner.
* Note: Public secrets are deprecated and deleted after a period of 4 hours after been publicated.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
-
Value
- Publication fee as described in the "Payment Page"
Revoke Permissions
revokePermissions(bytes32 hash, address consumer)
Revokes a permission from the specified ethereum address to retrieve the secret.
Restricted to the secret's owner.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
- consumer address - Consumer's address, whose permissions will be revoked
Is Permitted Retrieval
isPermittedRetrieval(bytes32 hash, address consumer)
Returns true when the specific consumer has permission to retrieve the secret or if the secret is already published.
Use this function to determine wether a consumer is able to download the secret.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
Is Permitted
isPermitted(bytes32 hash, address consumer)
Check whether the consumer has a specific permission to retrieve the secret.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
- consumer address - Consumer's address
Is Public
isPublic(bytes32 hash)
Check whether the secret was published.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
Is Secret Recorded
isSecret(bytes32 hash)
Checks whether a secret with such a hash is already recorded in the ledger.
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
Ledger
ledger(bytes32 hash)
Returns secret's data:
- owner's address
- secret's data size in bytes
- is public - true/false
Parameters
- hash bytes32 - A keccak256 hash of the secret data string
Calculate Storage Fee
calculateStorageFee(uint32 size)
Calculates the storage fee
Parameters
- size uint32 - A size of the secret data string in bytes
Calculate Retrieval Fee
calculateRetrievalFee(uint32 size)
Calculates the fee that is paid when adding permissions to the consumer
Parameters
- size uint32 - A size of the secret data string in bytes
Calculate Public Fee
calculatePublicFee(uint32 size)
Calculates the fee required to make the secret public
* Note: Public secrets are deprecated and deleted after a period of 4 hours after been publicated.
Parameters
- size uint32 - A size of the secret data string in bytes