Architecture Behind Sila Ethereum Transactions

https://silamoney.com/2019/07/08/using-aws-lambda-sqs-with-web3/ https://silamoney.com/2019/07/08/using-aws-lambda-sqs-with-web3-2/ Major components DynamoDB to store the nonce associated with ethereum addresses authorized to send ethereum smart contract transactions Lambda functions triggered by SQS events for SilaToken issuance, redemption, and transfer messages Ethereum RPC EC2 servers running Parity Ethereum client AWS Secrets Manager to store private keys being used to sign the transactions Orchestrator as a bridge between REST API, ACH, and ethereum transactions. Orchestrator is a piece of code that handles the transaction state and reroutes them to right queue. SQS as an interface between different services like REST API, ACH, Ethereum issuance, redemption, and transfers. Transaction Lifecycle Messages for SilaToken issuance, redemption, and transfer comes in through Sila APIs. Dependent on the action (issue, redeem, and transfer), the message is sent to the relevant queue by Orchestrator, which in turn triggers the send transaction Lambda function. ...

2019-12-20 · 4 min · 765 words · Me

ethereum Nonce collisions

https://hackernoon.com/ethereum-blockchain-in-a-real-project-with-500k-users-f85ee4821b12 Nonce collisions Nonce collisions were another mysterious thing we’ve encountered when trying to scale the number of Geth nodes in order to cover the case when one node crashes. It turns out that We used a simple load balancer before the three Geth nodes, which was sending each transaction to one of the three nodes. The problem was that each time we submitted many transactions at once, some of those transactions were mysteriously disappearing. It took a day or two until we finally figured out that this was a problem with nonce collisions. ...

2019-12-18 · 2 min · 285 words · Me

ethereum Proper Transaction Signing nonce

https://ethereum.stackexchange.com/questions/12823/proper-transaction-signing const Web3 = require('web3'); const Tx = require('ethereumjs-tx'); const config = require('./config'); const web3 = new Web3(new Web3.providers.HttpProvider(config.provider)); //link provided by Infura.io web3.eth.defaultAccount = "0xc929c890f1398d5c1ecdf4f9ecec016906ac9f7f"; const getNonce = () => { return new Promise((resolve, reject) => { web3.eth.getTransactionCount(web3.eth.defaultAccount, (error, result) => { if(error) reject(error); resolve(web3.toHex(result)); }) }) } const getGasPrice = () => { return new Promise((resolve, reject) => { web3.eth.getGasPrice((error, result) => { if(error) reject(error); resolve(web3.toHex(result.toNumber())); }) }) } const sendRawTransaction = (rawTx) => { const privateKey = "190b820c2627f26fd1b973b72dcba78ff677ca4395c64a4a2d0f4ef8de36883c"; const tx = new Tx(rawTx); const privateKeyBuffer = Buffer.from(privateKey, 'hex'); tx.sign(privateKeyBuffer); const serializedTx = tx.serialize(); web3.eth.sendRawTransaction('0x' + serializedTx.toString('hex'), function(err, hash) { console.log('Error:', err); console.log('Hash:', hash); }); } Promise.all([getNonce(), getGasPrice()]) .then(values => { const rawTx = { to: '0x203D17B4a1725E001426b7Ab3193E6657b0dBcc6', gasLimit: web3.toHex(1000000), value: web3.toHex(web3.toWei('0.1', 'ether')), nonce: values[0], gasPrice: values[1] }; console.log(rawTx); return(rawTx); }) .then(sendRawTransaction) .catch(e => console.log(e))

2019-12-18 · 1 min · 136 words · Me

ring buffer

https://zhen.org/blog/ring-buffer-variable-length-low-latency-disruptor-style/ https://github.com/smartystreets-prototypes/go-disruptor

2019-12-18 · 1 min · 2 words · Me

ethereum transaction template

https://ethereum.stackexchange.com/questions/50042/why-does-sendsignedtransaction-return-a-tx-hash-but-does-not-post-to-the-rinkeby window.web3 = new Web3(new Web3.providers.HttpProvider(endpoint)); sendEther() { const fromAccount = **acct1**; const toAccount = **acct2**; const rawTransaction = this.makeRawTransaction(fromAccount, toAccount); const signedTransaction = this.makeSignedTransaction(rawTransaction); const serializedTransaction = `0x${signedTransaction.serialize().toString('hex')}`; window.web3.eth.sendSignedTransaction(serializedTransaction, (error, result) => { if(!error) { console.log(`Transaction hash is: ${result}`); this.setState({ etherscanUrl: `https://rinkeby.etherscan.io/tx/${result}`, error: null }); } else { this.setState({ error: error.message }) console.error(error); } }); } makeSignedTransaction(rawTransaction) { const privateKey = '**************'; const privateKeyX = new Buffer(privateKey, 'hex'); const transaction = new EthTx(rawTransaction); transaction.sign(privateKeyX); return transaction; } makeRawTransaction(fromAccount, toAccount) { const { exchangeRate } = this.props; const amount = (1 / exchangeRate) * 5; return ({ nonce: window.web3.utils.toHex(window.web3.eth.getTransactionCount(fromAccount)), to: toAccount, gasPrice: window.web3.utils.toHex(100000000000), gasLimit: window.web3.utils.toHex(100000), value: window.web3.utils.toHex(window.web3.utils.toWei(`${amount}`, 'ether')), data: '' }); }

2019-12-18 · 1 min · 112 words · Me