forked from Qortal/qortal
Add extra entries to blockchain.json, remove HttpsTest, add Vanity Gen
+ minor whitespace / comment / JAXB mods Was commit e14381d: working on genesis block
This commit is contained in:
parent
57be191814
commit
29428e9450
@ -152,6 +152,12 @@
|
|||||||
{ "type": "GENESIS", "recipient": "QT79PhvBwE6vFzfZ4oh5wdKVsEazZuVJFy", "amount": "6360421.343" }
|
{ "type": "GENESIS", "recipient": "QT79PhvBwE6vFzfZ4oh5wdKVsEazZuVJFy", "amount": "6360421.343" }
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"rewardsByHeight": [
|
||||||
|
{ "height": 1, "reward": 0 }
|
||||||
|
],
|
||||||
|
"forgingTiers": [
|
||||||
|
{ "minBlocks": 0, "maxSubAccounts": 0 }
|
||||||
|
],
|
||||||
"featureTriggers": {
|
"featureTriggers": {
|
||||||
"messageHeight": 99000,
|
"messageHeight": 99000,
|
||||||
"atHeight": 99000,
|
"atHeight": 99000,
|
||||||
@ -159,6 +165,7 @@
|
|||||||
"votingTimestamp": "1403715600000",
|
"votingTimestamp": "1403715600000",
|
||||||
"arbitraryTimestamp": "1405702800000",
|
"arbitraryTimestamp": "1405702800000",
|
||||||
"powfixTimestamp": "1456426800000",
|
"powfixTimestamp": "1456426800000",
|
||||||
"v2Timestamp": "1559347200000"
|
"v2Timestamp": "1559347200000",
|
||||||
|
"newAssetPricingTimestamp": "2000000000000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,103 +0,0 @@
|
|||||||
package org.qora;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.MalformedURLException;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.StandardCopyOption;
|
|
||||||
import java.security.Security;
|
|
||||||
import java.util.Collections;
|
|
||||||
|
|
||||||
import javax.net.ssl.HttpsURLConnection;
|
|
||||||
import javax.net.ssl.SNIHostName;
|
|
||||||
import javax.net.ssl.SNIServerName;
|
|
||||||
import javax.net.ssl.SSLParameters;
|
|
||||||
import javax.net.ssl.SSLSocket;
|
|
||||||
|
|
||||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|
||||||
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
|
|
||||||
|
|
||||||
public class HttpsTest {
|
|
||||||
|
|
||||||
public static void main(String argv[]) throws IOException {
|
|
||||||
Security.insertProviderAt(new BouncyCastleProvider(), 0);
|
|
||||||
Security.insertProviderAt(new BouncyCastleJsseProvider(), 1);
|
|
||||||
|
|
||||||
final String uri = "https://github.com/bcgit/bc-java/raw/02d0a89fed488ca65de08afc955dfe7432af5f50/libs/activation.jar";
|
|
||||||
|
|
||||||
InputStream in = fetchStream(uri);
|
|
||||||
if (in == null) {
|
|
||||||
System.err.println(String.format("Failed to fetch from %s", uri));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Path tmpPath = null;
|
|
||||||
try {
|
|
||||||
// Save input stream into temporary file
|
|
||||||
tmpPath = Files.createTempFile(null, null);
|
|
||||||
Files.copy(in, tmpPath, StandardCopyOption.REPLACE_EXISTING);
|
|
||||||
} catch (IOException e) {
|
|
||||||
System.err.println(String.format("Failed to save %s", uri));
|
|
||||||
} finally {
|
|
||||||
if (tmpPath != null)
|
|
||||||
try {
|
|
||||||
Files.deleteIfExists(tmpPath);
|
|
||||||
} catch (IOException e) {
|
|
||||||
// We tried...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static InputStream fetchStream(String uri) throws IOException {
|
|
||||||
try {
|
|
||||||
URL url = new URL(uri);
|
|
||||||
HttpURLConnection con = (HttpURLConnection) url.openConnection();
|
|
||||||
|
|
||||||
con.setRequestMethod("GET");
|
|
||||||
con.setConnectTimeout(5000);
|
|
||||||
con.setReadTimeout(5000);
|
|
||||||
setConnectionSSL(con);
|
|
||||||
|
|
||||||
int status = con.getResponseCode();
|
|
||||||
|
|
||||||
if (status != 200)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return con.getInputStream();
|
|
||||||
} catch (MalformedURLException e) {
|
|
||||||
throw new RuntimeException("Malformed API request", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setConnectionSSL(HttpURLConnection con) {
|
|
||||||
if (!(con instanceof HttpsURLConnection))
|
|
||||||
return;
|
|
||||||
|
|
||||||
HttpsURLConnection httpsCon = (HttpsURLConnection) con;
|
|
||||||
URL url = con.getURL();
|
|
||||||
|
|
||||||
httpsCon.setSSLSocketFactory(new org.bouncycastle.jsse.util.CustomSSLSocketFactory(httpsCon.getSSLSocketFactory()) {
|
|
||||||
@Override
|
|
||||||
protected Socket configureSocket(Socket s) {
|
|
||||||
if (s instanceof SSLSocket) {
|
|
||||||
SSLSocket ssl = (SSLSocket) s;
|
|
||||||
|
|
||||||
SNIHostName sniHostName = new SNIHostName(url.getHost());
|
|
||||||
if (null != sniHostName) {
|
|
||||||
SSLParameters sslParameters = new SSLParameters();
|
|
||||||
|
|
||||||
sslParameters.setServerNames(Collections.<SNIServerName>singletonList(sniHostName));
|
|
||||||
ssl.setSSLParameters(sslParameters);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
37
src/main/java/org/qora/VanityGen.java
Normal file
37
src/main/java/org/qora/VanityGen.java
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
package org.qora;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.security.SecureRandom;
|
||||||
|
import java.security.Security;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||||
|
import org.bouncycastle.jsse.provider.BouncyCastleJsseProvider;
|
||||||
|
import org.qora.account.PrivateKeyAccount;
|
||||||
|
import org.qora.utils.Base58;
|
||||||
|
|
||||||
|
public class VanityGen {
|
||||||
|
|
||||||
|
public static void main(String argv[]) throws IOException {
|
||||||
|
if (argv.length != 1) {
|
||||||
|
System.err.println("Usage: Vanitygen <leading-chars>");
|
||||||
|
System.err.println("Example: VanityGen Qcat");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Security.insertProviderAt(new BouncyCastleProvider(), 0);
|
||||||
|
Security.insertProviderAt(new BouncyCastleJsseProvider(), 1);
|
||||||
|
|
||||||
|
Random random = new SecureRandom();
|
||||||
|
byte[] seed = new byte[32];
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
random.nextBytes(seed);
|
||||||
|
PrivateKeyAccount account = new PrivateKeyAccount(null, seed);
|
||||||
|
|
||||||
|
if (account.getAddress().startsWith(argv[0]))
|
||||||
|
System.out.println(String.format("Address: %s, public key: %s, private key: %s", account.getAddress(), Base58.encode(account.getPublicKey()), Base58.encode(seed)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -6,6 +6,7 @@ import javax.xml.bind.Unmarshaller;
|
|||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
|
|
||||||
|
import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue;
|
||||||
import org.qora.transaction.Transaction.TransactionType;
|
import org.qora.transaction.Transaction.TransactionType;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -13,13 +14,17 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
// All properties to be converted to JSON via JAXB
|
// All properties to be converted to JSON via JAXB
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@Schema(allOf = { TransactionData.class })
|
@Schema(allOf = { TransactionData.class })
|
||||||
|
// JAXB: use this subclass if XmlDiscriminatorNode matches XmlDiscriminatorValue below:
|
||||||
|
@XmlDiscriminatorValue("ADD_GROUP_ADMIN")
|
||||||
public class AddGroupAdminTransactionData extends TransactionData {
|
public class AddGroupAdminTransactionData extends TransactionData {
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
@Schema(description = "group owner's public key", example = "2tiMr5LTpaWCgbRvkPK8TFd7k63DyHJMMFFsz9uBf1ZP")
|
@Schema(description = "group owner's public key", example = "2tiMr5LTpaWCgbRvkPK8TFd7k63DyHJMMFFsz9uBf1ZP")
|
||||||
private byte[] ownerPublicKey;
|
private byte[] ownerPublicKey;
|
||||||
|
|
||||||
@Schema(description = "group ID")
|
@Schema(description = "group ID")
|
||||||
private int groupId;
|
private int groupId;
|
||||||
|
|
||||||
@Schema(description = "member to promote to admin", example = "QixPbJUwsaHsVEofJdozU9zgVqkK6aYhrK")
|
@Schema(description = "member to promote to admin", example = "QixPbJUwsaHsVEofJdozU9zgVqkK6aYhrK")
|
||||||
private String member;
|
private String member;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
|
import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue;
|
||||||
import org.qora.transaction.Transaction.TransactionType;
|
import org.qora.transaction.Transaction.TransactionType;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@ -14,6 +15,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
// All properties to be converted to JSON via JAXB
|
// All properties to be converted to JSON via JAXB
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@Schema(allOf = { TransactionData.class })
|
@Schema(allOf = { TransactionData.class })
|
||||||
|
// JAXB: use this subclass if XmlDiscriminatorNode matches XmlDiscriminatorValue below:
|
||||||
|
@XmlDiscriminatorValue("JOIN_GROUP")
|
||||||
public class JoinGroupTransactionData extends TransactionData {
|
public class JoinGroupTransactionData extends TransactionData {
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
|
@ -7,6 +7,7 @@ import javax.xml.bind.annotation.XmlAccessType;
|
|||||||
import javax.xml.bind.annotation.XmlAccessorType;
|
import javax.xml.bind.annotation.XmlAccessorType;
|
||||||
import javax.xml.bind.annotation.XmlTransient;
|
import javax.xml.bind.annotation.XmlTransient;
|
||||||
|
|
||||||
|
import org.eclipse.persistence.oxm.annotations.XmlDiscriminatorValue;
|
||||||
import org.qora.group.Group.ApprovalThreshold;
|
import org.qora.group.Group.ApprovalThreshold;
|
||||||
import org.qora.transaction.Transaction.TransactionType;
|
import org.qora.transaction.Transaction.TransactionType;
|
||||||
|
|
||||||
@ -14,11 +15,9 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
|
|
||||||
// All properties to be converted to JSON via JAXB
|
// All properties to be converted to JSON via JAXB
|
||||||
@XmlAccessorType(XmlAccessType.FIELD)
|
@XmlAccessorType(XmlAccessType.FIELD)
|
||||||
@Schema(
|
@Schema( allOf = { TransactionData.class } )
|
||||||
allOf = {
|
// JAXB: use this subclass if XmlDiscriminatorNode matches XmlDiscriminatorValue below:
|
||||||
TransactionData.class
|
@XmlDiscriminatorValue("UPDATE_GROUP")
|
||||||
}
|
|
||||||
)
|
|
||||||
public class UpdateGroupTransactionData extends TransactionData {
|
public class UpdateGroupTransactionData extends TransactionData {
|
||||||
|
|
||||||
// Properties
|
// Properties
|
||||||
@ -27,34 +26,42 @@ public class UpdateGroupTransactionData extends TransactionData {
|
|||||||
example = "2tiMr5LTpaWCgbRvkPK8TFd7k63DyHJMMFFsz9uBf1ZP"
|
example = "2tiMr5LTpaWCgbRvkPK8TFd7k63DyHJMMFFsz9uBf1ZP"
|
||||||
)
|
)
|
||||||
private byte[] ownerPublicKey;
|
private byte[] ownerPublicKey;
|
||||||
@Schema(
|
|
||||||
description = "new owner's address",
|
|
||||||
example = "QgV4s3xnzLhVBEJxcYui4u4q11yhUHsd9v"
|
|
||||||
)
|
|
||||||
private String newOwner;
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "which group to update",
|
description = "which group to update",
|
||||||
example = "my-group"
|
example = "my-group"
|
||||||
)
|
)
|
||||||
private int groupId;
|
private int groupId;
|
||||||
|
|
||||||
|
@Schema(
|
||||||
|
description = "new owner's address",
|
||||||
|
example = "QgV4s3xnzLhVBEJxcYui4u4q11yhUHsd9v"
|
||||||
|
)
|
||||||
|
private String newOwner;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "replacement group description",
|
description = "replacement group description",
|
||||||
example = "my group for accounts I like"
|
example = "my group for accounts I like"
|
||||||
)
|
)
|
||||||
private String newDescription;
|
private String newDescription;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "new group join policy",
|
description = "new group join policy",
|
||||||
example = "true"
|
example = "true"
|
||||||
)
|
)
|
||||||
private boolean newIsOpen;
|
private boolean newIsOpen;
|
||||||
|
|
||||||
@Schema(
|
@Schema(
|
||||||
description = "new group member transaction approval threshold"
|
description = "new group member transaction approval threshold"
|
||||||
)
|
)
|
||||||
private ApprovalThreshold newApprovalThreshold;
|
private ApprovalThreshold newApprovalThreshold;
|
||||||
|
|
||||||
@Schema(description = "new minimum block delay before approval takes effect")
|
@Schema(description = "new minimum block delay before approval takes effect")
|
||||||
private int newMinimumBlockDelay;
|
private int newMinimumBlockDelay;
|
||||||
|
|
||||||
@Schema(description = "new maximum block delay before which transaction approval must be reached")
|
@Schema(description = "new maximum block delay before which transaction approval must be reached")
|
||||||
private int newMaximumBlockDelay;
|
private int newMaximumBlockDelay;
|
||||||
|
|
||||||
/** Reference to CREATE_GROUP or UPDATE_GROUP transaction, used to rebuild group during orphaning. */
|
/** Reference to CREATE_GROUP or UPDATE_GROUP transaction, used to rebuild group during orphaning. */
|
||||||
// For internal use when orphaning
|
// For internal use when orphaning
|
||||||
@XmlTransient
|
@XmlTransient
|
||||||
|
Loading…
x
Reference in New Issue
Block a user