Skip to content

⛓ RFC: multi-sig DSL for interacting with Iroha

Notifications You must be signed in to change notification settings

CastleOne/akka-iroha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Iroha ScalaDSL

mock up code, heavily inspired by Akka graphs DSL

import org.hyperledger.iroha.scaladsl

val time = System.currentTimeMillis
val authorAccount = Iroha.Account("sender@account")
val statementsAccount = Iroha.Account("statements@bank")
val authorityAccount = Iroha.Account("authority@bank")

val transaction = Transaction.create(authorAccount, time) { implicit builder =>
  import Builder.Implicits._
  import Iroha._
  
  add CreateAccount(Account("account1", "domain"), defaultKeypair.publicKey)
  add TransferAsset(Account("account@domain"), Account("account1@domain"), Asset("usd#domain"), Description("description"), BigDecimal(5))
  
  // Option A
  needs authorAccount signature
  needs statementsAccount signature
  needs authorityAccount signature
  // Option B
  quorum(3 signatures)
}

val payload = Payload.createFromSeq(Seq(transaction))

val authorKeypair = Iroha.Keypair.fromBytes(supersecret1)
val statementsKeypair = Iroha.Keypair.fromBytes(supersecret2)

grpc.torii(
  payload
    .sign(authorAccount, authorKeypair)
    .sign(statementsAccount, statementsKeypair)
    .build
)

About

⛓ RFC: multi-sig DSL for interacting with Iroha

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages