Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* Issue a token for an existing house asset. Fetch the house from ledger using uuid, and issue a token against it.
* call built in IssueTokens Flow to issue tokens
* IssueTokens flow is a flow for issuing fungible or non-fungible tokens which initiates its own participantSessions.
* This is the case when called from the node rpc or in a unit test. However, in the case where you already
* have a session with another [Party]
* and you wish to issue tokens as part of a wider workflow, then use [IssueTokensFlow].
public static class IssueEvolvableTokenFlow extends FlowLogic<SignedTransaction>{
private final String evolvableTokenId;
private final Party recipient;
public IssueEvolvableTokenFlow(String evolvableTokenId, Party recipient) {
this.evolvableTokenId = evolvableTokenId;
this.recipient = recipient;
public SignedTransaction call() throws FlowException {
// uuid column in vault_linear_states contains the uuid of the created asset on ledger
UUID uuid = UUID.fromString(evolvableTokenId);
// construct queryCriteria to get the created asset on ledger by using LinearStateCriteria
// get all the unconsumed states from vault_linear_states having uuid
QueryCriteria queryCriteria = new QueryCriteria.LinearStateQueryCriteria(null, ImmutableList.of(uuid), null,
Vault.StateStatus.UNCONSUMED, null);
// use vaultservice to hit the vault using the query criteria
StateAndRef<RealEstateEvolvableTokenType> stateAndRef = getServiceHub().getVaultService().
queryBy(RealEstateEvolvableTokenType.class, queryCriteria).getStates().get(0);
// get the state from StateAndRef returned by the query
RealEstateEvolvableTokenType evolvableTokenType = stateAndRef.getState().getData();
LinearPointer linearPointer = new LinearPointer(evolvableTokenType.getLinearId(), RealEstateEvolvableTokenType.class);
// token pointer is a linear pointer to created real estate asset
TokenPointer token = new TokenPointer(linearPointer, evolvableTokenType.getFractionDigits());
// issue token stating issuer who is getOurIdentity() for this example, recipient will be the holder of the token
return (SignedTransaction) subFlow(new IssueTokens(token, this.getOurIdentity(), recipient));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.