Code Examples

Snippets from these example are used in the Functions in the Fsn Class descriptions.

fsnBlockheight.py Basic example showing how to get the current block height.

fsnGetBalance.py Simple example to get the FSN balance of an account.

fsnBuyTicket.py Buying a ticket, checking to see if autobuy ticket is on.

fsnAllTickets.py Listing all tickets and their block heights on the blockchain and showing the totalNumberOfTickets function. Also shows usage of the ticketPrice and getStakeInfo functions.

fsnTicketsByAddress.py Listing tickets for an account, including their start and end times.

fsnSendRawFSN.py Send FSN with a raw transaction and show getTransactionCount and getTransaction.

fsnGetAsset.py Show how to get asset information from the fsnapi.

fsnAssetNameToAssetInfo.py Get asset information, given the asset name (only for whitelisted and enabled assets - ‘verified’).

fsnGetAsset.py Get asset information about any asset on the blockchain, given its asset ID or asset name (shows getAssetId function).

fsnCreateRawAsset.py Show how to create an asset.

fsnInc_and_DecRawAsset.py Show how to increase or decrease the supply of an asset (if it can be changed).

fsnSendRawAsset.py Demonstrate how to send an asset on the blockchain to another wallet.

fsnGetAllTimelockInfo.py Get all the timelocks for all assets from an account.

fsnGetTimelockInfo.py Get timelock inforamtion about one asset ID.

fsnToAndFromRawTimeLock.py Sending assets to and from timelock.

fsnSendToRawTimeLock.py Sending assets to another address as timelock.

fsnTimeLockToRawTimeLock.py Change the timelock on an asset.

fsnGetAllSwaps.py Get information on all swaps in the Quantum Swap Marketplace.

fsnMakeAndRecallRawSwap.py Create a new swap and then recall it.

fsnTakeRawSwap.py Take all or part of a swap. Example also shows getSwap.

fsnGenNotation.py Generate a new USAN for an account and then show how to get the public key for it (and vice-versa).

fsnOfflineTransactions.py Show how to separate out the preparation of transactions from actaully signing and transmitting them.