diff --git a/build.gradle b/build.gradle index f72bd0a..2c8ca33 100644 --- a/build.gradle +++ b/build.gradle @@ -2,9 +2,9 @@ import org.jlleitschuh.gradle.ktlint.reporter.ReporterType buildscript { ext.kotlin_version = '1.4.32' - ext.dashpay_version = '0.24-SNAPSHOT' - ext.dpp_version = '0.24-SNAPSHOT' - ext.dapi_client_version = '0.24-SNAPSHOT' + ext.dashpay_version = '0.25-SNAPSHOT' + ext.dpp_version = '0.25-SNAPSHOT' + ext.dapi_client_version = '0.25-SNAPSHOT' ext.dashj_version = '19.1-CJ-SNAPSHOT' repositories { mavenCentral() diff --git a/platform-core/build.gradle b/platform-core/build.gradle index a139869..38c06b3 100644 --- a/platform-core/build.gradle +++ b/platform-core/build.gradle @@ -19,6 +19,7 @@ dependencies { implementation "org.dashj.platform:dpp:$dpp_version" implementation "org.dashj.platform:dapi-client:$dapi_client_version" implementation "org.dashj:dashj-core:$dashj_version" + implementation 'org.dashj:manual:0.25-SNAPSHOT' implementation 'io.grpc:grpc-okhttp:1.54.0' // CURRENT_GRPC_VERSION implementation 'io.grpc:grpc-protobuf-lite:1.54.0' // CURRENT_GRPC_VERSION diff --git a/platform-core/src/main/jniLibs/libdashj_dpp_bindings.dylib b/platform-core/src/main/jniLibs/libdashj_dpp_bindings.dylib new file mode 100755 index 0000000..b49decf Binary files /dev/null and b/platform-core/src/main/jniLibs/libdashj_dpp_bindings.dylib differ diff --git a/platform-core/src/main/jniLibs/libdashjbls.dylib b/platform-core/src/main/jniLibs/libdashjbls.dylib new file mode 100755 index 0000000..d1a14f6 Binary files /dev/null and b/platform-core/src/main/jniLibs/libdashjbls.dylib differ diff --git a/platform-core/src/main/kotlin/org/dashj/platform/sdk/platform/Identities.kt b/platform-core/src/main/kotlin/org/dashj/platform/sdk/platform/Identities.kt index 9bb1ea1..c6c188b 100644 --- a/platform-core/src/main/kotlin/org/dashj/platform/sdk/platform/Identities.kt +++ b/platform-core/src/main/kotlin/org/dashj/platform/sdk/platform/Identities.kt @@ -10,12 +10,14 @@ import org.bitcoinj.core.ECKey import org.bitcoinj.core.Transaction import org.bitcoinj.evolution.CreditFundingTransaction import org.bitcoinj.quorums.InstantSendLock +import org.dashj.dpp.DPP import org.dashj.platform.dapiclient.errors.NotFoundException import org.dashj.platform.dpp.identifier.Identifier import org.dashj.platform.dpp.identity.ChainAssetLockProof import org.dashj.platform.dpp.identity.Identity import org.dashj.platform.dpp.identity.IdentityPublicKey import org.dashj.platform.dpp.identity.InstantAssetLockProof +import org.dashj.platform.dpp.toHex import org.slf4j.Logger import org.slf4j.LoggerFactory @@ -94,6 +96,10 @@ class Identities(val platform: Platform) { identityCreateTransition.signByPrivateKey(assetLockPrivateKey) + println("ST valid: ${DPP.validateIdentityCreateTransition(identityCreateTransition.toObject())}") + println("ST serialized ${DPP.serializeIdentityCreateTransition(identityCreateTransition.toObject()).toHex()}") + println("ST signable ${DPP.signableBytesIdentityCreateTransition(identityCreateTransition.toObject()).toHex()}}") + platform.broadcastStateTransition(identityCreateTransition) // get the identity from Platform since it cannot be recreated from the transition with the balance, etc diff --git a/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/IdentitiesTest.kt b/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/IdentitiesTest.kt index 3c322cc..fc9e2de 100644 --- a/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/IdentitiesTest.kt +++ b/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/IdentitiesTest.kt @@ -1,18 +1,17 @@ package org.dashj.platform.sdk.platform +import org.bitcoinj.core.ECKey import java.util.Date import org.bitcoinj.core.Transaction -import org.bitcoinj.wallet.DerivationPathFactory -import org.bitcoinj.wallet.DeterministicKeyChain -import org.bitcoinj.wallet.DeterministicSeed -import org.bitcoinj.wallet.KeyChainGroup -import org.bitcoinj.wallet.Wallet +import org.bitcoinj.wallet.* +import org.bitcoinj.wallet.authentication.AuthenticationGroupExtension import org.dashj.platform.dapiclient.model.DocumentQuery import org.dashj.platform.dpp.statetransition.StateTransitionFactory import org.dashj.platform.dpp.toHex import org.dashj.platform.dpp.util.Converters import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Test +import java.util.EnumSet class IdentitiesTest : PlatformNetwork() { @@ -31,7 +30,7 @@ class IdentitiesTest : PlatformNetwork() { @Test fun getIdentitiesTest() { - val pubKeyHash = wallet.blockchainIdentityKeyChain.getKey(0, true).pubKeyHash + val pubKeyHash = authenticationGroupExtension.identityKeyChain.getKey(0, true).pubKeyHash val results = platform.identities.getByPublicKeyHash(pubKeyHash) println(results!!.toJSON()) @@ -58,7 +57,9 @@ class IdentitiesTest : PlatformNetwork() { ) .build() ) - wallet.initializeAuthenticationKeyChains(wallet.keyChainSeed, null) + val authenticationGroupExtension = AuthenticationGroupExtension(wallet) + authenticationGroupExtension.addKeyChains(wallet.params, wallet.keyChainSeed, EnumSet.of(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING)) + wallet.addExtension(authenticationGroupExtension) val stateTransactionMap = Converters.fromHex("01000000a4647479706502697369676e6174757265584120c487a717e287581b498e6ce57a3fb8aaa243a890a971aef629b49607175a81317375cff370c285372e671713dbd508f6971cc65fea9be52b39ca1fb2ce5f837d6a7075626c69634b65797381a56269640064646174615821027ab03b55f24c3b5b66c2cc51f7efa0b97514b18eedb8dd3eccccfb276de5e2d564747970650067707572706f7365006d73656375726974794c6576656c006e61737365744c6f636b50726f6f66a46474797065006b696e7374616e744c6f636b58a501ed8bf70f95d1597fd3c911316c7719cded75bdce56870734ae0523065c633a4a00000000041d6353b4703d808ea1ac60fcc29b8b482a95829d84da39d909936cf14c470390bbcb7159e4a33e34d5e4e1e3f1ad6aaeb88d9b9fd2e406505b6d3a3b2197ab1bebe88d37964f55527581ee2193be0a085a12a5a2d6c94299594203ad2988bf5efd1b8e34f18a98580796668828117b27900dab84b48beaeac978ab4cf06f776b6f7574707574496e646578006b7472616e73616374696f6e58de0100000001ed8bf70f95d1597fd3c911316c7719cded75bdce56870734ae0523065c633a4a000000006a47304402206a57dda1bf6c66aca4d25959ff2a4450759496bfb0ce01d141a6ef09e4b8e5e90220322cd9ea02c9df5020e57f4224fb9fe856e266fe69576cb447bd75412201b98a0121032499905a363913995b704b4739e1e5a56944e9f6eb9a1ae2edc20daced90f6f4ffffffff0240420f0000000000166a1402b2cc99befd641784030f761e956cf290978af9fc858b3b000000001976a91478ce5f54af0929691c48b59bf526aa625d10b59988ac00000000") @@ -67,9 +68,9 @@ class IdentitiesTest : PlatformNetwork() { println(stateTransition) - val verified = stateTransition.verifySignatureByPublicKey(wallet.blockchainIdentityKeyChain.watchingKey) - val key = wallet.blockchainIdentityFundingKeyChain.freshAuthenticationKey(false) - val verified2 = stateTransition.verifySignatureByPublicKey(key) + val verified = stateTransition.verifySignatureByPublicKey(authenticationGroupExtension.identityKeyChain.getKey(0, true) as ECKey) + val key = authenticationGroupExtension.identityFundingKeyChain.freshAuthenticationKey() + val verified2 = stateTransition.verifySignatureByPublicKey(key as ECKey) println("verification: $verified, $verified2") val oldSignature = stateTransition.signature @@ -78,7 +79,7 @@ class IdentitiesTest : PlatformNetwork() { println("new sig - funding: ${stateTransition.signature!!.toHex()}") println("old sig - original: ${oldSignature!!.toHex()}") - stateTransition.signByPrivateKey(wallet.blockchainIdentityKeyChain.watchingKey) + stateTransition.signByPrivateKey(authenticationGroupExtension.identityKeyChain.getKey(0, true) as ECKey) println("new sig - identity: ${stateTransition.signature!!.toHex()}") } } diff --git a/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/PlatformNetwork.kt b/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/PlatformNetwork.kt index cd0386e..af5da50 100644 --- a/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/PlatformNetwork.kt +++ b/platform-core/src/test/kotlin/org/dashj/platform/sdk/platform/PlatformNetwork.kt @@ -1,12 +1,9 @@ package org.dashj.platform.sdk.platform -import java.util.Date import org.bitcoinj.params.OuzoDevNetParams -import org.bitcoinj.wallet.DerivationPathFactory -import org.bitcoinj.wallet.DeterministicKeyChain -import org.bitcoinj.wallet.DeterministicSeed -import org.bitcoinj.wallet.KeyChainGroup -import org.bitcoinj.wallet.Wallet +import org.bitcoinj.wallet.* +import org.bitcoinj.wallet.authentication.AuthenticationGroupExtension import org.junit.jupiter.api.AfterEach +import java.util.* open class PlatformNetwork { @@ -16,6 +13,7 @@ open class PlatformNetwork { val seed: String val wallet: Wallet + val authenticationGroupExtension: AuthenticationGroupExtension init { when { @@ -48,7 +46,9 @@ open class PlatformNetwork { ) .build() ) - wallet.initializeAuthenticationKeyChains(wallet.keyChainSeed, null) + authenticationGroupExtension = AuthenticationGroupExtension(wallet) + authenticationGroupExtension.addKeyChains(wallet.params, wallet.keyChainSeed, EnumSet.of(AuthenticationKeyChain.KeyChainType.BLOCKCHAIN_IDENTITY_FUNDING)) + wallet.addExtension(authenticationGroupExtension) } @AfterEach diff --git a/tools/src/main/java/org/dashj/platform/tools/WalletTool.java b/tools/src/main/java/org/dashj/platform/tools/WalletTool.java index 665053f..3277215 100644 --- a/tools/src/main/java/org/dashj/platform/tools/WalletTool.java +++ b/tools/src/main/java/org/dashj/platform/tools/WalletTool.java @@ -86,6 +86,7 @@ import org.bitcoinj.evolution.SimplifiedMasternodeList; import org.bitcoinj.evolution.SimplifiedMasternodeListEntry; import org.bitcoinj.net.discovery.ThreeMethodPeerDiscovery; +import org.bitcoinj.params.AbsintheDevNetParams; import org.bitcoinj.params.BinTangDevNetParams; import org.bitcoinj.params.MainNetParams; import org.bitcoinj.params.RegTestParams; @@ -408,8 +409,8 @@ public static void main(String[] args) throws Exception { chainFileName = new File("mainnet.spvchain"); break; case DEVNET: - params = BinTangDevNetParams.get(); - chainFileName = new File("bintang-devnet.spvchain"); + params = AbsintheDevNetParams.get(); + chainFileName = new File("absinthe.spvchain"); break; case TEST: params = TestNet3Params.get();