Overview

Welcome to .NET IOST SDK documentations!

IOST is a new generation of high-performance public blockchains. The infrastructure is scalable, stable and allows low level customization for different business requirements.

These documentations are an entry point to .NET IOST ecosystem for new developers as well as those who are experienced. The documentations are maintained by Sonata IOST Node operator. The documentation serves the purpose of providing a clear understanding of IOST technology and the .NET SDK.

The .NET IOST SDK is based on .NET Framework 4.7.2. It is free to use for any .NET based projects that want to build on top of IOST Blockchain.

IOST


# Default config
# gasLimit=1000000
# gasRatio=1
# delay=0
# expiration=90000000000L
IOST.IOST iost = new IOST.IOST();

                

This is the main class that create transactions to send to IOST blockchain and IOST smart contracts.

CONSTRUCTOR PARAMETERS

Field Type Description
gasLimit Long transaction gas limit
gasRatio Long transaction gas price
delay Long time in seconds that transaction will be delay
expiration Long time in seconds that transaction will be expired

Returns

IOST object instance.

CallABI


 Transaction tx = CallABI("token.iost", "transfer", "[\"iost\", \"admin\", \"john\", \"1000\", \"Rewards\"]");
                

call contract abi function

PARAMETERS

Field Type Description
cid String contract id or contract domain
abi String contract abi function name
data String function args array

Returns

Transaction object instance.

NewAccount


Base58 b58 = new Base58();
KeyPair Newkp = new Ed25519();
String NewPubKey = b58.Encode(Newkp.Pubkey());
Transaction tx = iost.NewAccount("newAcc", "admin", NewPubKey, NewPubKey, 1024, 10);
Console.WriteLine("Private Key:" + b58.Encode(Newkp.Seckey()));
                

create new IOST blockchain account

PARAMETERS

Field Type Description
name String new account name
creator String creator account name
ownerkey String creator account ownerKey
activekey String creator account activeKey
initialRAM Number new account initialRAM, paid by creator
initialGasPledge Number new account initialGasPledge, paid by creator

Returns

Transaction object instance.

Transfer


Transaction tx = iost.Transfer("iost", "admin", "john", "1000", "transfer for your rewards");
                

transfer tokens to designated account, wrapper for callABI

PARAMETERS

Field Type Description
token String token name
from String transfer-from account
to String transfer-to account
amount String transfer amount
memo String memo of this transfer

Returns

Transaction object instance.

Transfer Full Example


Client client = new Client("http://13.52.105.102:30001");
IOST.IOST iost = new IOST.IOST();

Transaction tx = iost.Transfer("iost", "admin", "john", "1000", "rewards");
Base58 b58 = new Base58();
byte[] privateKey = b58.Decode("5J3UYgRtYFE3g4UbzrYmxHsptCvGfifk5kcGP66ww2dfNghc1WnZUVgZYVVFKBiPnk4LZA8uuXLEXhevj1S3dcss");

Keychain account = new Keychain("admin");
KeyPair kp = new Ed25519(privateKey);
account.AddKey("owner", kp);
account.AddKey("active", kp);
account.Publish(tx);

String txHash = client.SendTx(tx);
Console.WriteLine(txHash);

TxReceipt receipt = client.Polling(txHash, 1000, 90);
if (receipt.status_code == "SUCCESS")
{
    Console.WriteLine("tx success : gas usage " + receipt.gas_usage);
}
else
{
    Console.WriteLine("tx failed :");
    Console.WriteLine(receipt.message);
}
                

This is a full example of the sample code to perform a IOST funds transfer using the SDK.

Other Sections: