Solang

Solang: Solidity for Solana

Installation

Follow these steps to set up your development environment for Solang:

  1. Check Your Prerequisites Ensure you have Rust and Node.js installed on your system. Windows users should also have the Windows Subsystem for Linux set up.

  2. Solana Tool Suite Installation Install the Solana Tool Suite, including the Solana Command Line Interface (CLI) and the latest Solang version.

  3. Anchor Framework Installation Install the Anchor Framework, a powerful tool for building Solana programs. Starting from version 0.28, you can use Solang directly with Anchor.

    To ensure compatibility with Solang version 0.3.1, install Anchor using:
    
    cargo install --git https://github.com/coral-xyz/anchor anchor-cli --locked --force
  4. Solang Extension for VSCode If you're a Visual Studio Code (VSCode) user, it's recommended to install the Solang extension to assist with syntax highlighting. Remember to disable any active Solidity extensions to ensure that the Solang extension works correctly.

Guide for building from source: Build Solang from Source

Troubleshooting

Solang is only compatible with Ubuntu 22. If you encounter the following error, follow the solution provided below:

  • Error:

Solang: /lib/x86_64-linux-gnu/libstdc++.so.6: version GLIBCXX_X.XX' not found (required by Solang)
solang: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_X.XX' not found (required by solang)
  • Solution:

Run the following commands:

sudo apt-get update
sudo apt-get upgrade
sudo do-release-upgrade
Check the GLIBCXX versions:

strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 | grep GLIBCXX
ldd --version | grep GLIBC


Create your token with Solang

  • Follow these steps to create your own token using Solang:

git clone https://github.com/Coin-Delta/solang-token.git
npm install

Open the file in Visual Studio Code (VSCode).

  1. Switch Solana Network

  • Choose the Solana network of your choice (localnet, devnet, testnet, or mainnet):

# Get current configuration
solana config get

# Set the network URL
solana config set --url [network_url]

# If you are running localnet validators, run this command:
solana-test-validator --reset --quiet [command specific to localnet]
  1. Create a New Wallet

Create a new wallet:
solana-keygen

To overwrite an existing wallet or if you've previously created one:
solana-keygen --force
  1. Airdrop Tokens

solana airdrop 4

Note: The private key is stored locally in the key pair. To view it, navigate to the folder and show hidden files. Access the .config folder in the Find Solana directory and locate the id.json file containing the private key.

  1. Configure the Anchor.toml file

  • After cloning the repository, modify the configuration in the Anchor.toml file.

  1. Build and Deploy the Anchor

Build the project:
anchor build

Deploy the project:
anchor deploy
  1. Customize Token Information

  • Open the token.ts file in VSCode.

  • Modify the token's name, symbol, and URI to suit your needs.

  const dataV2 = {
    name: "your_token_name",
    symbol: "your_token_symbol",
    uri: "your_token_uri",
    sellerFeeBasisPoints: 0,
    creators: null,
    collection: null,
    uses: null,
  };
  1. Run the Typescript File

  • Before running the Token.ts file, execute these three commands:

export ANCHOR_PROVIDER_URL=https://api.devnet.solana.com || http://localhost:8899
export ANCHOR_PROVIDER=devnet || localnet
export ANCHOR_WALLET=~/.config/solana/id.json #replace with your own path
  • Now, run the Typescript file Token.ts using:

npx ts-node token.ts

The purpose of this command is to execute the Typescript code in the token.ts file using the ts-node runtime. This is especially useful during development when you want to quickly run and test Typescript code without manually compiling it to JavaScript beforehand.

Representing

The team below is representing Coindelta, a blockchain based company based in the United States. Coindelta is a well reputed company having a core team of blockchain developers. Link to the website of the company. (www.coindelta.io)

Team Members

  • Aditya Joshi (Blockchain Developer) (Team Lead) (aditya@coindelta.io)

  • Yash Kothari (Blockchain Developer) (yash.kothar@coidelta.io)

  • Tizil Soni (Blockchain Developer) (tizil@coindelta.io)

  • Saurav Singh (Back-end Developer) (saurav@coindelta.io)

Last updated