public WabiSabiCoordinator(CoordinatorParameters parameters, IRPCClient rpc, ICoinJoinIdStore coinJoinIdStore) { Parameters = parameters; Warden = new(parameters.UtxoWardenPeriod, parameters.PrisonFilePath, Config); ConfigWatcher = new(parameters.ConfigChangeMonitoringPeriod, Config, () => Logger.LogInfo("WabiSabi configuration has changed.")); CoinJoinIdStore = coinJoinIdStore; CoinJoinTransactionArchiver transactionArchiver = new(Path.Combine(parameters.CoordinatorDataDir, "CoinJoinTransactions")); CoinJoinFeeRateStatStore = CoinJoinFeeRateStatStore.LoadFromFile(parameters.CoinJoinFeeRateStatStoreFilePath, Config, rpc); IoHelpers.EnsureContainingDirectoryExists(Parameters.CoinJoinFeeRateStatStoreFilePath); CoinJoinFeeRateStatStore.NewStat += FeeRateStatStore_NewStat; var coinJoinScriptStore = CoinJoinScriptStore.LoadFromFile(parameters.CoinJoinScriptStoreFilePath); IoHelpers.EnsureContainingDirectoryExists(Parameters.CoinJoinScriptStoreFilePath); RoundParameterFactory roundParameterFactory = new RoundParameterFactory(Config, rpc.Network); Arena = new( parameters.RoundProgressSteppingPeriod, rpc.Network, Config, rpc, Warden.Prison, coinJoinIdStore, roundParameterFactory, transactionArchiver, coinJoinScriptStore); IoHelpers.EnsureContainingDirectoryExists(Parameters.CoinJoinIdStoreFilePath); Arena.CoinJoinBroadcast += Arena_CoinJoinBroadcast; }
public static Statement IssuerParametersStmt(CoordinatorParameters iparams, MAC mac, GroupElement ma) => new Statement(new GroupElement[, ] { // public Witness terms: // point w, wp, x0, x1, ya { mac.V, Generators.Gw, O, mac.U, mac.T * mac.U, ma }, { Generators.GV - iparams.I, O, O, Generators.Gx0, Generators.Gx1, Generators.Ga }, { iparams.Cw, Generators.Gw, Generators.Gwp, O, O, O }, });
public WabiSabiClient( CoordinatorParameters coordinatorParameters, int numberOfCredentials, WasabiRandom randomNumberGenerator) { RandomNumberGenerator = Guard.NotNull(nameof(randomNumberGenerator), randomNumberGenerator); NumberOfCredentials = Guard.InRangeAndNotNull(nameof(numberOfCredentials), numberOfCredentials, 1, 100); CoordinatorParameters = Guard.NotNull(nameof(coordinatorParameters), coordinatorParameters); Credentials = new CredentialPool(); }
public CoordinatorContext(CoordinatorParameters parameters, CoordinatorDependencies dependencies, CoordinatorHooks hooks, CoordinatorConfiguration configuration) { this.parameters = parameters; this.dependencies = dependencies; this.hooks = hooks; this.configuration = configuration; collection = new CoordinatorCollection(); facts = new CoordinatorFacts(); }
public static Statement ShowCredentialStmt(CredentialPresentation c, GroupElement Z, CoordinatorParameters iparams) => new Statement(new GroupElement[, ] { // public Witness terms: // point z z0 t a r { Z, iparams.I, O, O, O, O }, { c.Cx1, Generators.Gx1, Generators.Gx0, c.Cx0, O, O }, { c.Ca, Generators.Ga, O, O, Generators.Gg, Generators.Gh }, { c.S, O, O, O, O, Generators.Gs } });
public static Knowledge ShowCredential(CredentialPresentation presentation, Scalar z, Credential credential, CoordinatorParameters iparams) => new Knowledge( ShowCredentialStmt(presentation, z * iparams.I, iparams), new ScalarVector(z, (credential.Mac.T * z).Negate(), credential.Mac.T, credential.Amount, credential.Randomness));
public static LinearRelation.Statement CreateStatement(CoordinatorParameters coordinatorParameters, GroupElement V, GroupElement Ma, Scalar t) => new LinearRelation.Statement( new GroupElementVector(coordinatorParameters.Cw, Generators.GV - coordinatorParameters.I, V) .Zip(ProofOfParametersGenerators(MAC.GenerateU(t), Ma, t), (publicPoint, groupElement) => new Equation(publicPoint, groupElement)));
private static WabiSabiCoordinator CreateWabiSabiCoordinator(CoordinatorParameters coordinatorParameters) => new(coordinatorParameters, NewMockRpcClient(), new CoinJoinIdStore(), new CoinJoinScriptStore());