More work on QORT-BTC ACCT

Requires fix in CIYAM AT v1.3.2

New version of Qortal cross-trade AT code.

Change how Qortal addresses are managed in QortalATAPI from using
base58 strings (that are too long) to using hex form (25 bytes)
as they need to fix into 32 byte A/B register.

Generate AT addresses using DeployAtTransaction's signature instead
of convoluted hash of AT data like name, description, etc.

Add startTime as arg to GetTransaction test app.

Add missing fields (name, description, ATType, tags) to DeployAT test app.
This commit is contained in:
catbref
2020-04-08 18:10:24 +01:00
parent 7ded8954c6
commit 3eaeb927ec
10 changed files with 192 additions and 92 deletions

View File

@@ -129,8 +129,13 @@ public class DeployAT {
}
BigDecimal fee = BigDecimal.ZERO;
String name = "QORT-BTC cross-chain trade";
String description = String.format("Qortal-Bitcoin cross-chain trade between %s and %s", refundAccount.getAddress(), redeemAddress);
String atType = "ACCT";
String tags = "QORT-BTC ACCT";
BaseTransactionData baseTransactionData = new BaseTransactionData(txTimestamp, Group.NO_GROUP, lastReference, refundAccount.getPublicKey(), fee, null);
TransactionData deployAtTransactionData = new DeployAtTransactionData(baseTransactionData, "QORT-BTC", "QORT-BTC ACCT", "", "", creationBytes, qortAmount, Asset.QORT);
TransactionData deployAtTransactionData = new DeployAtTransactionData(baseTransactionData, name, description, atType, tags, creationBytes, qortAmount, Asset.QORT);
Transaction deployAtTransaction = new DeployAtTransaction(repository, deployAtTransactionData);

View File

@@ -22,32 +22,32 @@ public class GetTransaction {
if (error != null)
System.err.println(error);
System.err.println(String.format("usage: GetTransaction <bitcoin-tx>"));
System.err.println(String.format("example (mainnet): GetTransaction 816407e79568f165f13e09e9912c5f2243e0a23a007cec425acedc2e89284660"));
System.err.println(String.format("example (testnet): GetTransaction 3bfd17a492a4e3d6cb7204e17e20aca6c1ab82e1828bd1106eefbaf086fb8a4e"));
System.err.println(String.format("usage: GetTransaction <bitcoin-tx> <start-time>"));
System.err.println(String.format("example (mainnet): GetTransaction 816407e79568f165f13e09e9912c5f2243e0a23a007cec425acedc2e89284660 1585317000"));
System.err.println(String.format("example (testnet): GetTransaction 3bfd17a492a4e3d6cb7204e17e20aca6c1ab82e1828bd1106eefbaf086fb8a4e 1584376000"));
System.exit(1);
}
public static void main(String[] args) {
if (args.length < 1 || args.length > 1)
if (args.length < 2 || args.length > 2)
usage(null);
Security.insertProviderAt(new BouncyCastleProvider(), 0);
Settings.fileInstance("settings-test.json");
byte[] transactionId = null;
int startTime = 0;
try {
int argIndex = 0;
transactionId = HashCode.fromString(args[argIndex++]).asBytes();
startTime = Integer.parseInt(args[argIndex++]);
} catch (NumberFormatException | AddressFormatException e) {
usage(String.format("Argument format exception: %s", e.getMessage()));
}
// Chain replay start time
long startTime = (System.currentTimeMillis() / 1000L) - 14 * 24 * 60 * 60; // 14 days before now, in seconds
// Grab all outputs from transaction
List<TransactionOutput> fundingOutputs = BTC.getInstance().getOutputs(transactionId, startTime);
if (fundingOutputs == null) {