Browse Source

Removing unsupported stuff and building based on service.proto from our lightwalletd

main
fekt 2 years ago
parent
commit
0b24b41c6e
  1. 4
      darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt
  2. 4
      demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt
  3. 2
      demo-app/src/zcashmainnet/java/cash/z/ecc/android/sdk/demoapp/DemoConstants.kt
  4. 2
      sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/SanityTest.kt
  5. 4
      sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt
  6. 2
      sdk-lib/src/androidTest/res/values/bools.xml
  7. 25
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt
  8. 12
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt
  9. 4
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt
  10. 14
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/service/LightWalletGrpcService.kt
  11. 4
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/service/LightWalletService.kt
  12. 2
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/PersistentTransactionManager.kt
  13. 2
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/TransactionEncoder.kt
  14. 2
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/TransactionManager.kt
  15. 2
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/WalletTransactionEncoder.kt
  16. 6
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/jni/RustBackend.kt
  17. 4
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/jni/RustBackendWelding.kt
  18. 4
      sdk-lib/src/main/java/cash/z/ecc/android/sdk/type/WalletTypes.kt
  19. 172
      sdk-lib/src/main/proto/service.proto
  20. 2
      sdk-lib/src/main/res/values/bools.xml

4
darkside-test-lib/src/androidTest/java/cash/z/ecc/android/sdk/darkside/test/TestWallet.kt

