Main
This API enables you to automate secret storage and interacting with Ethereum Smart Contracts. Now you can build DApps that deal with hidden information securely and crypto-provable.
Guide
- To have a quick-start tutorial go to the "Tutorial Page"
- Full API reference for the Smart Contract and the REST API
- "Payments Page" will describe the fee calculation process and the pricing
Secrether Addresses
Mainnet
0xf26d57E70F4cfF3d19a37871B19fdaa867A37e0C
Ropsten Testnet
0xf26d57E70F4cfF3d19a37871B19fdaa867A37e0C
REST API Endpoints
Mainnet
https://api.secrether.io/
Ropsten Testnet
https://ropsten-api.secrether.io/
Secrether Smart Contract Interface
Solidity
// @title Ethereum secrets ledger interface
interface ISecrether {
// Structures
struct Secret {
address owner;
uint32 size;
bool _public;
}
// External
// @notice Determines whether such a secret exists
// @param hash The secret's hash
// @returns True if such a secret exists, otherwise false
function isSecret(bytes32 hash) external view returns (bool);
// @notice Determines whether a consumer can retrieve that secret
// @param hash The secret's hash
// @param consumer The consumer address that wants to retrieve the secret
// @returns True if the consumer permitted to retrieve the secret, otherwise false
function isPermitted(bytes32 hash, address consumer) external view returns (bool);
// @notice Determines whether the secret is publicly available for download
// @param hash The secret's hash
// @returns True if the secret is publicly available, otherwise false
function isPublic(bytes32 hash) external view returns (bool);
// @notice Determines whether the secret is availble for retrieval by this address
// @param hash The secret's hash
// @param consumer The consumer address that wants to retrieve the secret
// @returns True if the secret is availble for retrieval by this address, otherwise False
function isPermittedRetrieval(bytes32 hash, address consumer) external view returns (bool);
// @notice Creates a new secret with a caller as secret's owner
// @param hash The secret's hash
// @param size The size of the secret in bytes
function createSecret(bytes32 hash, uint32 size) external payable;
// @notice Creates a new secret
// @param hash The secret's hash
// @param size The size of the secret in bytes
// @param secretOwner The secret's owner address
function createSecret(
bytes32 hash,
uint32 size,
address secretOwner
) external payable;
// @notice Removes an existing secret
// @param hash The secret's hash
function removeSecret(bytes32 hash) external;
// @notice Delegates a secret to another owner
// @param hash The secret's hash
// @param consumer A new secret's owner
function delegateSecret(bytes32 hash, address newSecretOwner) external;
// @notice Adds consumer permissions to the secret
// @param hash The secret's hash
// @param consumer A consumer's address
function addPermissions(bytes32 hash, address consumer) external payable;
// @notice Makes the secret public for all
// @param hash The secret's hash
function makePublic(bytes32 hash) external payable;
// @notice Revokes consumer permissions to the secret
// @param hash The secret's hash
// @param consumer A consumer's address
function revokePermissions(bytes32 hash, address consumer) external;
// @notice Calculates storage fee
// @param size The size of the secret in bytes
// @returns Storage fee in wei
function calculateStorageFee(uint32 size) external pure returns (uint256);
// @notice Calculates retrieval fee
// @param size The size of the secret in bytes
// @returns Retrieval fee in wei
function calculateRetrievalFee(uint32 size) external pure returns (uint256);
// @notice Calculates public fee
// @param size The size of the secret in bytes
// @returns Public fee in wei
function calculatePublicFee(uint32 size) external pure returns (uint256);
}
Typescript
interface EventOptions {
filter?: object;
fromBlock?: BlockType;
topics?: string[];
}
export class ISecrether extends Contract {
constructor(
jsonInterface: any[],
address?: string,
options?: ContractOptions
);
clone(): ISecrether;
methods: {
addPermissions(
hash: string | number[],
consumer: string
): TransactionObject<void>;
calculatePublicFee(size: number | string): TransactionObject<string>;
calculateRetrievalFee(size: number | string): TransactionObject<string>;
calculateStorageFee(size: number | string): TransactionObject<string>;
createSecret(
hash: string | number[],
size: number | string
): TransactionObject<void>;
delegateSecret(
hash: string | number[],
newSecretOwner: string
): TransactionObject<void>;
isPermitted(
hash: string | number[],
consumer: string
): TransactionObject<boolean>;
isPermittedRetrieval(
hash: string | number[],
consumer: string
): TransactionObject<boolean>;
isPublic(hash: string | number[]): TransactionObject<boolean>;
isSecret(hash: string | number[]): TransactionObject<boolean>;
makePublic(hash: string | number[]): TransactionObject<void>;
removeSecret(hash: string | number[]): TransactionObject<void>;
revokePermissions(
hash: string | number[],
consumer: string
): TransactionObject<void>;
};
events: {
allEvents: (
options?: EventOptions,
cb?: Callback<EventLog>
) => EventEmitter;
};
}