Skip to main content

13 posts tagged with "Sui"

View All Tags

· 2 min read
Jack Sim

We are among the first Sui Devnet JSON-RPC providers. Now we are excited to expand our API Service to WebSocket too. WebSocket would be useful to those dApps that need to take action on real-time on-chain events.

How to get started?

Step 1. Go to https://blockeden.xyz/dash/. Please sign up if you haven’t done so.

Step 2. Input your name for the API key, select Sui Devnet Websocket, and then click + Create key.

create sui ws key

Step 3. Grab your access URL by clicking Copy to copy it to the clipboard.

Step 4. Use the access URL in your project like the following. Remember to replace <access_key> with your own key.

How to use WebSocket?

To quickly play around WebSocket endpoint in the command line, you could use wscat. To download it, run the following command:

npm install -g wscat

Then, run the following command to connect to the WebSocket endpoint (remember replacing with your own API key):

wscat -c wss://sui-devnet.blockeden.xyz/kjz2sTknHkNE9aXQ6j1N

Now in the session, you could give the command. For example, you could say subscribing events that matchin some cerntain criteria:

Connected (press CTRL+C to quit)
> {"jsonrpc":"2.0", "id": 1, "method": "sui_subscribeEvent", "params": [{"All":[{"EventType":"MoveEvent"}, {"Package":"0x2"}, {"Module":"devnet_nft"}]}]}
< {"jsonrpc":"2.0","result":6240320950310564,"id":1}

And you would also observe events being streamed to your console:

< {"jsonrpc":"2.0","method":"sui_subscribeEvent","params":{"subscription":6240320950310564,"result":{"timestamp":1672211297607,"txDigest":"PDPBHEo5pmMeLK8Dc4226MZxUA2dkQK91W2ECHFgN1a","id":{"txSeq":1471806,"eventSeq":2},"event":{"moveEvent":{"packageId":"0x0000000000000000000000000000000000000002","transactionModule":"devnet_nft","sender":"0x35a09652085b5c4c178d9cfe234d8c1a6b89306b","type":"0x2::devnet_nft::MintNFTEvent","fields":{"creator":"0x35a09652085b5c4c178d9cfe234d8c1a6b89306b","name":"Example NFT","object_id":"0x7631724b6eb066b8514c6159f716a8826055ee5e"},"bcs":"djFyS26wZrhRTGFZ9xaogmBV7l41oJZSCFtcTBeNnP4jTYwaa4kwawtFeGFtcGxlIE5GVA=="}}}}}
< {"jsonrpc":"2.0","method":"sui_subscribeEvent","params":{"subscription":6240320950310564,"result":{"timestamp":1672211297614,"txDigest":"XcTtaU28vUsR18ZMRhE7XuMadeUfCj8kTZfHD1Xs8H7","id":{"txSeq":1471807,"eventSeq":2},"event":{"moveEvent":{"packageId":"0x0000000000000000000000000000000000000002","transactionModule":"devnet_nft","sender":"0xc9a7020d260599e06b63baae7504b2ead68a580a","type":"0x2::devnet_nft::MintNFTEvent","fields":{"creator":"0xc9a7020d260599e06b63baae7504b2ead68a580a","name":"Example NFT","object_id":"0xdc2961ac31f550fcae6ac050c4cc5c364f3736c3"},"bcs":"3ClhrDH1UPyuasBQxMxcNk83NsPJpwINJgWZ4Gtjuq51BLLq1opYCgtFeGFtcGxlIE5GVA=="}}}}}
< {"jsonrpc":"2.0","method":"sui_subscribeEvent","params":{"subscription":6240320950310564,"result":{"timestamp":1672211297617,"txDigest":"ZpnGea1XkkzfsBeSCnR37xKvkdCSgjcfp81owD6QS4i","id":{"txSeq":1471808,"eventSeq":2},"event":{"moveEvent":{"packageId":"0x0000000000000000000000000000000000000002","transactionModule":"devnet_nft","sender":"0x96e31283ad37fe2ebbdff635501c9feaa2bd8af7","type":"0x2::devnet_nft::MintNFTEvent","fields":{"creator":"0x96e31283ad37fe2ebbdff635501c9feaa2bd8af7","name":"Wizard Land","object_id":"0xe63f7ee979d23d4ab60b598529dc4136d33f07a8"},"bcs":"5j9+6XnSPUq2C1mFKdxBNtM/B6iW4xKDrTf+Lrvf9jVQHJ/qor2K9wtXaXphcmQgTGFuZA=="}}}}}
...

For more details of subscribing Sui events via WebSocket, please refer to the offical doc.

Misc

To prevent too many outstanding idle connections, we will drop any WebSocket connection that hasn't exchanged data in the past 5 minutes. Client will receive an error code: 1006.

· 3 min read
Jack Sim

BlockEden.xyz is now offering an RPC connection to the Sui devnet, allowing Web3 developers and apps to easily communicate with the new Move-based blockchain.

Sui API

This service is compatible with the Sui SDK, enabling more streamlined development. Keep reading to learn more about what this means for you and your blockchain needs!

How to get started?

Step 1. Go to https://blockeden.xyz/dash/. Please sign up if you haven’t done so.

Step 2. Input your name for the API key, select Sui Devnet, and then click + Create key.

Create key for Sui API

Step 3. Grab your access URL by clicking it and copying it to the clipboard.

Step 4. Use the access URL in your project like the following. Remember to replace <access_key> with your own key.

Using CURL to connect Sui

curl -X POST https://sui-devnet.blockeden.xyz/<access_key> \
-H 'Content-Type: application/json' \
-d '{ "jsonrpc":"2.0", "method":"rpc.discover","id":1}'

Using TypeScript SDK to connect Sui

const { JsonRpcProvider } = require("@mysten/sui.js");

(async () => {
const providerUrl = "https://sui-devnet.blockeden.xyz/<access_key>"
const provider = new JsonRpcProvider(providerUrl);
const totalTxNumber = await provider.getTotalTransactionNumber();
console.log(`${providerUrl} getTotalTransactionNumber: ` + totalTxNumber);
})()

What is the Sui Blockchain?

The Sui blockchain is a next-generation, high performance blockchain designed to support a wide range of use cases with advanced features such as accounts, identifiers, and resources. It uses the Move programming language which enables developers to build custom logic into their smart contracts. The Sui team aims to make it the most developer friendly blockchain yet by providing extensive documentation, support, and tools. And they’re off to a great start – BlockEden.xyz is one of the first Web3 infrastructure providers to introduce a new commercial RPC service for this highly anticipated platform!

Builders with Sui

Sui is a blockchain with a lot of potential. There are projects like DEXs, games, launchpads, NFT projects, social networks and wallets building on it.

Why Use BlockEden.yxz?

We listen to Aptos and Sui developers every day and are fully committed to serving the best infra for them.

If you’re a Web3 developer or app owner in need of an RPC connection for the Sui devnet, look no further than BlockEden.xyz! We are proud to be one of the first infrastructure providers offering this service for this highly anticipated new blockchain. In addition to our RPC connection, we will also offer a variety of other essential services and features for any Web3 project. Learn more about us today and see how we can help you succeed in the blockchain space!