(String[] args)
| 7 | |
| 8 | class MultipartyTrades { |
| 9 | public static void main(String[] args) throws Exception { |
| 10 | // This demo is written to run on either one or two cores. Simply provide |
| 11 | // different URLs to the following clients for the two-core version. |
| 12 | Client aliceCore = new Client(); |
| 13 | Client bobCore = new Client(); |
| 14 | |
| 15 | MockHsm.Key aliceDollarKey = MockHsm.Key.create(aliceCore); |
| 16 | HsmSigner.addKey(aliceDollarKey, MockHsm.getSignerClient(aliceCore)); |
| 17 | |
| 18 | MockHsm.Key bobBuckKey = MockHsm.Key.create(bobCore); |
| 19 | HsmSigner.addKey(bobBuckKey, MockHsm.getSignerClient(bobCore)); |
| 20 | |
| 21 | MockHsm.Key aliceKey = MockHsm.Key.create(aliceCore); |
| 22 | HsmSigner.addKey(aliceKey, MockHsm.getSignerClient(aliceCore)); |
| 23 | |
| 24 | MockHsm.Key bobKey = MockHsm.Key.create(bobCore); |
| 25 | HsmSigner.addKey(bobKey, MockHsm.getSignerClient(bobCore)); |
| 26 | |
| 27 | Asset aliceDollar = new Asset.Builder() |
| 28 | .setAlias("aliceDollar") |
| 29 | .addRootXpub(aliceDollarKey.xpub) |
| 30 | .setQuorum(1) |
| 31 | .create(aliceCore); |
| 32 | |
| 33 | Asset bobBuck = new Asset.Builder() |
| 34 | .setAlias("bobBuck") |
| 35 | .addRootXpub(bobBuckKey.xpub) |
| 36 | .setQuorum(1) |
| 37 | .create(bobCore); |
| 38 | |
| 39 | Account alice = new Account.Builder() |
| 40 | .setAlias("alice") |
| 41 | .addRootXpub(aliceKey.xpub) |
| 42 | .setQuorum(1) |
| 43 | .create(aliceCore); |
| 44 | |
| 45 | Account bob = new Account.Builder() |
| 46 | .setAlias("bob") |
| 47 | .addRootXpub(bobKey.xpub) |
| 48 | .setQuorum(1) |
| 49 | .create(bobCore); |
| 50 | |
| 51 | Transaction.submit(aliceCore, HsmSigner.sign(new Transaction.Builder() |
| 52 | .addAction(new Transaction.Action.Issue() |
| 53 | .setAssetAlias("aliceDollar") |
| 54 | .setAmount(1000) |
| 55 | ).addAction(new Transaction.Action.ControlWithAccount() |
| 56 | .setAccountAlias("alice") |
| 57 | .setAssetAlias("aliceDollar") |
| 58 | .setAmount(1000) |
| 59 | ).build(aliceCore) |
| 60 | )); |
| 61 | |
| 62 | Transaction.submit(bobCore, HsmSigner.sign(new Transaction.Builder() |
| 63 | .addAction(new Transaction.Action.Issue() |
| 64 | .setAssetAlias("bobBuck") |
| 65 | .setAmount(1000) |
| 66 | ).addAction(new Transaction.Action.ControlWithAccount() |
nothing calls this directly
no test coverage detected