Page cover image

III. For Developers: Building on SeaSeed Network (SSN)

1. Why Build on SSN?

Benefits of Developing on SSN

SeaSeed Network (SSN) is a robust blockchain platform designed to support the development of decentralized applications (dApps) and smart contracts, catering to a diverse range of industries and use cases. Developers choose SSN for its high-performance, secure infrastructure, and unique developer-focused benefits.

  • High Scalability and Performance: SSN’s architecture is optimized for handling a large volume of transactions, making it ideal for dApps that require high throughput and low latency.

  • Interoperability: SSN facilitates cross-chain compatibility, allowing developers to build applications that can interact with other blockchain networks, enhancing the versatility and user reach of their dApps.

  • Developer Tools and Documentation: SSN provides an extensive suite of developer tools, SDKs, and thorough documentation, reducing the time needed to build, test, and deploy applications.

  • Lower Transaction Costs: Transactions on SSN are cost-effective, making it an attractive option for developers who want to create applications with high user engagement and frequent transactions.

  • Strong Security Protocols: SSN employs advanced security measures to protect applications and user data, giving developers peace of mind when building critical financial and data-sensitive applications.

  • Comprehensive Support for Compliance: With SSN’s compliance framework, developers can create applications that align with regulatory requirements, such as KYC/AML, helping them gain acceptance in regulated industries.

2. Developer Guide

Getting Started

SSN provides a streamlined process for developers to start building quickly and efficiently. To begin, developers can follow these steps:

  • Set Up a Development Environment: Install SSN’s SDK and other tools required to begin coding and interacting with SSN’s network. The setup guide on SSN’s developer portal walks you through configuring your environment for maximum efficiency.

  • Access the Developer Portal: SSN’s developer portal offers comprehensive resources, including documentation, API references, smart contract templates, and sample code. This portal serves as a central hub for all the tools and resources needed to build on SSN.

  • Smart Contract Development: SSN supports Solidity and other widely used languages, allowing developers to leverage existing skills. Smart contracts on SSN enable the automation of complex processes, making applications highly efficient and scalable.

  • Testing and Deployment: Utilize SSN’s testnet to develop and thoroughly test applications before mainnet deployment. This environment mimics the mainnet conditions, ensuring that applications perform as expected.

  • Access Developer Tools: SSN provides various tools such as block explorers, gas fee estimators, and debugging utilities to support development, testing, and ongoing maintenance.

Developer Guide

RPC

(link available soon)

Faucet

(link available soon)

Explorer

(link available soon)

Deploying Smart Contract

This quickstart guide is designed for web developers interested in building decentralized applications (dApps) on the SSN network. No prior experience with Ethereum, Arbitrum, or Solidity is required, though familiarity with JavaScript and Yarn is recommended. If you are new to Ethereum, reviewing the Ethereum documentation may be helpful before you begin.

Prerequisites

  • VS Code: The integrated development environment (IDE) we’ll use to build the vending machine dApp. Install it from code.visualstudio.com.

  • Metamask: A crypto wallet for interacting with the vending machine dApp. Download it at metamask.io.

  • Yarn: The package manager for managing project dependencies. Install it from yarnpkg.com.

Create and Deploy your Smart Contract

Step 1: Connect with SSN by RPC url

To interact with the SSN network, you’ll need to connect your application or wallet using the SSN network’s RPC URL. The RPC (Remote Procedure Call) URL allows your application to send transactions, read data, and interact with the blockchain. The RPC URLs for the testnet and mainnet are provided above <provide link to section>.

For development purposes:

  • Add the RPC URL in your configuration file (such as hardhat.config.js in Hardhat or directly in your code if using web3 or ethers.js).

For wallet applications like MetaMask:

  • Open MetaMask and go to Settings > Networks.

  • Click Add Network and enter the SSN RPC URL, Chain ID, and currency symbol as provided by the SSN network.

For more detailed steps on adding a custom network in MetaMask, refer to the MetaMask Support Guide.

This step is essential for establishing a connection to the SSN blockchain, enabling your application to interact with the network.

Step 2: Request SSN from faucet

You’ll need SSN tokens to pay for transaction fees. Visit the SSN testnet faucet, enter your wallet address, and request some test SSN tokens.

Step 3: Check your balance

After receiving SSN tokens from the faucet, check your balance to confirm you have funds for deploying and interacting with the contract.Here’s how to check your SSN token balance using curl to make an RPC request directly:

1. Replace <SSN_RPC_URL> with the actual RPC URL of the SSN network.

2. Replace <Your_Wallet_Address> with your wallet address.

