Skip to content

Instantly share code, notes, and snippets.

View Sajjon's full-sized avatar
💭
Principal Cryptography & Middleware Engineer | FOSS Author | Rust & Swift

Alexander Cyon Sajjon

💭
Principal Cryptography & Middleware Engineer | FOSS Author | Rust & Swift
View GitHub Profile
@Sajjon
Sajjon / geth_log.txt
Created August 24, 2022 17:15
Geth Syncing ended after having run `debug.setHead` and many `Unhandled trie error: missing trie node`
Imported new block headers count=1 elapsed=16.499ms number=15,404,115 hash=88ee20..fc9579
WARN [08-24|19:06:19.483] Unexpected trienode heal packet peer=e46f5a16 reqid=5,786,123,547,674,127,918
WARN [08-24|19:06:19.491] Unexpected bytecode heal packet peer=246fde5c reqid=793,928,132,157,719,426
INFO [08-24|19:06:20.875] State heal in progress accounts=112,795@5.87MiB slots=185,604@13.99MiB codes=170@1.32MiB nodes=1,097,071@299.94MiB pending=26422
WARN [08-24|19:06:20.875] Unexpected bytecode heal packet peer=774017fc reqid=4,273,106,156,886,874,214
WARN [08-24|19:06:25.107] Unexpected bytecode heal packet peer=1b9b4fd4 reqid=6,018,667,262,528,546,873
WARN [08-24|19:06:26.396] Unexpected trienode heal packet peer=4ce74c2f reqid=1,183,742,923,324,011,420
INFO [08-24|19:06:29.985] State heal in progress accounts=112,795@5.87MiB slots=185,976@14.01MiB codes=171@1.32MiB nodes=1,099,227@300.62M
@Sajjon
Sajjon / tokenBalancesWithTokenInfo.ts
Last active April 9, 2021 12:01
Token Balances with token Info
it('ownedBalanceOfToken', (done) => {
const subs = new Subscription()
const radix = Radix.create().__withAPI(mockedAPI)
const loadKeystore = (): Promise<KeystoreT> =>
Promise.resolve(keystoreForTest.keystore)
radix.login(keystoreForTest.password, loadKeystore)
@Sajjon
Sajjon / makeTxFlow.md
Created April 2, 2021 15:42
Make tx flow
  1. 🙋🏾‍♀️ userinputs transaction details (recipient, amount, token etc) and passes inputs to library.
  2. 💻 wallettransforms unsafe inputs into validated TransactionIntent.
  3. 🛠 libraryrequests Radix Core API to build transaction from intent and returns built transaction with human-readable fee to wallet.
  4. 🛠 librarysigns transaction
  5. 🛠 librarysubmits signed transaction to Radix Core API which promtly returns initial OK/ERR response, wallet handles this initial response. Response contains txID.
  6. OPTIONAL 💻 walletdisplays transaction fee and txID and waits for user to confirm transaction with PIN code.
  7. 🛠 libraryfinalizes signed transaction with txID to Radix Core API which promtly returns initial OK/ERR response, wallet handles this initial response.
  8. 💻 walletpolls status of transaction (using txID from step 5), using appropriate library api, and informs user of final CONFIRMED/REJECTED result.
  9. 🙋🏾‍♀️ useracts on any
@Sajjon
Sajjon / mockRadix.ts
Last active April 2, 2021 09:38
Mock Radix
Deprecated in favour of: https://github.com/radixdlt/radixdlt-javascript/blob/main/packages/application/test/mockRadix.ts
@Sajjon
Sajjon / radixTypeSneakPeak.ts
Last active March 18, 2021 13:40
Radix API sneakpeak
it('radix flow', async (done) => {
const subs = new Subscription()
const loadKeystoreFN = () => Promise.resolve(keystoreForTest.keystore)
const password = keystoreForTest.password
const walletResult = await Wallet.byLoadingAndDecryptingKeystore({
password,
load: loadKeystoreFN
})
@Sajjon
Sajjon / ChainableSolution1.ts
Created March 17, 2021 11:58
Chainable radix type first solution
const create = (): RadixT => {
/// REST OF METHOD OMITTED
// ...
// ...
// ...
/// REST OF METHOD OMITTED
const radix = {
// we forward the full `RadixAPI`, but we also provide some convenience methods based on active account/address.
...api,
@Sajjon
Sajjon / ChainableSolution2.ts
Last active March 17, 2021 11:56
Chainable radix type second solution
const create = (): RadixT => {
/// REST OF METHOD OMITTED
// ...
// ...
// ...
/// REST OF METHOD OMITTED
let radix: RadixT = (undefined as unknown) as RadixT
const connect = (url: URL): RadixT => {
@Sajjon
Sajjon / SimplerEncryption.swift
Last active February 3, 2021 11:20
ECIES Encryption now/simpler
import XCTest
@testable import RadixSDK
class SimplerEncryptionTests: TestCase {
private lazy var angelaMerkel = KeyPair()
private lazy var joeBiden = KeyPair()
private lazy var justinTrudeau = KeyPair()
@Sajjon
Sajjon / CBOREncodingParticlesTest.java
Created February 1, 2021 16:31
CBOREncodingParticlesTest.java
/*
* (C) Copyright 2020 Radix DLT Ltd
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the “Software”),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
@Sajjon
Sajjon / GetTransactionStatus.sh
Created December 21, 2020 08:40
Get status of Zilliqa transaction using command line interface and API: https://dev.zilliqa.com/docs/apis/api-transaction-get-transaction-status
curl -d '{
"id": "1",
"jsonrpc": "2.0",
"method": "GetTransactionStatus",
"params": ["<YOUR_TRANSACTION_HASH_WITHOUT_LEADING_0x_CHARS_GOES_HERE>"]
}' -H "Content-Type: application/json" -X POST "https://api.zilliqa.com/" | python -m json.tool