title |
---|
Sui Exchange Integration FAQ |
The Sui blockchain is still in its development stages, therefore many of the solutions provided in this topic are interim. Please do not hesitate to contact us if you are having issues with the information provided.
- Sui Documentation Portal: https://docs.sui.io/
- Sui REST API's: https://docs.sui.io/sui-jsonrpc
- Run a Full node: https://docs.sui.io/devnet/build/fullnode
Testnet Wave 2 ended on 02/15/23. Information about subsequent Testnet waves will be provided when available.
This section includes general questions about the Sui platform.
The main branch contains all the latest changes. The devnet
branch reflects the binary that is currently running on the Devnet network.
Yes, contracts are also stored in objects. You can use the sui_getObject to fetch the object. Example: https://explorer.sui.io/objects/0xe70628039d00d9779829bb79d6397ea4ecff5686?p=31
Note: You can see only the deserialized bytecode (as opposed to Source code).
Can I get the information in the contract, such as the total amount of the currency issued and the number of decimal places?
There's no contract-level storage in Sui. In general, this contract-level information is usually stored in an object or event. For example, we store decimals in this object https://github.com/MystenLabs/sui/blob/1aca0465275496e40f02a674938def962126412b/crates/sui-framework/sources/coin.move#L36. And in this case we provide an convenience RPC endpoint.
Yes, the gas price is dynamic and exposed via the sui_getReferenceGasPrice endpoint.
You can delete objects (in most cases) only if the Move module that defines the object type includes a Move function that can delete the object, such as when a Move contract writer explicitly wants the object to be deletable).https://docs.sui.io/devnet/build/programming-with-objects/ch2-using-objects#option-1-delete-the-object
If the delete function is defined in the Move module, you can delete the object by invoking the Move call using CLI or wallet. Here’s an example:
-
Create an example NFT using the Sui Client CLI: https://docs.sui.io/devnet/build/cli-client#create-an-example-nft.
-
Call this Move function with the CLI by following https://docs.sui.io/devnet/build/cli-client#calling-move-code.
MIST is the smallest unit of a SUI Coin. 1 SUI equals 1 billion MIST, and 1 MIST equals 10^-9 of a SUI.
Questions about transaction in Sui.
There are "Move events" that are emitted by Move code, and "transaction events" such as object transfers, creations, and deletions. https://docs.sui.io/build/pubsub#events has a list of all the events you can subscribe to via the pub/sub API and their structure.
As a best practive, don't rely on the transaction serial number because there's no total ordering of transactions on Sui. The transaction serial numbers differ between different Full nodes.
No, the ordering will be different on different nodes for now, while we are still working on checkpoints. After checkpoint process is complete, the ordering will be the same on all nodes
There are no nonce or timestamps in our transaction data structure at the moment
Transactions don't expire.
The following questions are related to staking on the Sui network.
Sample staking implementation:
The entry functions for staking are defined in this module. Relevant functions include:
request_add_stake
request_add_stake_with_locked_coin
request_withdraw_stake
request_add_delegation
request_add_delegation_with_locked_coin
request_withdraw_delegation
The first three functions are for validator staking for themselves while the rest are for delegated staking.
The number is still under consideration. The validator set is not fixed, but validators must apply and then be approved through our validator application process.
Yes, a user/validator stakes using the address that owns the staked coin. There is no special address derivation
How is a staking transaction different from a typical transaction regarding construction, signing, and broadcasting?
Staking transactions are Move call transactions that call specific Move function in the Sui Framework. The staking transaction uses a shared object, and is no different from other shared object transactions.
Yes, an address can own multiple coins of different amounts. Sui supports staking coins owned by an address to different validators. The minimum staking amount that can be delegated is 1 MIST which is equal to .000000001 SUI.
Yes, if an address owns multiple coins, you can stake each coin with a different validator.
Yes, you can add to or withdraw your stake from a validator. Use the following methods to modify the stake amount:
Use the request_add_delegation
and request_add_delegation_with_locked_coin
methods to add to the staked amount.
Use the request_withdraw_delegation
method to withdraw all or part of the delegation.
Yes, the specifics are still under consideration.
Yes, the current un-bonding period under consideration.
Yes, Sui uses a staking pool approach inspired by liquidity pools. Rewards are added to the pool and auto-compounded through the appreciation of pool token value relative to SUI tokens.
Yes, rewards are added to the staking pool through a special system transaction at epoch boundaries.
Rewards are compounded every epoch, and paid out when you withdraw your stake. You must stake for the entire duration of an epoch to receive rewards for that epoch.
There will be a minimum amount required and a maximum amount allowed, as well as limits on stake changes within an epoch.
- Validation: Requires a high minimum amount of SUI.
- Delegation: No minimum
Specific amounts will be provided when available.
There will not be slashing for the principal stake allocated. Instead, validators will get penalized by having fewer future rewards when these get paid out. Rewards that have already been accrued are not at risk.
On-chain governance is not implemented for Sui. There is no plan to add it in the near future.
Answers to the following questions address specific details around surfacing block details.
Sui is DAG-based, so the block-based view of the transaction history is not always the most direct one. To get the latest transaction, use the Transaction Query API:
```json
{
"jsonrpc": "2.0",
"id": 1,
"method": "sui_getTransactions",
"params": [
"All",
<last known transaction digest>,
100,
"Ascending"
]
}
```
The following solution is interim:
Use the BalanceChangeEvent
using the event query API. BalanceChangeEvent
was added in October 2022 in this PR.
Sui uses checkpoints, but this is still under development. Checkpoints are like blocks that are created periodically (likely every few minutes), but generated asynchronously instead of on the critical path for execution. Each checkpoint contains all of the confirmed transactions since the previous checkpoint.
A significant amount of the performance benefits of Sui comes from carefully separating the work required to actually finalize a transaction from bookkeeping work, like checkpoint construction. We're experimenting with a number of different generation intervals, and this may change over time as we better understand the traffic patterns.
Temporary solution For now, we have created one block per transaction until Checkpoints become available. See sample here.
```rust
#[async_trait]
pub trait BlockProvider {
async fn get_block_by_index(&self, index: u64) -> Result<BlockResponse, Error>;
async fn get_block_by_hash(&self, hash: BlockHash) -> Result<BlockResponse, Error>;
async fn current_block(&self) -> Result<BlockResponse, Error>;
fn genesis_block_identifier(&self) -> BlockIdentifier;
async fn oldest_block_identifier(&self) -> Result<BlockIdentifier, Error>;
async fn current_block_identifier(&self) -> Result<BlockIdentifier, Error>;
async fn get_balance_at_block(
&self,
addr: SuiAddress,
block_height: u64,
) -> Result<u128, Error>;
}
```
How are transactions proposed by validators if they're not included in blocks? Does a validator propose blocks or just individual transactions?
Validators form a certificate (a quorum of signatures) for each transaction, and then propose checkpoints consisting of certificates since the last checkpoint. You can read more in section 4.3 here.
- You can find our faucet in Discord.
- Please visit our Discord server.