Dispatches a raw hex transaction to the network.
162416
def broadcast_transaction(hex_tx, blockchain_client):
    
    if isinstance(blockchain_client, BlockcypherClient):
        return blockcypher.broadcast_transaction(hex_tx, blockchain_client)
    elif isinstance(blockchain_client, BlockchainInfoClient):
        return blockchain_info.broadcast_transaction(hex_tx, blockchain_client)
    elif isinstance(blockchain_client, ChainComClient):
        return chain_com.broadcast_transaction(hex_tx, blockchain_client)
    elif isinstance(blockchain_client, (BitcoindClient, AuthServiceProxy)):
        return bitcoind.broadcast_transaction(hex_tx, blockchain_client)
    elif hasattr(blockchain_client, "broadcast_transaction"):
        return blockchain_client.broadcast_transaction( hex_tx )
    elif isinstance(blockchain_client, BlockchainClient):
        raise Exception('That blockchain interface is not supported.')
    else:
        raise Exception('A BlockchainClient object is required')
1301232
def send(self, out, addr=_MDNS_ADDR, port=_MDNS_PORT):
        """"""
        # This is a quick test to see if we can parse the packets we generate
        #temp = DNSIncoming(out.packet())
        for i in self.intf.values():
            try:
                return i.sendto(out.packet(), 0, (addr, port))
            except:
                traceback.print_exc()
                # Ignore this, it may be a temporary loss of network connection
                return -1
96943
def transaction():
    
    client = default_client()
    _thread.client = client.pipeline()
    try:
        yield
        _thread.client.execute()
    finally:
        _thread.client = client
1336294
public function sendRawTransaction($txHex) {
        $response = $this->blocktrailClient->post("send-raw-tx", null, ['hex' => $txHex], RestClient::AUTH_HTTP_SIG);
        return self::jsonDecode($response->body(), true);
    }
228018
private Fabric.Response execute(Transaction tx) throws CryptoException, IOException {
        logger.debug(String.format("Executing transaction [%s]", tx));

        // Set nonce
        tx.getTxBuilder().setNonce(ByteString.copyFrom(this.nonce));

        // Process confidentiality
        logger.debug("Process Confidentiality...");

        this.processConfidentiality(tx);

        logger.debug("Sign transaction...");

        if (getChain().isSecurityEnabled()) {
            // Add the tcert
            tx.getTxBuilder().setCert(ByteString.copyFrom(tcert.getCert()));
            // sign the transaction bytes
            byte[] txBytes = tx.getTxBuilder().buildPartial().toByteArray();
            BigInteger[] signature = this.chain.getCryptoPrimitives().ecdsaSign(tcert.getPrivateKey(), txBytes);
            byte[] derSignature = this.chain.getCryptoPrimitives().toDER(
                    new byte[][]{signature[0].toByteArray(), signature[1].toByteArray()});

            tx.getTxBuilder().setSignature(ByteString.copyFrom(derSignature));
        }

        logger.debug("Send transaction...");
        logger.debug("Confidentiality: " + tx.getTxBuilder().getConfidentialityLevel());

        if (tx.getTxBuilder().getConfidentialityLevel() == Chaincode.ConfidentialityLevel.CONFIDENTIAL &&
                tx.getTxBuilder().getType() == Fabric.Transaction.Type.CHAINCODE_QUERY) {
            Fabric.Response response = this.getChain().sendTransaction(tx);
            if (response.getStatus() == StatusCode.SUCCESS) {
                byte[] message = decryptResult(response.getMsg().toByteArray());
                return Fabric.Response.newBuilder()
                        .setStatus(StatusCode.SUCCESS)
                        .setMsg(ByteString.copyFrom(message))
                        .build();
            } else {
                return response;
            }
        } else {
            return this.getChain().sendTransaction(tx);
        }
    }
1007262
def _send_ffd(self, pid, aplx_data, address):
        """"""
        block = 0
        pos = 0
        aplx_size = len(aplx_data)

        while pos < aplx_size:
            # Get the next block of data, send and progress the block
            # counter and the address
            data = aplx_data[pos:pos + self.scp_data_length]
            data_size = len(data)
            size = data_size // 4 - 1

            arg1 = (NNConstants.forward << 24 | NNConstants.retry << 16 | pid)
            arg2 = (block << 16) | (size << 8)
            self._send_scp(255, 255, 0, SCPCommands.flood_fill_data,
                           arg1, arg2, address, data)

            # Increment the address and the block counter
            block += 1
            address += data_size
            pos += data_size
585070
def _handle_post(self, transaction):
        
        path = str("/" + transaction.request.uri_path)
        transaction.response = Response()
        transaction.response.destination = transaction.request.source
        transaction.response.token = transaction.request.token

        # Create request
        transaction = self._server.resourceLayer.create_resource(path, transaction)
        return transaction
