protocol icon indicating copy to clipboard operation
protocol copied to clipboard

Transaction example

Open andreivcodes opened this issue 4 years ago • 0 comments

Here is a detailed output of all the buffers during a transaction. This might be helpful for someone who wants to implement transactions in a wallet

Restarted application in 425ms.
flutter: >any bip39 library
flutter: >generate mnemonic
flutter: mnemonic: bus object report ask kind torch rule swamp observe crowd worry say
flutter: >get seed of mnemonic
flutter: Seed from mnemonic: [145, 185, 165, 25, 157, 154, 229, 127, 168, 252, 138, 212, 128, 138, 235, 13, 133, 145, 213, 72, 57, 162, 43, 123, 6, 32, 240, 28, 84, 138, 195, 17]
flutter: >Ed25519Lib.newDerivedKeyFromSeed(Uint8List.fromList(seed),Uint8List.fromList([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]),Uint8List.fromList(utf8.encode('Spacemesh blockmesh')));
flutter: privateKey bytes: 2e45f3bf151774762d01947ab550bec31ac9f852b7e70eebc9aee94ef3ce9fcdbedd6066b5fa9725f53e27381fc61195318e92d223521607b3e93f4ba8588c10
flutter: >Ed25519Lib.sign2(privateKey, dummyMessage);
flutter: derive public key from dummy message and signature: [200, 242, 219, 170, 34, 249, 111, 156, 243, 22, 106, 225, 76, 144, 179, 113, 247, 58, 114, 37, 173, 226, 115, 145, 84, 154, 159, 33, 209, 5, 91, 118, 141, 97, 15, 210, 69, 125, 103, 23, 143, 60, 232, 111, 186, 173, 127, 166, 134, 161, 192, 80, 248, 133, 169, 195, 129, 1, 36, 206, 252, 93, 110, 12]
flutter: >Ed25519Lib.extractPublicKey(dummyMessage, signature!);
flutter: publicKey bytes: bedd6066b5fa9725f53e27381fc61195318e92d223521607b3e93f4ba8588c10
flutter: >hex.encode(publicKeyList).substring(24)
flutter: address derived from publickey: 1fc61195318e92d223521607b3e93f4ba8588c10
flutter: create GlobalStateServiceClient grpc client
flutter: accountQueryId = new AccountId(address: privateKey.sublist(24));
flutter: accountQueryFilter = new AccountDataFilter(accountId: accountQueryId,accountDataFlags: AccountDataFlag.ACCOUNT_DATA_FLAG_ACCOUNT.value);
flutter: accountQuery = new AccountDataQueryRequest(filter: accountQueryFilter, maxResults: 1);
flutter: AccountDataQueryResponse accountQueryResponse = await accountClient.accountDataQuery(accountQuery);
flutter: accountQueryResponse: [accountWrapper: {
  accountId: {
    address: [31, 198, 17, 149, 49, 142, 146, 210, 35, 82, 22, 7, 179, 233, 63, 75, 168, 88, 140, 16]
  }
  stateCurrent: {
    counter: 4
    balance: {
      value: 999999999956
    }
  }
  stateProjected: {
    counter: 12
    balance: {
      value: 999999999861
    }
  }
}
]
flutter: accountNonce = accountQueryResponse.accountItem.first.accountWrapper.stateProjected.counter.toInt()
flutter: create TransactionServiceClient grpc client
flutter: recipient size: 20
flutter: >InnerTx(_accountNonce, _address, _gasLimit, _fee, _amount)
flutter: create inner transaction : [0, 0, 0, 0, 0, 0, 0, 12, 198, 76, 190, 17, 82, 89, 180, 221, 149, 2, 230, 31, 2, 218, 203, 212, 253, 91, 15, 76, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 11]
flutter: inner transaction size: 52
flutter: >Ed25519Lib.sign2(privateKey, Uint8List.fromList(unsignedOutStream));
flutter: create transaction signature: [142, 87, 68, 197, 219, 109, 61, 214, 238, 46, 237, 2, 230, 52, 96, 158, 79, 139, 90, 245, 196, 84, 132, 26, 221, 4, 95, 50, 251, 167, 62, 38, 237, 195, 125, 237, 225, 75, 67, 69, 212, 77, 161, 118, 127, 175, 105, 210, 95, 218, 11, 91, 36, 46, 174, 122, 120, 93, 175, 254, 217, 185, 123, 9]
flutter: signature size: 64
flutter: origin length: 20
flutter: origin: [179, 233, 63, 75, 168, 88, 140, 16]
flutter: >_hashTxId is sha256 over _innerTransactionStream + _signature + _origin
flutter: >OuterTx(_innerTransactionStream, _signature, _origin, _hashTxId)
flutter: create outer transaction packet: [0, 0, 0, 0, 0, 0, 0, 12, 198, 76, 190, 17, 82, 89, 180, 221, 149, 2, 230, 31, 2, 218, 203, 212, 253, 91, 15, 76, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 11, 142, 87, 68, 197, 219, 109, 61, 214, 238, 46, 237, 2, 230, 52, 96, 158, 79, 139, 90, 245, 196, 84, 132, 26, 221, 4, 95, 50, 251, 167, 62, 38, 237, 195, 125, 237, 225, 75, 67, 69, 212, 77, 161, 118, 127, 175, 105, 210, 95, 218, 11, 91, 36, 46, 174, 122, 120, 93, 175, 254, 217, 185, 123, 9, 201, 174, 233, 78, 243, 206, 159, 205, 190, 221, 96, 102, 181, 250, 151, 37, 245, 62, 39, 56, 31, 198, 17, 149, 49, 142, 146, 210, 35, 82, 22, 7, 179, 233, 63, 75, 168, 88, 140, 16, 242, 92, 107, 193, 117, 116, 142, 112, 2, 44, 58, 127, 165, 226, 203, 165, 32, 93, 143, 172, 215, 222, 255, 36, 187, 80, 248, 223, 214, 70, 177, 163]
flutter: outer transaction packet size: 188
flutter: sent grpc transaction request


andreivcodes avatar Jun 01 '21 22:06 andreivcodes