@ -80,10 +80,12 @@ class TestWallet(
val networkName get() = synchronizer.network.networkName
val connectionInfo get() = service.connectionInfo.toString()
/* NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun transparentBalance(): WalletBalance {
synchronizer.refreshUtxos(transparentAddress, synchronizer.latestBirthdayHeight)
return synchronizer.getTransparentBalance(transparentAddress)
}
*/
suspend fun sync(timeout: Long = -1): TestWallet {
val killSwitch = walletScope.launch {
@ -122,6 +124,7 @@ class TestWallet(
return this
}
/* NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun shieldFunds(): TestWallet {
twig("checking $transparentAddress for transactions!")
synchronizer.refreshUtxos(transparentAddress, 935000).let { count ->
@ -141,6 +144,7 @@ class TestWallet(
return this
}
*/
suspend fun join(timeout: Long? = null): TestWallet {
// block until stopped

4
demo-app/src/main/java/cash/z/ecc/android/sdk/demoapp/demos/listutxos/ListUtxosFragment.kt

@ -82,12 +82,13 @@ class ListUtxosFragment : BaseDemoFragment<FragmentListUtxosBinding>() {
binding.buttonLoad.setOnClickListener {
mainActivity()?.hideKeyboard()
downloadTransactions()
//downloadTransactions()
}
initTransactionUi()
}
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
fun downloadTransactions() {
binding.textStatus.text = "loading..."
binding.textStatus.post {
@ -135,6 +136,7 @@ class ListUtxosFragment : BaseDemoFragment<FragmentListUtxosBinding>() {
}
}
}
*/
private val now get() = System.currentTimeMillis()

2
demo-app/src/zcashmainnet/java/cash/z/ecc/android/sdk/demoapp/DemoConstants.kt

@ -1,7 +1,7 @@
package cash.z.ecc.android.sdk.demoapp
object DemoConstants {
val utxoEndHeight: Int = 968085
val utxoEndHeight: Int = 950000
val sendAmount: Double = 0.000018
// corresponds to address: zs15tzaulx5weua5c7l47l4pku2pw9fzwvvnsp4y80jdpul0y3nwn5zp7tmkcclqaca3mdjqjkl7hx

2
sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/integration/SanityTest.kt

@ -83,7 +83,7 @@ class SanityTest(
fun testServerConnection() {
assertEquals(
"$name has an invalid server connection",
"$networkName.lightwalletd.com:9067?usePlaintext=false",
"$networkName.lite.hushpool.is:9067?usePlaintext=true",
wallet.connectionInfo
)
}

4
sdk-lib/src/androidTest/java/cash/z/ecc/android/sdk/util/TestWallet.kt

@ -80,10 +80,12 @@ class TestWallet(
val networkName get() = synchronizer.network.networkName
val connectionInfo get() = service.connectionInfo.toString()
/* NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun transparentBalance(): WalletBalance {
synchronizer.refreshUtxos(transparentAddress, synchronizer.latestBirthdayHeight)
return synchronizer.getTransparentBalance(transparentAddress)
}
*/
suspend fun sync(timeout: Long = -1): TestWallet {
val killSwitch = walletScope.launch {
@ -122,6 +124,7 @@ class TestWallet(
return this
}
/* NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun shieldFunds(): TestWallet {
twig("checking $transparentAddress for transactions!")
synchronizer.refreshUtxos(transparentAddress, 935000).let { count ->
@ -141,6 +144,7 @@ class TestWallet(
return this
}
*/
suspend fun join(timeout: Long? = null): TestWallet {
// block until stopped

2
sdk-lib/src/androidTest/res/values/bools.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="lightwalletd_allow_very_insecure_connections">false</bool>
<bool name="lightwalletd_allow_very_insecure_connections">true</bool>
</resources>

25
sdk-lib/src/main/java/cash/z/ecc/android/sdk/SdkSynchronizer.kt

@ -95,6 +95,7 @@ import kotlin.coroutines.EmptyCoroutineContext
*/
@ExperimentalCoroutinesApi
@FlowPreview
class SdkSynchronizer internal constructor(
private val storage: TransactionRepository,
private val txManager: OutboundTransactionManager,
@ -102,9 +103,9 @@ class SdkSynchronizer internal constructor(
) : Synchronizer {
// pools
private val _orchardBalances = MutableStateFlow<WalletBalance?>(null)
//private val _orchardBalances = MutableStateFlow<WalletBalance?>(null)
private val _saplingBalances = MutableStateFlow<WalletBalance?>(null)
private val _transparentBalances = MutableStateFlow<WalletBalance?>(null)
//private val _transparentBalances = MutableStateFlow<WalletBalance?>(null)
private val _status = ConflatedBroadcastChannel<Synchronizer.Status>(DISCONNECTED)
@ -143,9 +144,9 @@ class SdkSynchronizer internal constructor(
// Balances
//
override val orchardBalances = _orchardBalances.asStateFlow()
//override val orchardBalances = _orchardBalances.asStateFlow()
override val saplingBalances = _saplingBalances.asStateFlow()
override val transparentBalances = _transparentBalances.asStateFlow()
//override val transparentBalances = _transparentBalances.asStateFlow()
//
// Transactions
@ -355,10 +356,12 @@ class SdkSynchronizer internal constructor(
// Private API
//
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun refreshUtxos() {
twig("refreshing utxos", -1)
refreshUtxos(getTransparentAddress())
}
*/
/**
* Calculate the latest balance, based on the blocks that have been scanned and transmit this
@ -366,7 +369,7 @@ class SdkSynchronizer internal constructor(
*/
suspend fun refreshAllBalances() {
refreshSaplingBalance()
refreshTransparentBalance()
// refreshTransparentBalance()
// TODO: refresh orchard balance
twig("Warning: Orchard balance does not yet refresh. Only some of the plumbing is in place.")
}
@ -376,11 +379,14 @@ class SdkSynchronizer internal constructor(
_saplingBalances.value = processor.getBalanceInfo()
}
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun refreshTransparentBalance() {
twig("refreshing transparent balance")
_transparentBalances.value = processor.getUtxoCacheBalance(getTransparentAddress())
}
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun isValidAddress(address: String): Boolean {
try {
return !validateAddress(address).isNotValid
@ -388,6 +394,7 @@ class SdkSynchronizer internal constructor(
}
return false
}
*/
private fun CoroutineScope.onReady() = launch(CoroutineExceptionHandler(::onCriticalError)) {
twig("Preparing to start...")
@ -516,7 +523,7 @@ class SdkSynchronizer internal constructor(
// balance refresh is complete.
if (shouldRefresh) {
twigTask("Triggering utxo refresh since $reason!", -1) {
refreshUtxos()
//refreshUtxos()
}
twigTask("Triggering balance refresh since $reason!", -1) {
refreshAllBalances()
@ -694,17 +701,22 @@ class SdkSynchronizer internal constructor(
txManager.monitorById(it.id)
}.distinctUntilChanged()
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override suspend fun refreshUtxos(address: String, startHeight: Int): Int? {
return processor.refreshUtxos(address, startHeight)
}
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override suspend fun getTransparentBalance(tAddr: String): WalletBalance {
return processor.getUtxoCacheBalance(tAddr)
}
*/
override suspend fun isValidShieldedAddr(address: String) =
txManager.isValidShieldedAddress(address)
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override suspend fun isValidTransparentAddr(address: String) =
txManager.isValidTransparentAddress(address)
@ -725,6 +737,7 @@ class SdkSynchronizer internal constructor(
}
}
}
*/
override suspend fun validateConsensusBranch(): ConsensusMatchType {
val serverBranchId = tryNull { processor.downloader.getServerInfo().consensusBranchId }

12
sdk-lib/src/main/java/cash/z/ecc/android/sdk/Synchronizer.kt

@ -103,7 +103,7 @@ interface Synchronizer {
/**
* A stream of balance values for the orchard pool. Includes the available and total balance.
*/
val orchardBalances: StateFlow<WalletBalance?>
//val orchardBalances: StateFlow<WalletBalance?>
/**
* A stream of balance values for the sapling pool. Includes the available and total balance.
@ -113,7 +113,7 @@ interface Synchronizer {
/**
* A stream of balance values for the transparent pool. Includes the available and total balance.
*/
val transparentBalances: StateFlow<WalletBalance?>
//val transparentBalances: StateFlow<WalletBalance?>
/* Transactions */
@ -238,7 +238,9 @@ interface Synchronizer {
*
* @throws RuntimeException when the address is invalid.
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun isValidTransparentAddr(address: String): Boolean
*/
/**
* Validate whether the server and this SDK share the same consensus branch. This is
@ -264,7 +266,9 @@ interface Synchronizer {
*
* @return an instance of [AddressType] providing validation info regarding the given address.
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun validateAddress(address: String): AddressType
*/
/**
* Attempts to cancel a transaction that is about to be sent. Typically, cancellation is only
@ -300,15 +304,19 @@ interface Synchronizer {
*
* @return the number of utxos that were downloaded and addded to the UTXO table.
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun refreshUtxos(
tAddr: String,
sinceHeight: Int = network.saplingActivationHeight
): Int?
*/
/**
* Returns the balance that the wallet knows about. This should be called after [refreshUtxos].
*/
/* THIS IS NOT SUPPORT IN HUSH LIGHTWALLETD
suspend fun getTransparentBalance(tAddr: String): WalletBalance
*/
suspend fun getNearestRewindHeight(height: Int): Int

4
sdk-lib/src/main/java/cash/z/ecc/android/sdk/block/CompactBlockProcessor.kt

@ -425,6 +425,7 @@ class CompactBlockProcessor(
}
}
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
var failedUtxoFetches = 0
internal suspend fun refreshUtxos(tAddress: String, startHeight: Int): Int? = withContext(IO) {
var count: Int? = null
@ -446,7 +447,9 @@ class CompactBlockProcessor(
}
count
}
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
internal suspend fun processUtxoResult(result: List<Service.GetAddressUtxosReply>, tAddress: String, startHeight: Int): Int = withContext(IO) {
var skipped = 0
val aboveHeight = startHeight - 1
@ -473,6 +476,7 @@ class CompactBlockProcessor(
// return the number of UTXOs that were downloaded
result.size - skipped
}
*/
/**
* Request all blocks in the given range and persist them locally for processing, later.

14
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/service/LightWalletGrpcService.kt

@ -40,7 +40,7 @@ class LightWalletGrpcService private constructor(
network: ZcashNetwork,
usePlaintext: Boolean =
appContext.resources.getBoolean(R.bool.lightwalletd_allow_very_insecure_connections)
) : this(appContext, network.defaultHost, network.defaultPort, usePlaintext)
) : this(appContext, network.defaultHost, network.defaultPort, true)
/**
* Construct an instance that corresponds to the given host and port.
@ -58,8 +58,8 @@ class LightWalletGrpcService private constructor(
port: Int = ZcashNetwork.Mainnet.defaultPort,
usePlaintext: Boolean =
appContext.resources.getBoolean(R.bool.lightwalletd_allow_very_insecure_connections)
) : this(createDefaultChannel(appContext, host, port, usePlaintext)) {
connectionInfo = ConnectionInfo(appContext.applicationContext, host, port, usePlaintext)
) : this(createDefaultChannel(appContext, host, port, true)) {
connectionInfo = ConnectionInfo(appContext.applicationContext, host, port, true)
}
/* LightWalletService implementation */
@ -109,6 +109,7 @@ class LightWalletGrpcService private constructor(
)
}
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override fun fetchUtxos(
tAddress: String,
startHeight: Int
@ -119,7 +120,9 @@ class LightWalletGrpcService private constructor(
)
return result.addressUtxosList
}
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override fun getTAddressTransactions(
tAddress: String,
blockHeightRange: IntRange
@ -132,6 +135,7 @@ class LightWalletGrpcService private constructor(
)
return result.toList()
}
*/
override fun reconnect() {
twig(
@ -143,7 +147,7 @@ class LightWalletGrpcService private constructor(
connectionInfo.appContext,
connectionInfo.host,
connectionInfo.port,
connectionInfo.usePlaintext
true
)
}
@ -195,7 +199,7 @@ class LightWalletGrpcService private constructor(
val usePlaintext: Boolean
) {
override fun toString(): String {
return "$host:$port?usePlaintext=$usePlaintext"
return "$host:$port?usePlaintext=true"
}
}

4
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/service/LightWalletService.kt

@ -24,7 +24,9 @@ interface LightWalletService {
*
* @return the UTXOs for the given address from the startHeight.
*/
/* THIS IS NOT SUPPORT IN HUSH LIGHTWALLETD
fun fetchUtxos(tAddress: String, startHeight: Int): List<Service.GetAddressUtxosReply>
*/
/**
* Return the given range of blocks.
@ -70,7 +72,9 @@ interface LightWalletService {
*
* @return a list of transactions that correspond to the given address for the given range.
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
fun getTAddressTransactions(tAddress: String, blockHeightRange: IntRange): List<Service.RawTransaction>
*/
/**
* Reconnect to the same or a different server. This is useful when the connection is

2
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/PersistentTransactionManager.kt

@ -230,8 +230,10 @@ class PersistentTransactionManager(
override suspend fun isValidShieldedAddress(address: String) =
encoder.isValidShieldedAddress(address)
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override suspend fun isValidTransparentAddress(address: String) =
encoder.isValidTransparentAddress(address)
*/
override suspend fun cancel(pendingId: Long): Boolean {
return pendingTransactionDao {

2
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/TransactionEncoder.kt

@ -48,7 +48,9 @@ interface TransactionEncoder {
*
* @return true when the given address is a valid t-addr
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun isValidTransparentAddress(address: String): Boolean
*/
/**
* Return the consensus branch that the encoder is using when making transactions.

2
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/TransactionManager.kt

@ -94,7 +94,9 @@ interface OutboundTransactionManager {
*
* @return true when the given address is a valid z-addr.
*/
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
suspend fun isValidTransparentAddress(address: String): Boolean
*/
/**
* Attempt to cancel a transaction.

2
sdk-lib/src/main/java/cash/z/ecc/android/sdk/internal/transaction/WalletTransactionEncoder.kt

@ -77,8 +77,10 @@ class WalletTransactionEncoder(
*
* @return true when the given address is a valid t-addr
*/
/* THIS IS NOT SUPPORTED BY HUSH LIGHTWALLETD
override suspend fun isValidTransparentAddress(address: String): Boolean =
rustBackend.isValidTransparentAddr(address)
*/
override suspend fun getConsensusBranchId(): Long {
val height = repository.lastScannedHeight()

6
sdk-lib/src/main/java/cash/z/ecc/android/sdk/jni/RustBackend.kt

@ -110,9 +110,11 @@ class RustBackend private constructor() : RustBackendWelding {
)
}
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override suspend fun getTransparentAddress(account: Int, index: Int): String {
throw NotImplementedError("TODO: implement this at the zcash_client_sqlite level. But for now, use DerivationTool, instead to derive addresses from seeds")
}
*/
override suspend fun getBalance(account: Int): Zatoshi {
val longValue = withContext(SdkDispatchers.DATABASE_IO) {
@ -311,8 +313,10 @@ class RustBackend private constructor() : RustBackendWelding {
override fun isValidShieldedAddr(addr: String) =
isValidShieldedAddress(addr, networkId = network.id)
/* THIS IS NOT SUPPORTED IN HUSH LIGHTWALLETD
override fun isValidTransparentAddr(addr: String) =
isValidTransparentAddress(addr, networkId = network.id)
*/
override fun getBranchIdForHeight(height: Int): Long =
branchIdForHeight(height, networkId = network.id)
@ -413,8 +417,10 @@ class RustBackend private constructor() : RustBackendWelding {
@JvmStatic
private external fun isValidShieldedAddress(addr: String, networkId: Int): Boolean
/* THIS IS NOT SUPPORT IN HUSH LIGHTWALLETD
@JvmStatic
private external fun isValidTransparentAddress(addr: String, networkId: Int): Boolean
*/
@JvmStatic
private external fun getBalance(dbDataPath: String, account: Int, networkId: Int): Long

4
sdk-lib/src/main/java/cash/z/ecc/android/sdk/jni/RustBackendWelding.kt

@ -42,11 +42,11 @@ interface RustBackendWelding {
fun isValidShieldedAddr(addr: String): Boolean
fun isValidTransparentAddr(addr: String): Boolean
//fun isValidTransparentAddr(addr: String): Boolean
suspend fun getShieldedAddress(account: Int = 0): String
suspend fun getTransparentAddress(account: Int = 0, index: Int = 0): String
//suspend fun getTransparentAddress(account: Int = 0, index: Int = 0): String
suspend fun getBalance(account: Int = 0): Zatoshi

4
sdk-lib/src/main/java/cash/z/ecc/android/sdk/type/WalletTypes.kt

@ -78,8 +78,8 @@ enum class ZcashNetwork(
val defaultHost: String,
val defaultPort: Int
) {
Testnet(0, "testnet", 280_000, "testnet.lightwalletd.com", 9067),
Mainnet(1, "mainnet", 419_200, "mainnet.lightwalletd.com", 9067);
Testnet(0, "testnet", 995_000, "lite.hushpool.is", 9067),
Mainnet(1, "mainnet", 995_000, "lite.hushpool.is", 9067);
companion object {
fun from(id: Int) = values().first { it.id == id }

172
sdk-lib/src/main/proto/service.proto

@ -1,22 +1,19 @@
// Copyright (c) 2019-2020 The Zcash developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php .
syntax = "proto3";
package cash.z.wallet.sdk.rpc;
option go_package = ".;walletrpc";
option swift_prefix = "";
option go_package = "walletrpc";
import "compact_formats.proto";
// A BlockID message contains identifiers to select a block: a height or a
// hash. Specification by hash is not implemented, but may be in the future.
// hash. If the hash is present it takes precedence.
message BlockID {
uint64 height = 1;
bytes hash = 2;
uint64 height = 1;
bytes hash = 2;
}
// BlockRange specifies a series of blocks from start to end inclusive.
// Both BlockIDs must be heights; specification by hash is not yet supported.
// BlockRange technically allows ranging from hash to hash etc but this is not
// currently intended for support, though there is no reason you couldn't do
// it. Further permutations are left as an exercise.
message BlockRange {
BlockID start = 1;
BlockID end = 2;
@ -24,154 +21,73 @@ message BlockRange {
// A TxFilter contains the information needed to identify a particular
// transaction: either a block and an index, or a direct transaction hash.
// Currently, only specification by hash is supported.
message TxFilter {
BlockID block = 1; // block identifier, height or hash
uint64 index = 2; // index within the block
bytes hash = 3; // transaction ID (hash, txid)
BlockID block = 1;
uint64 index = 2;
bytes hash = 3;
}
// RawTransaction contains the complete transaction data. It also optionally includes
// the block height in which the transaction was included.
// RawTransaction contains the complete transaction data. It also optionally includes
// the block height in which the transaction was included
message RawTransaction {
bytes data = 1; // exact data returned by Zcash 'getrawtransaction'
uint64 height = 2; // height that the transaction was mined (or -1)
bytes data = 1;
uint64 height = 2;
}
// A SendResponse encodes an error code and a string. It is currently used
// only by SendTransaction(). If error code is zero, the operation was
// successful; if non-zero, it and the message specify the failure.
message SendResponse {
int32 errorCode = 1;
string errorMessage = 2;
}
// Chainspec is a placeholder to allow specification of a particular chain fork.
// Empty placeholder. Someday we may want to specify e.g. a particular chain fork.
message ChainSpec {}
// Empty is for gRPCs that take no arguments, currently only GetLightdInfo.
message Empty {}
// LightdInfo returns various information about this lightwalletd instance
// and the state of the blockchain.
message LightdInfo {
string version = 1;
string vendor = 2;
bool taddrSupport = 3; // true
string chainName = 4; // either "main" or "test"
uint64 saplingActivationHeight = 5; // depends on mainnet or testnet
string consensusBranchId = 6; // protocol identifier, see consensus/upgrades.cpp
uint64 blockHeight = 7; // latest block on the best chain
string gitCommit = 8;
string branch = 9;
string buildDate = 10;
string buildUser = 11;
uint64 estimatedHeight = 12; // less than tip height if zcashd is syncing
string zcashdBuild = 13; // example: "v4.1.1-877212414"
string zcashdSubversion = 14; // example: "/MagicBean:4.1.1/"
}
// TransparentAddressBlockFilter restricts the results to the given address
// or block range.
message TransparentAddressBlockFilter {
string address = 1; // t-address
BlockRange range = 2; // start, end heights
}
// Duration is currently used only for testing, so that the Ping rpc
// can simulate a delay, to create many simultaneous connections. Units
// are microseconds.
message Duration {
int64 intervalUs = 1;
}
// PingResponse is used to indicate concurrency, how many Ping rpcs
// are executing upon entry and upon exit (after the delay).
// This rpc is used for testing only.
message PingResponse {
int64 entry = 1;
int64 exit = 2;
}
message Address {
bool taddrSupport = 3;
string chainName = 4;
uint64 saplingActivationHeight = 5;
string consensusBranchId = 6; // This should really be u32 or []byte, but string for readability
uint64 blockHeight = 7;
uint64 difficulty = 8;
uint64 longestchain = 9;
uint64 notarized = 10;
}
message Coinsupply {
string result = 1;
string coin = 2;
uint64 height = 3;
uint64 supply = 4;
uint64 zfunds = 5;
uint64 total = 6;
}
message TransparentAddress {
string address = 1;
}
message AddressList {
repeated string addresses = 1;
}
message Balance {
int64 valueZat = 1;
}
message Exclude {
repeated bytes txid = 1;
}
// The TreeState is derived from the Zcash z_gettreestate rpc.
message TreeState {
string network = 1; // "main" or "test"
uint64 height = 2;
string hash = 3; // block id
uint32 time = 4; // Unix epoch time when the block was mined
string tree = 5; // sapling commitment tree state
}
message GetAddressUtxosArg {
message TransparentAddressBlockFilter {
string address = 1;
uint64 startHeight = 2;
uint32 maxEntries = 3; // zero means unlimited
}
message GetAddressUtxosReply {
bytes txid = 1;
int32 index = 2;
bytes script = 3;
int64 valueZat = 4;
uint64 height = 5;
}
message GetAddressUtxosReplyList {
repeated GetAddressUtxosReply addressUtxos = 1;
BlockRange range = 2;
}
service CompactTxStreamer {
// Return the height of the tip of the best chain
// Compact Blocks
rpc GetLatestBlock(ChainSpec) returns (BlockID) {}
// Return the compact block corresponding to the given block identifier
rpc GetBlock(BlockID) returns (CompactBlock) {}
// Return a list of consecutive compact blocks
rpc GetBlockRange(BlockRange) returns (stream CompactBlock) {}
// Return the requested full (not compact) transaction (as from zcashd)
// Transactions
rpc GetTransaction(TxFilter) returns (RawTransaction) {}
// Submit the given transaction to the Zcash network
rpc SendTransaction(RawTransaction) returns (SendResponse) {}
// Return the txids corresponding to the given t-address within the given block range
rpc GetTaddressTxids(TransparentAddressBlockFilter) returns (stream RawTransaction) {}
rpc GetTaddressBalance(AddressList) returns (Balance) {}
rpc GetTaddressBalanceStream(stream Address) returns (Balance) {}
// Return the compact transactions currently in the mempool; the results
// can be a few seconds out of date. If the Exclude list is empty, return
// all transactions; otherwise return all *except* those in the Exclude list
// (if any); this allows the client to avoid receiving transactions that it
// already has (from an earlier call to this rpc). The transaction IDs in the
// Exclude list can be shortened to any number of bytes to make the request
// more bandwidth-efficient; if two or more transactions in the mempool
// match a shortened txid, they are all sent (none is excluded). Transactions
// in the exclude list that don't exist in the mempool are ignored.
rpc GetMempoolTx(Exclude) returns (stream CompactTx) {}
// t-Address support
rpc GetAddressTxids(TransparentAddressBlockFilter) returns (stream RawTransaction) {}
// GetTreeState returns the note commitment tree state corresponding to the given block.
// See section 3.7 of the Zcash protocol specification. It returns several other useful
// values also (even though they can be obtained using GetBlock).
// The block can be specified by either height or hash.
rpc GetTreeState(BlockID) returns (TreeState) {}
rpc GetAddressUtxos(GetAddressUtxosArg) returns (GetAddressUtxosReplyList) {}
rpc GetAddressUtxosStream(GetAddressUtxosArg) returns (stream GetAddressUtxosReply) {}
// Return information about this lightwalletd instance and the blockchain
// Misc
rpc GetLightdInfo(Empty) returns (LightdInfo) {}
// Testing-only
rpc Ping(Duration) returns (PingResponse) {}
}
rpc GetCoinsupply(Empty) returns (Coinsupply) {}
}

2
sdk-lib/src/main/res/values/bools.xml

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<bool name="lightwalletd_allow_very_insecure_connections">false</bool>
<bool name="lightwalletd_allow_very_insecure_connections">true</bool>
</resources>

Loading…
Cancel
Save