1347280
def broadcast_transaction(hex_tx, blockchain_client):
    
    if isinstance(blockchain_client, BitcoindClient):
        bitcoind = blockchain_client.bitcoind
    elif isinstance(blockchain_client, AuthServiceProxy):
        bitcoind = blockchain_client
    else:
        raise Exception('A BitcoindClient object is required')

    try:
        resp = bitcoind.sendrawtransaction(hex_tx)
    except httplib.BadStatusLine:
        raise Exception('Invalid HTTP status code from bitcoind.')

    if len(resp) > 0:
        return {'tx_hash': resp, 'success': True}
    else:
        raise Exception('Invalid response from bitcoind.')
214743
def handle_raw_tx_packet(self, writer, raw_packet):
        """"""
        peer = writer.get_extra_info('peername')
        log.debug(' %s:%s: processing data: %s', peer[0], peer[1], raw_packet)
        packet = None
        try:
            packet = decode_tx_packet(raw_packet)
        except:
            log.exception(' %s:%s: failed to parse packet: %s',
                          peer[0], peer[1], packet)

        log.debug(' %s:%s: decoded packet: %s', peer[0], peer[1], packet)
        if self.protocol and packet:
            if not ';PING;' in raw_packet:
                log.info(' %s:%s: forwarding packet %s to RFLink', peer[0], peer[1], raw_packet)
            else:
                log.debug(' %s:%s: forwarding packet %s to RFLink', peer[0], peer[1], raw_packet)
            yield from self.forward_packet(writer, packet, raw_packet)
        else:
            log.warning(' %s:%s: no valid packet %s', peer[0], peer[1], packet)
772995
def send_response(self, transaction):
        
        if transaction.cacheHit is False:
            """
            handling response based on the code
            """
            logger.debug("handling response")
            self._handle_response(transaction)
        return transaction
1154430
def sign(self, key, network_id=None):
        
        if network_id is None:
            rawhash = utils.sha3(rlp.encode(unsigned_tx_from_tx(self), UnsignedTransaction))
        else:
            assert 1 <= network_id < 2**63 - 18
            rlpdata = rlp.encode(rlp.infer_sedes(self).serialize(self)[
                                 :-3] + [network_id, b'', b''])
            rawhash = utils.sha3(rlpdata)

        key = normalize_key(key)

        v, r, s = ecsign(rawhash, key)
        if network_id is not None:
            v += 8 + network_id * 2

        ret = self.copy(
            v=v, r=r, s=s
        )
        ret._sender = utils.privtoaddr(key)
        return ret
1145615
public void distributeCommit()
                    throws SystemException, HeuristicHazardException, HeuristicMixedException, HeuristicRollbackException {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "distributeCommit");

        final TransactionState ts = _transaction.getTransactionState();
        ts.setCommittingStateUnlogged();

        // Shuffle resources around according to commit priority order
        _retryRequired = sortResources();
        if (!_retryRequired) {
            _outcome = true;
            _retryRequired = distributeOutcome();
        } else {
            updateHeuristicOutcome(StatefulResource.HEURISTIC_HAZARD);
        }

        if (_systemException != null) {
            final Throwable toThrow = new SystemException().initCause(_systemException);
            if (tc.isEntryEnabled())
                Tr.exit(tc, "distributeCommit", toThrow);
            throw (SystemException) toThrow;
        }

        // check for heuristics ... as we will move forget processing to TransactionImpl later
        if (HeuristicOutcome.isHeuristic(_heuristicOutcome)) {
            switch (_heuristicOutcome) {
                case StatefulResource.HEURISTIC_COMMIT:
                    break;

                case StatefulResource.HEURISTIC_ROLLBACK:
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "distributeCommit", "HeuristicRollbackException");
                    throw new HeuristicRollbackException();

                case StatefulResource.HEURISTIC_HAZARD:
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "distributeCommit", "HeuristicHazardException");
                    throw new HeuristicHazardException();

                default:
                    if (tc.isEntryEnabled())
                        Tr.exit(tc, "distributeCommit", "HeuristicMixedException");
                    throw new HeuristicMixedException();
            }
        }

        if (tc.isEntryEnabled())
            Tr.exit(tc, "distributeCommit");
    }
647534
def signrawtransaction(self, rawtxhash, parent_tx_outputs=None, private_key=None):
        

        if not parent_tx_outputs and not private_key:
            return self.req("signrawtransaction", [rawtxhash])
        else:
            return self.req(
                "signrawtransaction", [rawtxhash, parent_tx_outputs, private_key]
            )
729606
def sign_tx(self, rawtx, wifs):
        
        tx = deserialize.tx(rawtx)
        keys = deserialize.keys(self.testnet, wifs)
        tx = control.sign_tx(self.service, self.testnet, tx, keys)
        return serialize.tx(tx)
877012
function transact(transaction, api, secret, options, converter, callback) {
  if (options.submit === false) {
    prepareAndOptionallySign.apply(this, arguments);
  } else {
    prepareAndSignAndSubmit.apply(this, arguments);
  }
}
76175
def send_raw(self, string):
        
        log.debug('RAW: {}'.format(string))
        if self.transport is None:
            raise ServerNotConnectedError("Not connected.")

        self.transport.write(self._prep_message(string))
416438
def broadcast_tx(self, tx):
        
        url = self.base_url("txs/push")
        data = {"tx": tx.as_hex()}
        result = json.loads(urlopen(url, data=json.dumps(data)).read().decode("utf8"))
        return result