curl -X POST \

<SSN_RPC_URL> \

-H "Content-Type: application/json" \

-d '{

"jsonrpc": "2.0",

"method": "eth_getBalance",

"params": ["<Your_Wallet_Address>", "latest"],

"id": 1

}'

Example Response

The response will look something like this:

{

"jsonrpc": "2.0",

"id": 1,

"result": "0x1bc16d674ec80000"

}

The result field shows your balance in Wei (smallest unit of SSN). To convert it to SSN, you can use a converter, as 1 SSN = Wei.

Step 4: Init hardhat project

Begin by creating a dedicated directory for your project and initializing a new Hardhat project within it. Hardhat will guide you through setting up essential files and configurations, including sample contracts, scripts, and a basic configuration file. This setup will provide the foundation for writing, compiling, testing, and deploying your smart contract.

As you go through this setup, Hardhat will create a hardhat.config.js file, which you’ll later modify to connect to the SSN network. This file is essential, as it lets you specify network settings, compiler options, and other project-specific configurations.

For detailed setup instructions, refer to the official Hardhat Project Setup Guide.

Step 5: Config url and account in hardhat project

After setting up the Hardhat project, configure it to connect to the SSN network. Open the hardhat.config.js file generated during the initialization. In this file, you’ll add your SSN network’s RPC URL and the private key of your wallet. These configurations allow Hardhat to deploy and interact with smart contracts on SSN.

The hardhat.config.js file includes options for specifying network parameters, such as RPC URLs, chain IDs, and accounts. Be cautious with your private key and avoid exposing it in public repositories.

Once configured, your Hardhat project will be ready to compile, test, and deploy contracts directly to the SSN network.

For reference on network configuration options, you may consult the Hardhat Network Guide.

Step 6: Write smart contract

Now, create your first smart contract to deploy on the SSN network. In the contracts directory of your Hardhat project, add a new file, such as HelloWorld.sol. This file will define the structure and functionality of your smart contract.

For example, here’s a simple HelloWorld contract:

```

// SPDX-License-Identifier: MIT

// Compiler version must be greater than or equal to 0.8.26 and less than 0.9.0

pragma solidity ^0.8.26;

contract HelloWorld {

string public greet = "Hello World!";

}

```

This contract includes:

• A string variable, greet, initialized with the message “Hello World!”.

• The greet variable is marked as public, allowing any user to read this message directly from the contract.

This basic example helps you get familiar with Solidity syntax and smart contract structure. For more details on writing smart contracts in Solidity, refer to the Solidity Documentation, where you can explore syntax, data types, and contract features.

Once this contract is complete, you’ll be ready to move to the next step and compile it.

Step 7: Compile smart contract

With your smart contract written, the next step is to compile it using Hardhat. Compilation converts the Solidity code into bytecode that can be deployed to the SSN network. Hardhat will check your code for syntax errors, ensure compatibility with the specified Solidity version, and generate the necessary artifacts for deployment.

To compile your contract, run the following command in your project directory:

```

npx hardhat compile

```

Hardhat will automatically detect the Solidity files in the contracts folder and compile them. After a successful compilation, you’ll find the compiled files in the artifacts directory. These artifacts include the bytecode and the contract’s ABI (Application Binary Interface), which will be essential for deploying and interacting with your contract.

If you encounter any errors, verify that the Solidity version specified in your hardhat.config.js file is compatible with your contract code.

For more details on compiling contracts with Hardhat, refer to the Hardhat Compilation Guide.

Step 8: Write script to deploy contract

With your contract compiled, the next step is to create a deployment script to deploy it to the SSN network. This script will use Hardhat’s ethers.js integration to interact with your contract and deploy it to the blockchain.

In the scripts folder of your project, create a new file (for example, deploy.js) where you’ll write the deployment logic. This script will:

• Retrieve the contract’s compiled code and ABI from the artifacts directory.

• Connect to the specified SSN network using your configuration in hardhat.config.js.

• Deploy the contract and output its address.

Here’s an example deployment script for a simple contract like HelloWorld:

```

// scripts/deploy.js

async function main() {

const [deployer] = await ethers.getSigners();

console.log("Deploying contract with account:", deployer.address);

// Retrieve the contract factory

const HelloWorld = await ethers.getContractFactory("HelloWorld");

// Deploy the contract

const helloWorld = await HelloWorld.deploy();

await helloWorld.deployed();

console.log("HelloWorld contract deployed at:", helloWorld.address);

}

main()

.then(() => process.exit(0))

.catch((error) => {

console.error(error);

process.exit(1);

});

```

In this example:

  • ethers.getSigners() provides the deployer account for deployment.

  • ethers.getContractFactory("HelloWorld") loads the compiled contract so it’s ready for deployment.

  • helloWorld.deploy() deploys the contract to the network, and await helloWorld.deployed() waits until deployment is confirmed.

Once this script is complete, you’ll be ready to execute it to deploy your contract to the SSN network.

For more details on writing and managing deployment scripts, see the Hardhat Scripting Guide.

This step explains the purpose of the deployment script, provides an example, and includes a link to further resources.

Step 9: Deploy smart contract to SSN

Deploying your contract is essential to make it accessible on the SSN network, where it can interact with other accounts and handle transactions. Once deployed, the contract’s functions can be called by users, allowing it to perform its intended role within the decentralized application (dApp).

In Hardhat, you can deploy your contract using Ignition, which provides a structured approach for deploying and managing smart contracts on a blockchain network. Ignition simplifies the process by letting you define deployment modules that automate contract deployment.

For detailed instructions on setting up and using Hardhat Ignition, refer to the Hardhat Development Guide

Verifying Smart Contract

To verify your deployed contract, you have two main approaches:

  1. Verifying Within Your Hardhat Project

Hardhat provides a built-in verification feature to simplify the process. To verify using Hardhat, follow the instructions in the Hardhat Verification Guide.

Alternatively, you can automate verification directly in your deployment script by adding the following

```

code after deploying your contract:

await run("verify:verify", {

address: accountIngressAddress, // Replace with your contract's deployed address

contract: "contracts/AccountIngress.sol:AccountIngress", // Replace with your contract path and name

});

```

This method integrates verification as part of your deployment process, ensuring the contract is verified as soon as it’s deployed.

  1. Manual Verification on the Explorer

If you prefer or need to verify manually, navigate to your contract’s page on the blockchain explorer. Locate your contract and select Verify & Publish. Follow the prompts to complete the verification process by uploading the contract source code and any required metadata.

Both approaches will make the contract’s source code visible and allow users to interact with it directly on the explorer.

Integration and APIs

SSN offers a range of APIs to facilitate seamless integration with other systems, whether for data exchange, transaction processing, or user authentication. Developers can leverage these APIs to extend their applications’ functionality and integrate SSN’s features into existing platforms.

Documentation and Support

  • API Documentation: Full API documentation with examples to streamline integrations with SSN, covering transaction processing, data retrieval, and user management.

  • Smart Contract Documentation: Guides for developing secure and optimized smart contracts, including code samples, best practices, and audit considerations.

  • Community and Developer Forums: Connect with SSN’s developer community to share knowledge, get feedback, and access peer support for complex development issues.

3. Developer FAQs

Frequently Asked Questions

This section addresses common questions from developers looking to build on SSN, providing quick answers to get started effectively.

  • What programming languages are supported on SSN? SSN is compatible with Solidity, making it easy for developers experienced in Ethereum-based development to transition their skills. Other languages may be supported through interoperability and external tooling.

  • How do I test my application before deploying to the mainnet? Developers can deploy and test their applications on SSN’s testnet, which mirrors mainnet conditions and allows for thorough testing of transactions, smart contracts, and integrations.

  • Are there any fees to develop on SSN? Yes. With the introduction of gas fees on SSN, all transactions now require a nominal amount of SSN tokens to execute, including those on the testnet. However, developers can obtain testnet tokens for free via our faucet, ensuring that testing and development phases remain accessible and cost-effective. For mainnet deployment, acquiring SSN tokens is necessary to cover gas fees, which are designed to remain competitive and cost-efficient.

  • How can I ensure my smart contract is secure? SSN provides a guide on smart contract security best practices, along with optional audit resources to help ensure that contracts are optimized and secure. Additionally, testing tools are available to identify and mitigate vulnerabilities.

  • What APIs are available for integration? SSN offers APIs covering essential functions like asset transfers, data querying, and identity verification, which help integrate blockchain functionality into applications seamlessly.

  • Can I migrate an existing application to SSN? Yes, applications built on compatible blockchain platforms (such as Ethereum) can be migrated to SSN. Documentation is available to guide developers through the migration process, including steps for redeploying contracts and adjusting integrations.

  • Is there a developer community I can join? Absolutely! SSN has an active community forum where developers can collaborate, share insights, and seek support from other network developers.

  • How do I stay updated on SSN developments? SSN provides updates through its developer portal, newsletters, and social media channels, ensuring developers stay informed about new features, tools, and security patches.

Last updated